From 00df1a2e40d4c1f19c40393cad9821fd236aa659 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Tue, 13 Feb 2024 16:49:52 +0800 Subject: [PATCH] uncommit --- .../{ => (admin)}/create/create-form.tsx | 6 +- .../{ => (admin)}/create/invite-card.tsx | 0 .../[locale]/{ => (admin)}/create/loading.tsx | 0 .../[locale]/{ => (admin)}/create/page.tsx | 12 +-- packages/database/prisma/schema.prisma | 102 ++++++++++++------ 5 files changed, 78 insertions(+), 42 deletions(-) rename apps/web/src/app/[locale]/{ => (admin)}/create/create-form.tsx (98%) rename apps/web/src/app/[locale]/{ => (admin)}/create/invite-card.tsx (100%) rename apps/web/src/app/[locale]/{ => (admin)}/create/loading.tsx (100%) rename apps/web/src/app/[locale]/{ => (admin)}/create/page.tsx (84%) diff --git a/apps/web/src/app/[locale]/create/create-form.tsx b/apps/web/src/app/[locale]/(admin)/create/create-form.tsx similarity index 98% rename from apps/web/src/app/[locale]/create/create-form.tsx rename to apps/web/src/app/[locale]/(admin)/create/create-form.tsx index 90b27e573..5ccc95411 100644 --- a/apps/web/src/app/[locale]/create/create-form.tsx +++ b/apps/web/src/app/[locale]/(admin)/create/create-form.tsx @@ -40,7 +40,7 @@ import { InviteCard, InviteCardForm, InviteCardGeneral, -} from "@/app/[locale]/create/invite-card"; +} from "@/app/[locale]/(admin)/create/invite-card"; import { PageContainer, PageContent, @@ -426,8 +426,8 @@ export function CreateForm() {
-
-

Preview

+
+
Preview
diff --git a/apps/web/src/app/[locale]/create/invite-card.tsx b/apps/web/src/app/[locale]/(admin)/create/invite-card.tsx similarity index 100% rename from apps/web/src/app/[locale]/create/invite-card.tsx rename to apps/web/src/app/[locale]/(admin)/create/invite-card.tsx diff --git a/apps/web/src/app/[locale]/create/loading.tsx b/apps/web/src/app/[locale]/(admin)/create/loading.tsx similarity index 100% rename from apps/web/src/app/[locale]/create/loading.tsx rename to apps/web/src/app/[locale]/(admin)/create/loading.tsx diff --git a/apps/web/src/app/[locale]/create/page.tsx b/apps/web/src/app/[locale]/(admin)/create/page.tsx similarity index 84% rename from apps/web/src/app/[locale]/create/page.tsx rename to apps/web/src/app/[locale]/(admin)/create/page.tsx index c3bc505bd..f3e7d0e7e 100644 --- a/apps/web/src/app/[locale]/create/page.tsx +++ b/apps/web/src/app/[locale]/(admin)/create/page.tsx @@ -1,18 +1,14 @@ import { Button } from "@rallly/ui/button"; -import { ArrowLeftIcon, ChevronRightIcon, XIcon } from "lucide-react"; +import { ChevronRightIcon, XIcon } from "lucide-react"; import Link from "next/link"; -import { CreateForm } from "@/app/[locale]/create/create-form"; -import { - PageContainer, - PageContent, - PageHeader, -} from "@/app/components/page-layout"; +import { CreateForm } from "@/app/[locale]/(admin)/create/create-form"; +import { PageContainer, PageContent } from "@/app/components/page-layout"; import { getTranslation } from "@/app/i18n"; export default async function Page({ params }: { params: { locale: string } }) { return ( - +
diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma index ada8e6ba3..67f15af25 100644 --- a/packages/database/prisma/schema.prisma +++ b/packages/database/prisma/schema.prisma @@ -52,12 +52,13 @@ model User { customerId String? @map("customer_id") subscriptionId String? @unique @map("subscription_id") - comments Comment[] - polls Poll[] - watcher Watcher[] - events Event[] - subscription Subscription? @relation(fields: [subscriptionId], references: [id]) - accounts Account[] + comments Comment[] + polls Poll[] + watcher Watcher[] + events Event[] + subscription Subscription? @relation(fields: [subscriptionId], references: [id]) + accounts Account[] + schedulingPolls SchedulingPoll[] @@map("users") } @@ -127,35 +128,35 @@ enum PollStatus { } model Poll { - id String @id @unique @map("id") - createdAt DateTime @default(now()) @map("created_at") - updatedAt DateTime @updatedAt @map("updated_at") + id String @id @unique @map("id") + createdAt DateTime @default(now()) @map("created_at") + updatedAt DateTime @updatedAt @map("updated_at") deadline DateTime? title String description String? location String? - userId String @map("user_id") - timeZone String? @map("time_zone") - closed Boolean @default(false) // @deprecated - status PollStatus @default(live) - deleted Boolean @default(false) - deletedAt DateTime? @map("deleted_at") - touchedAt DateTime @default(now()) @map("touched_at") - participantUrlId String @unique @map("participant_url_id") - adminUrlId String @unique @map("admin_url_id") - eventId String? @unique @map("event_id") - hideParticipants Boolean @default(false) @map("hide_participants") - hideScores Boolean @default(false) @map("hide_scores") - disableComments Boolean @default(false) @map("disable_comments") - requireParticipantEmail Boolean @default(false) @map("require_participant_email") + userId String @map("user_id") + timeZone String? @map("time_zone") + closed Boolean @default(false) // @deprecated + status PollStatus @default(live) + deleted Boolean @default(false) + deletedAt DateTime? @map("deleted_at") + touchedAt DateTime @default(now()) @map("touched_at") + participantUrlId String @unique @map("participant_url_id") + adminUrlId String @unique @map("admin_url_id") + eventId String? @unique @map("event_id") + hideParticipants Boolean @default(false) @map("hide_participants") + hideScores Boolean @default(false) @map("hide_scores") + disableComments Boolean @default(false) @map("disable_comments") + requireParticipantEmail Boolean @default(false) @map("require_participant_email") - user User? @relation(fields: [userId], references: [id]) - event Event? @relation(fields: [eventId], references: [id]) - options Option[] - participants Participant[] - watchers Watcher[] - comments Comment[] - votes Vote[] + user User? @relation(fields: [userId], references: [id]) + event Event? @relation(fields: [eventId], references: [id]) + options Option[] + participants Participant[] + watchers Watcher[] + comments Comment[] + votes Vote[] @@index([userId], type: Hash) @@map("polls") @@ -171,7 +172,7 @@ model Event { duration Int @default(0) @map("duration_minutes") createdAt DateTime @default(now()) @map("created_at") - Poll Poll? + Poll Poll? @@index([userId], type: Hash) @@map("events") @@ -205,6 +206,45 @@ model Participant { @@map("participants") } +model SchedulingPoll { + id String @id @default(cuid()) + userId String @map("user_id") + user User @relation(fields: [userId], references: [id]) + prompt String? + createdAt DateTime @default(now()) @map("created_at") + updatedAt DateTime @updatedAt @map("updated_at") + eventTitle String @map("event_title") + eventDescription String? @map("event_description") + eventLocation String? @map("event_location") + eventTimeZone String? @map("time_zone") + eventDuration Int? @map("event_duration_minutes") + pollOptions DateTime[] @map("poll_options") + + responses SchedulingPollResponse[] + + @@index([userId], type: Hash) + @@map("scheduling_polls") +} + +model SchedulingPollResponse { + id String @id @default(cuid()) + userId String @map("user_id") + name String + email String + timeZone String @map("time_zone") + locale String + notificationsEnabled Boolean @map("notifications_enabled") + schedulingPollId String @map("scheduling_poll_id") + votes Json + createdAt DateTime @default(now()) @map("created_at") + + schedulingPoll SchedulingPoll @relation(fields: [schedulingPollId], references: [id]) + availabilityHeatmapId String? + + @@index([schedulingPollId], type: Hash) + @@map("scheduling_poll_responses") +} + model Option { id String @id @default(cuid()) start DateTime @db.Timestamp(0)