mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
feat(db): add Codex OAuth tokens and admin AI settings, remove openaiKeyEncrypted
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e71162e5f2
commit
3982cfa082
3 files changed
+27
-2
No files matched your search
@@ -0,0 +1,13 @@
|
||||
-- AlterTable: Remove openai_key_encrypted, add Codex OAuth fields to users
|
||||
ALTER TABLE "users" DROP COLUMN "openai_key_encrypted";
|
||||
|
||||
ALTER TABLE "users" ADD COLUMN "codex_access_token_encrypted" TEXT;
|
||||
ALTER TABLE "users" ADD COLUMN "codex_refresh_token_encrypted" TEXT;
|
||||
ALTER TABLE "users" ADD COLUMN "codex_token_expires_at" TIMESTAMP(3);
|
||||
ALTER TABLE "users" ADD COLUMN "codex_connected_at" TIMESTAMP(3);
|
||||
ALTER TABLE "users" ADD COLUMN "codex_connection_status" TEXT NOT NULL DEFAULT 'disconnected';
|
||||
|
||||
-- AlterTable: Add admin AI provider fields to app_settings
|
||||
ALTER TABLE "app_settings" ADD COLUMN "admin_ai_key_encrypted" TEXT;
|
||||
ALTER TABLE "app_settings" ADD COLUMN "admin_ai_model" TEXT NOT NULL DEFAULT 'gpt-4o-mini';
|
||||
ALTER TABLE "app_settings" ADD COLUMN "admin_ai_base_url" TEXT NOT NULL DEFAULT 'https://api.openai.com/v1';
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
+11
-2
@@ -24,8 +24,12 @@ model User {
|
||||
gender String? @map("gender") // "MALE" | "FEMALE" | null = keine Angabe
|
||||
timezone String @default("Europe/Berlin")
|
||||
|
||||
// OpenAI Insights (optional)
|
||||
openaiKeyEncrypted String? @map("openai_key_encrypted") // AES-256-GCM encrypted
|
||||
// Codex OAuth (ChatGPT subscription)
|
||||
codexAccessTokenEncrypted String? @map("codex_access_token_encrypted")
|
||||
codexRefreshTokenEncrypted String? @map("codex_refresh_token_encrypted")
|
||||
codexTokenExpiresAt DateTime? @map("codex_token_expires_at")
|
||||
codexConnectedAt DateTime? @map("codex_connected_at")
|
||||
codexConnectionStatus String @default("disconnected") @map("codex_connection_status")
|
||||
insightsPrivacyMode String @default("aggregated") @map("insights_privacy_mode") // "aggregated" | "raw"
|
||||
insightsCachedAt DateTime? @map("insights_cached_at")
|
||||
insightsCachedText String? @map("insights_cached_text") // cached JSON output
|
||||
@@ -374,6 +378,11 @@ model AppSettings {
|
||||
reminderLateMinutes Int @default(120) @map("reminder_late_minutes")
|
||||
reminderMissedMinutes Int @default(240) @map("reminder_missed_minutes")
|
||||
|
||||
// Admin AI Provider (fallback for users without Codex OAuth)
|
||||
adminAiKeyEncrypted String? @map("admin_ai_key_encrypted")
|
||||
adminAiModel String @default("gpt-4o-mini") @map("admin_ai_model")
|
||||
adminAiBaseUrl String @default("https://api.openai.com/v1") @map("admin_ai_base_url")
|
||||
|
||||
@@map("app_settings")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user