feat(admin): consentement aux annonces et désabonnement sans connexion
Les comptes déjà créés ne sont pas inscrits. Le choix est facultatif à l’inscription et dans les paramètres. Un lien public demande confirmation avant d’arrêter les actualités, sans toucher aux messages de compte.
This commit is contained in:
@@ -54,6 +54,8 @@ model User {
|
||||
usageLogs UsageLog[]
|
||||
apiKeys UserAPIKey[]
|
||||
aiConsentLogs AiConsentLog[]
|
||||
marketingPreference MarketingPreference?
|
||||
emailSuppressions EmailSuppression[]
|
||||
noteClusters NoteCluster[]
|
||||
bridgeNotes BridgeNote[]
|
||||
bridgeSuggestions BridgeSuggestion[]
|
||||
@@ -1124,3 +1126,55 @@ model ErrorLog {
|
||||
@@index([createdAt])
|
||||
@@index([resolved])
|
||||
}
|
||||
|
||||
/// Explicit marketing announcements opt-in. Missing row = not opted in.
|
||||
model MarketingPreference {
|
||||
id String @id @default(cuid())
|
||||
userId String @unique
|
||||
emailNormalized String
|
||||
optedIn Boolean @default(false)
|
||||
preferredLanguage String?
|
||||
consentVersion String?
|
||||
consentText String? @db.Text
|
||||
source String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
events MarketingPreferenceEvent[]
|
||||
|
||||
@@index([emailNormalized])
|
||||
@@index([optedIn])
|
||||
}
|
||||
|
||||
model MarketingPreferenceEvent {
|
||||
id String @id @default(cuid())
|
||||
preferenceId String
|
||||
userId String?
|
||||
emailNormalized String
|
||||
optedIn Boolean
|
||||
source String
|
||||
consentVersion String?
|
||||
consentText String? @db.Text
|
||||
ip String?
|
||||
userAgent String?
|
||||
createdAt DateTime @default(now())
|
||||
preference MarketingPreference @relation(fields: [preferenceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([preferenceId])
|
||||
@@index([userId, createdAt])
|
||||
@@index([emailNormalized, createdAt])
|
||||
}
|
||||
|
||||
/// Blocks campaign mail. Kept after account deletion (userId set null).
|
||||
model EmailSuppression {
|
||||
id String @id @default(cuid())
|
||||
emailNormalized String @unique
|
||||
reason String
|
||||
source String
|
||||
userId String?
|
||||
createdAt DateTime @default(now())
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([reason])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user