feat(schema): Account model with AccountStatus enum, optional Group.accountId
Adds Account model (platform, jid, sessionPath, displayName, status) with AccountStatus enum (ACTIVE/DISCONNECTED/BANNED) and optional accountId FK on Group for multi-account WhatsApp session tracking. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ generator client {
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
url = env("../../../DATABASE_URL")
|
||||
}
|
||||
|
||||
model Group {
|
||||
@@ -14,6 +14,8 @@ model Group {
|
||||
name String
|
||||
description String?
|
||||
isActive Boolean @default(true)
|
||||
accountId String?
|
||||
account Account? @relation(fields: [accountId], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -91,3 +93,23 @@ model ConsentRecord {
|
||||
|
||||
@@unique([groupId, memberJid, consentType])
|
||||
}
|
||||
|
||||
enum AccountStatus {
|
||||
ACTIVE
|
||||
DISCONNECTED
|
||||
BANNED
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
platform String
|
||||
jid String
|
||||
sessionPath String
|
||||
displayName String?
|
||||
status AccountStatus @default(ACTIVE)
|
||||
groups Group[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([platform, jid])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user