diff --git a/PROJECT.md b/PROJECT.md index 919d187..06c4c8b 100644 --- a/PROJECT.md +++ b/PROJECT.md @@ -1,9 +1,9 @@ ## Status ### Last Completed -Continued working on the app structure, more specifically started playing around with redirects and created an example registry to see how that would work. +Built out the schema for the most part ### Next Up -Continue to build on app structure +Actually apply the schema and play around with adding data in studio ## Feature List ### Must Haves @@ -35,6 +35,8 @@ For guests that are given a +1, there will be a placeholder name added as a Gues The `(app)` directory will be for all pages that need to have authentication. These will be the pages that the couple or planner will have access to. Publically facing pages will be in the `(public)` directory (things like the landing page and login page). This will also allow for a "wedding website" option that is publically accessible. +Decided to make Venues part of the Vendor model since they are practically the same, and contain most of the same behavior. People can "shop around" for venues just like they can with any other vendor. + ## Open Questions I would like to have a general `AllowList` for the urls in the registry but give users the option to add more to the AllowList if they would like. \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0370574..74cdfc2 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -14,7 +14,295 @@ datasource db { url = env("DATABASE_URL") } +enum Role { + COUPLE + PLANNER +} + +enum RsvpStatus { + PENDING + ACCEPTED + DECLINED +} + +enum VendorStatus { + RESEARCHING + CONTACTING + RESPONDED + PROPOSAL_RECEIVED + NEGOTIATING + CONTRACT_SENT + CONTRACT_SIGNED + DECLINED + BACKUP +} + +enum FileKind { + CONTRACT + PROPOSAL + OTHER +} + model User { - id String @id @default(cuid()) - email String @unique + id String @id @default(cuid()) + email String @unique + name String + username String @unique + password String? // hashed pw, optional for OIDC + authProvider String? + providerId String? + isAdmin Boolean @default(false) + createdAt DateTime @default(now()) + + memberships Membership[] + fileUploads FileUpload[] + allowedOrigins AllowedOrigin[] + + @@unique([authProvider, providerId]) +} + +model Project { + id String @id @default(cuid()) + name String @unique + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + archivedAt DateTime + + memberships Membership[] + invites InviteToken[] + events Event[] + households Household[] +} + +model Membership { + id String @id @default(cuid()) + role Role + createdAt DateTime @default(now()) + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String + event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String? + + @@index([userId]) + @@index([projectId]) +} + +model InviteToken { + id String @id @default(cuid()) + email String + role Role + token String @unique + expiresAt DateTime + acceptedAt DateTime? + createdAt DateTime @default(now()) + + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String + event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String? + + @@index([email]) +} + +model Event { + id String @id @default(cuid()) + slug String @unique + name String + date DateTime? + notes String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String + + memberships Membership[] + invites InviteToken[] + todos EventTodo[] + eventGuests EventGuest[] + eventVendors EventVendor[] + registryItems RegistryItem[] + fileUploads FileUpload[] + + @@index([projectId]) +} + +model EventTodo { + id String @id @default(cuid()) + name String + complete Boolean @default(false) + dueDate DateTime? + notes String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String + + @@index([eventId]) +} + +model Address { + id String @id @default(cuid()) + line1 String + line2 String? + city String + state String + postalCode String + country String @default("United States") + + household Household? + vendor Vendor? +} + +model Household { + id String @id @default(cuid()) + name String + token String @unique @default(uuid()) + notes String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String + address Address @relation(fields: [addressId], references: [id]) + addressId String @unique + + guests Guest[] + + @@index([projectId]) +} + +model Guest { + id String @id @default(cuid()) + firstName String + lastName String? + email String? + phone String? + notes String? + side String? + congratulated Boolean @default(false) + isPlaceHolder Boolean @default(false) + createdAt DateTime @default(now()) + + household Household @relation(fields: [householdId], references: [id], onDelete: Cascade) + householdId String + + eventGuest EventGuest[] + + @@index([householdId]) +} + +model EventGuest { + id String @id @default(cuid()) + rsvp RsvpStatus @default(PENDING) + respodedAt DateTime? + createdAt DateTime @default(now()) + + event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String + guest Guest @relation(fields: [guestId], references: [id], onDelete: Cascade) + guestId String + + @@unique([eventId, guestId]) + @@index([guestId]) +} + +model VendorCategory { + id String @id @default(cuid()) + name String + description String? + color String? @default("#3B82F6") + + vendors Vendor[] +} + +model Vendor { + id String @id @default(cuid()) + slug String @unique + name String + description String? + website String? + contactPerson String? + email String? + phone String? + notes String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + category VendorCategory? @relation(fields: [categoryId], references: [id], onDelete: SetNull) + categoryId String? + address Address? @relation(fields: [addressId], references: [id]) + addressId String? + + eventVendors EventVendor[] +} + +model EventVendor { + id String @id @default(cuid()) + status VendorStatus @default(RESEARCHING) + bookedDate DateTime? + quotedPrice Decimal? @db.decimal(10, 2) + finalCost Decimal? @db.decimal(10, 2) + depositPaid Decimal? @db.decimal(10, 2) + depositDueDate DateTime? + finalPaymentDue DateTime? + paymentNotes String? + notes String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String + vendor Vendor @relation(fields: [vendorId], references: [id], onDelete: Restrict) + vendorId String + + fileUploads FileUpload[] + + @@unique([vendorId, eventId]) + @@index([vendorId]) +} + +model FileUpload { + id String @id @default(cuid()) + originalName String + storageKey String @unique + mimeType String + size Int + kind FileKind @default(OTHER) + uploadedAt DateTime @default(now()) + + uploadedBy User @relation(fields: [uploadedById], references: [id]) + uploadedById String + event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String? + eventVendor Vendor? @relation(fields: [eventVendorId], references: [id], onDelete: Cascade) + eventVendorId String? +} + +model RegistryItem { + id String @id @default(cuid()) + slug String + name String + url String + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + event Event? @relation(fields: [eventId], references: [id], onDelete: Cascade) + eventId String? + + @@unique([eventId, slug]) +} + +model AllowedOrigin { + id String @id @default(cuid()) + origin String @unique + isDefault Boolean @default(false) + createdAt DateTime @default(now()) + + addedBy User? @relation(fields: [addedById], references: [id], onDelete: SetNull) + addedById String? } \ No newline at end of file diff --git a/src/routes/(public)/login/+page.svelte b/src/routes/(public)/login/+page.svelte index d7ee809..18c3eff 100644 --- a/src/routes/(public)/login/+page.svelte +++ b/src/routes/(public)/login/+page.svelte @@ -1 +1,6 @@ -
Visit svelte.dev/docs/kit to read the documentation
- +Visit svelte.dev/docs/kit to read the documentation
+