feat(backend): add magicCooldownUntil to UserDevice

This commit is contained in:
chahinebrini 2026-06-16 20:13:23 +02:00
parent 1a270739bc
commit b9bd577e47
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,2 @@
-- Add magicCooldownUntil for temporary sleep mode on Magic desktop devices
ALTER TABLE "rebreak"."user_devices" ADD COLUMN "magic_cooldown_until" TIMESTAMP(3);

View File

@ -1105,6 +1105,8 @@ model UserDevice {
/// Wann der User die Entfernung des Magic-Profils beantragt hat.
/// Removal-Passwort wird erst nach +MAGIC_RELEASE_COOLDOWN_H sichtbar.
magicReleaseRequestedAt DateTime? @map("magic_release_requested_at")
/// Temporärer Sleep-Mode für Magic-Desktop-Geräte. NULL = kein Cooldown aktiv.
magicCooldownUntil DateTime? @map("magic_cooldown_until")
@@unique([userId, deviceId])
@@index([userId])
@ -1295,3 +1297,28 @@ model OauthPendingState {
@@map("oauth_pending_states")
@@schema("rebreak")
}
/// Client error / crash reports submitted by users or captured automatically.
/// Intentionally minimal PII: no emails, passwords, tokens, or message content.
/// Used for debugging during test phases and high-traffic rollouts.
model ErrorReport {
id String @id @default(uuid()) @db.Uuid
source String /// "native" | "magic" | "web" | "manual" | "auto"
severity String /// "error" | "crash" | "warning" | "info"
title String
message String
stack String?
context Json? /// free-form structured context (screen, device info, etc.)
deviceInfo Json? @map("device_info") /// platform, osVersion, appVersion, model
profileId String? @map("profile_id") @db.Uuid
/// Original client timestamp if provided, otherwise server time.
reportedAt DateTime @map("reported_at")
createdAt DateTime @default(now()) @map("created_at")
@@index([source])
@@index([severity])
@@index([createdAt])
@@index([profileId])
@@map("error_reports")
@@schema("rebreak")
}