feat: 完成举报拉黑和审核处置闭环

This commit is contained in:
root
2026-09-16 20:41:01 +08:00
parent 02189ebb2e
commit ce8e1db279
19 changed files with 1778 additions and 5 deletions
+20
View File
@@ -13,6 +13,11 @@ enum AccountStatus {
DELETED
}
enum AccountRole {
USER
ADMIN
}
enum AuthProvider {
PHONE
APPLE
@@ -97,6 +102,7 @@ model Account {
phoneCiphertext Bytes @map("phone_ciphertext")
phoneHmac String @unique @map("phone_hmac") @db.VarChar(128)
status AccountStatus @default(ACTIVE)
role AccountRole @default(USER)
tokenVersion Int @default(0) @map("token_version")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
@@ -119,6 +125,7 @@ model Account {
auditLogs AuditLog[] @relation("AuditActor")
dailyUsage DailyUsage[]
pickRequests BottlePickRequest[]
pushPreference PushPreference?
@@map("accounts")
}
@@ -368,6 +375,7 @@ model Report {
/// Exactly one nullable target foreign key must be set; enforced in 0001_init SQL.
id String @id @default(uuid()) @db.Uuid
reporterId String @map("reporter_id") @db.Uuid
idempotencyKey String @default(uuid()) @map("idempotency_key") @db.VarChar(128)
reportedAccountId String? @map("reported_account_id") @db.Uuid
bottleId String? @map("bottle_id") @db.Uuid
conversationId String? @map("conversation_id") @db.Uuid
@@ -388,6 +396,7 @@ model Report {
@@index([status, createdAt])
@@index([reportedAccountId, createdAt])
@@unique([reporterId, idempotencyKey])
@@map("reports")
}
@@ -439,6 +448,7 @@ model Sanction {
model Notification {
id String @id @default(uuid()) @db.Uuid
accountId String @map("account_id") @db.Uuid
dedupeKey String @map("dedupe_key") @db.VarChar(255)
type String @db.VarChar(100)
payload Json
status NotificationStatus @default(PENDING)
@@ -449,9 +459,19 @@ model Notification {
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
@@index([accountId, status, createdAt])
@@unique([accountId, dedupeKey])
@@map("notifications")
}
model PushPreference {
accountId String @id @map("account_id") @db.Uuid
inAppEnabled Boolean @default(true) @map("in_app_enabled")
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
@@map("push_preferences")
}
model OutboxEvent {
/// Processing lease index outbox_events_processing_lease_idx is managed in 0007 SQL.
id String @id @default(uuid()) @db.Uuid