feat: merge url_api & api_key to App, add application settings page

This commit is contained in:
2026-04-30 11:28:25 +08:00
parent e2ad6f9313
commit 4e9d5964ae
7 changed files with 274 additions and 169 deletions

View File

@@ -0,0 +1,15 @@
-- AlterTable: tambah urlApi dan apiKey ke App
ALTER TABLE "App" ADD COLUMN "urlApi" TEXT;
ALTER TABLE "App" ADD COLUMN "apiKey" TEXT;
-- DataMigration: pindahkan nilai dari app_config ke App sebelum drop
UPDATE "App"
SET "urlApi" = (SELECT value FROM app_config WHERE key = 'URL_API_DESA_PLUS')
WHERE id = 'desa-plus';
UPDATE "App"
SET "apiKey" = (SELECT value FROM app_config WHERE key = 'API_KEY_DESA_PLUS')
WHERE id = 'desa-plus';
-- DropTable
DROP TABLE "app_config";

View File

@@ -0,0 +1 @@
ALTER TABLE "App" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true;

View File

@@ -72,16 +72,18 @@ model Session {
}
model App {
id String @id @default(uuid())
name String
version String?
minVersion String?
maintenance Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(uuid())
name String
version String?
minVersion String?
maintenance Boolean @default(false)
active Boolean @default(true)
urlApi String?
apiKey String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
bugs Bug[]
}
model Log {
@@ -146,14 +148,6 @@ model BugLog {
@@map("bug_log")
}
model AppConfig {
key String @id
value String
updatedAt DateTime @updatedAt
@@map("app_config")
}