built out schema

This commit is contained in:
2026-10-07 11:13:44 -04:00
parent 4e9c5d3355
commit 8d25f34738
4 changed files with 312 additions and 11 deletions

View File

@@ -1,9 +1,9 @@
## Status ## Status
### Last Completed ### 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 ### Next Up
Continue to build on app structure Actually apply the schema and play around with adding data in studio
## Feature List ## Feature List
### Must Haves ### 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. 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 ## 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. 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.

View File

@@ -14,7 +14,295 @@ datasource db {
url = env("DATABASE_URL") 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 { model User {
id String @id @default(cuid()) id String @id @default(cuid())
email String @unique 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?
} }

View File

@@ -1 +1,6 @@
<h1>Login Page</h1> <script>
import Button from "#lib/components/ui/button/button.svelte";
</script>
<h1>Login Page</h1>
<Button href="/dashboard">Login</Button>

View File

@@ -1,7 +1,13 @@
<h1>Welcome to SvelteKit</h1> <div class="h-screen flex flex-col">
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p> <div>
<script lang="ts"> <h1>Welcome to SvelteKit</h1>
import { Button } from "#lib/components/ui/button/index.js"; <p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
</script> </div>
<div class="absolute bottom-0 p-2">
<a href="/login" class="text-sky-600 underline">Go to login page</a>
</div>
</div>
<Button href="/dashboard">Click me</Button>