🗃️ Store active space for user (#1807)

This commit is contained in:
Luke Vella 2025-07-11 10:35:28 +01:00 committed by GitHub
parent d93baeafd9
commit d672eb1012
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 196 additions and 94 deletions

View file

@ -10,7 +10,8 @@ model Space {
scheduledEvents ScheduledEvent[]
subscription Subscription? @relation("SpaceToSubscription")
members SpaceMember[]
members SpaceMember[]
activeForUsers User[] @relation("UserActiveSpace")
@@index([ownerId], type: Hash)
@@map("spaces")

View file

@ -49,6 +49,7 @@ model User {
bannedAt DateTime? @map("banned_at")
banReason String? @map("ban_reason")
role UserRole @default(user)
activeSpaceId String? @map("active_space_id")
comments Comment[]
polls Poll[]
@ -57,6 +58,7 @@ model User {
participants Participant[]
paymentMethods PaymentMethod[]
subscription Subscription? @relation("UserToSubscription")
activeSpace Space? @relation("UserActiveSpace", fields: [activeSpaceId], references: [id], onDelete: SetNull)
spaces Space[] @relation("UserSpaces")
memberOf SpaceMember[]