This commit is contained in:
Timo Knuth
2026-02-27 15:19:24 +01:00
parent b7f8221095
commit 253c3c1c6d
134 changed files with 11188 additions and 1871 deletions

View File

@@ -31,6 +31,9 @@ model User {
banReason String? @map("ban_reason")
banExpires DateTime? @map("ban_expires")
// Password management
mustChangePassword Boolean? @default(false) @map("must_change_password")
// App relations
sessions Session[]
accounts Account[]
@@ -95,9 +98,21 @@ model Organization {
plan String @default("pilot") // pilot | standard | pro | verband
logoUrl String? @map("logo_url")
primaryColor String @default("#E63946") @map("primary_color")
secondaryColor String? @map("secondary_color")
contactEmail String? @map("contact_email")
avvAccepted Boolean @default(false) @map("avv_accepted")
avvAcceptedAt DateTime? @map("avv_accepted_at")
landingPageTitle String? @map("landing_page_title")
landingPageText String? @map("landing_page_text")
landingPageSectionTitle String? @map("landing_page_section_title")
landingPageButtonText String? @map("landing_page_button_text")
landingPageHeroImage String? @map("landing_page_hero_image")
landingPageHeroOverlayOpacity Int? @default(50) @map("landing_page_hero_overlay_opacity")
landingPageFeatures String? @map("landing_page_features")
landingPageFooter String? @map("landing_page_footer")
appStoreUrl String? @map("app_store_url")
playStoreUrl String? @map("play_store_url")
aiEnabled Boolean @default(false) @map("ai_enabled")
createdAt DateTime @default(now()) @map("created_at")
members Member[]
@@ -136,6 +151,8 @@ model Member {
newsAuthored News[] @relation("NewsAuthor")
stellen Stelle[]
terminAnmeldungen TerminAnmeldung[]
sentMessages Message[]
conversationMembers ConversationMember[]
@@index([orgId])
@@index([status])
@@ -276,3 +293,47 @@ model TerminAnmeldung {
@@unique([terminId, memberId])
@@map("termin_anmeldungen")
}
// =============================================
// DIREKTNACHRICHTEN (Chat)
// =============================================
model Conversation {
id String @id @default(uuid())
orgId String @map("org_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
members ConversationMember[]
messages Message[]
@@index([orgId])
@@map("conversations")
}
model ConversationMember {
id String @id @default(uuid())
conversationId String @map("conversation_id")
memberId String @map("member_id")
lastReadAt DateTime? @map("last_read_at")
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
member Member @relation(fields: [memberId], references: [id], onDelete: Cascade)
@@unique([conversationId, memberId])
@@map("conversation_members")
}
model Message {
id String @id @default(uuid())
conversationId String @map("conversation_id")
senderId String @map("sender_id")
body String
createdAt DateTime @default(now()) @map("created_at")
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
sender Member @relation(fields: [senderId], references: [id], onDelete: Cascade)
@@index([conversationId])
@@map("messages")
}