mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 10:16:32 +02:00
⚡️ Optimize options query
This commit is contained in:
parent
f10fd919c7
commit
bc521f7ecb
3 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -405,6 +405,11 @@ export const polls = router({
|
|||
hideScores: true,
|
||||
demo: true,
|
||||
options: {
|
||||
select: {
|
||||
id: true,
|
||||
start: true,
|
||||
duration: true,
|
||||
},
|
||||
orderBy: {
|
||||
start: "asc",
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue