️ Optimize options query

This commit is contained in:
Luke Vella 2023-08-25 18:31:09 +01:00
parent f10fd919c7
commit bc521f7ecb
3 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,4 @@
import { Option, TimeFormat } from "@rallly/database";
import { TimeFormat } from "@rallly/database";
import dayjs from "dayjs";
import {
@ -6,6 +6,8 @@ import {
TimeOption,
} from "../components/forms/poll-options-form";
type Option = { id: string; start: Date; duration: number };
export const getBrowserTimeZone = () =>
Intl.DateTimeFormat().resolvedOptions().timeZone;

View file

@ -1,11 +1,11 @@
import { Option, User } from "@rallly/database";
import { User } from "@rallly/database";
export type GetPollApiResponse = {
id: string;
title: string;
location: string | null;
description: string | null;
options: Option[];
options: { id: string; start: Date; duration: number }[];
user: User | null;
timeZone: string | null;
adminUrlId: string;

View file

@ -405,6 +405,11 @@ export const polls = router({
hideScores: true,
demo: true,
options: {
select: {
id: true,
start: true,
duration: true,
},
orderBy: {
start: "asc",
},