mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 18:26:34 +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 dayjs from "dayjs";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -6,6 +6,8 @@ import {
|
||||||
TimeOption,
|
TimeOption,
|
||||||
} from "../components/forms/poll-options-form";
|
} from "../components/forms/poll-options-form";
|
||||||
|
|
||||||
|
type Option = { id: string; start: Date; duration: number };
|
||||||
|
|
||||||
export const getBrowserTimeZone = () =>
|
export const getBrowserTimeZone = () =>
|
||||||
Intl.DateTimeFormat().resolvedOptions().timeZone;
|
Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Option, User } from "@rallly/database";
|
import { User } from "@rallly/database";
|
||||||
|
|
||||||
export type GetPollApiResponse = {
|
export type GetPollApiResponse = {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
location: string | null;
|
location: string | null;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
options: Option[];
|
options: { id: string; start: Date; duration: number }[];
|
||||||
user: User | null;
|
user: User | null;
|
||||||
timeZone: string | null;
|
timeZone: string | null;
|
||||||
adminUrlId: string;
|
adminUrlId: string;
|
||||||
|
|
|
@ -405,6 +405,11 @@ export const polls = router({
|
||||||
hideScores: true,
|
hideScores: true,
|
||||||
demo: true,
|
demo: true,
|
||||||
options: {
|
options: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
start: true,
|
||||||
|
duration: true,
|
||||||
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
start: "asc",
|
start: "asc",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue