mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-13 14:37:27 +02:00
✨ Add spaces concept (#1776)
This commit is contained in:
parent
92a72dde60
commit
04fcc0350f
21 changed files with 389 additions and 93 deletions
|
@ -11,8 +11,10 @@ model Subscription {
|
|||
periodEnd DateTime @map("period_end")
|
||||
cancelAtPeriodEnd Boolean @default(false) @map("cancel_at_period_end")
|
||||
userId String @unique @map("user_id")
|
||||
spaceId String? @unique @map("space_id")
|
||||
|
||||
user User @relation("UserToSubscription", fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation("UserToSubscription", fields: [userId], references: [id], onDelete: Cascade)
|
||||
space Space? @relation("SpaceToSubscription", fields: [spaceId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@map("subscriptions")
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ enum ScheduledEventInviteStatus {
|
|||
model ScheduledEvent {
|
||||
id String @id @default(cuid())
|
||||
userId String @map("user_id")
|
||||
spaceId String @map("space_id")
|
||||
title String
|
||||
description String?
|
||||
location String?
|
||||
|
@ -31,6 +32,7 @@ model ScheduledEvent {
|
|||
deletedAt DateTime? @map("deleted_at")
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
space Space @relation(fields: [spaceId], references: [id], onDelete: Cascade)
|
||||
rescheduledDates RescheduledEventDate[]
|
||||
invites ScheduledEventInvite[]
|
||||
polls Poll[]
|
||||
|
|
|
@ -46,6 +46,8 @@ model Poll {
|
|||
comments Comment[]
|
||||
votes Vote[]
|
||||
views PollView[]
|
||||
space Space? @relation(fields: [spaceId], references: [id], onDelete: SetNull)
|
||||
spaceId String? @map("space_id")
|
||||
|
||||
@@index([guestId])
|
||||
@@map("polls")
|
||||
|
|
|
@ -33,30 +33,33 @@ enum UserRole {
|
|||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
email String @unique() @db.Citext
|
||||
emailVerified DateTime? @map("email_verified")
|
||||
image String?
|
||||
timeZone String? @map("time_zone")
|
||||
weekStart Int? @map("week_start")
|
||||
timeFormat TimeFormat? @map("time_format")
|
||||
locale String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
customerId String? @map("customer_id")
|
||||
banned Boolean @default(false)
|
||||
bannedAt DateTime? @map("banned_at")
|
||||
banReason String? @map("ban_reason")
|
||||
role UserRole @default(user)
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
email String @unique() @db.Citext
|
||||
emailVerified DateTime? @map("email_verified")
|
||||
image String?
|
||||
timeZone String? @map("time_zone")
|
||||
weekStart Int? @map("week_start")
|
||||
timeFormat TimeFormat? @map("time_format")
|
||||
locale String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
customerId String? @map("customer_id")
|
||||
banned Boolean @default(false)
|
||||
bannedAt DateTime? @map("banned_at")
|
||||
banReason String? @map("ban_reason")
|
||||
role UserRole @default(user)
|
||||
|
||||
comments Comment[]
|
||||
polls Poll[]
|
||||
watcher Watcher[]
|
||||
accounts Account[]
|
||||
participants Participant[]
|
||||
paymentMethods PaymentMethod[]
|
||||
subscription Subscription? @relation("UserToSubscription")
|
||||
|
||||
spaces Space[] @relation("UserSpaces")
|
||||
|
||||
comments Comment[]
|
||||
polls Poll[]
|
||||
watcher Watcher[]
|
||||
accounts Account[]
|
||||
participants Participant[]
|
||||
paymentMethods PaymentMethod[]
|
||||
subscription Subscription? @relation("UserToSubscription")
|
||||
pollViews PollView[]
|
||||
scheduledEvents ScheduledEvent[]
|
||||
scheduledEventInvites ScheduledEventInvite[]
|
||||
|
@ -64,6 +67,21 @@ model User {
|
|||
@@map("users")
|
||||
}
|
||||
|
||||
model Space {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
ownerId String @map("owner_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
owner User @relation("UserSpaces", fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
polls Poll[]
|
||||
scheduledEvents ScheduledEvent[]
|
||||
subscription Subscription? @relation("SpaceToSubscription")
|
||||
|
||||
@@map("spaces")
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String @db.Citext
|
||||
token String @unique
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue