v1.2.0: Symbol-Verwaltung, SOMA-Admin, Light Mode Farbsystem, Onboarding-Tour, Credit-Link

This commit is contained in:
Pepe Ziberi
2026-02-24 21:13:27 +01:00
parent d893373bd9
commit 1583ef2a17
12 changed files with 700 additions and 128 deletions

View File

@@ -214,6 +214,23 @@ async function migrate() {
console.log(' Privacy consent columns skipped:', e.message)
}
// ─── Step 12: Create tenant_symbols table ───
console.log(' [12] Creating tenant_symbols table...')
try {
await prisma.$executeRawUnsafe(`
CREATE TABLE IF NOT EXISTS tenant_symbols (
id TEXT PRIMARY KEY DEFAULT gen_random_uuid(),
"isActive" BOOLEAN NOT NULL DEFAULT true,
"tenantId" TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
"iconId" TEXT NOT NULL REFERENCES icon_assets(id) ON DELETE CASCADE,
UNIQUE("tenantId", "iconId")
)
`)
console.log(' tenant_symbols table created (or already exists)')
} catch (e) {
console.log(' tenant_symbols table skipped:', e.message)
}
console.log('✅ Database migrations complete')
}

View File

@@ -89,6 +89,7 @@ model Tenant {
checkTemplates JournalCheckTemplate[]
iconCategories IconCategory[]
iconAssets IconAsset[]
tenantSymbols TenantSymbol[]
upgradeRequests UpgradeRequest[]
dictionaryEntries DictionaryEntry[]
rapports Rapport[]
@@ -236,6 +237,8 @@ model IconAsset {
tenantId String?
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: SetNull)
tenantSymbols TenantSymbol[]
@@map("icon_assets")
}
@@ -375,6 +378,22 @@ model UpgradeRequest {
@@map("upgrade_requests")
}
// ─── Tenant Symbol Visibility ─────────────────────────────
model TenantSymbol {
id String @id @default(uuid())
isActive Boolean @default(true)
tenantId String
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
iconId String
icon IconAsset @relation(fields: [iconId], references: [id], onDelete: Cascade)
@@unique([tenantId, iconId])
@@map("tenant_symbols")
}
// ─── Dictionary (Global + Tenant word library) ────────────
model DictionaryEntry {

View File

@@ -252,32 +252,8 @@ async function main() {
console.log('✅ Hose types created:', hoseTypes.length)
// ─── Journal Check Templates (SOMA) ─────────────────────
const somaTemplates = [
{ label: 'Stopp Zutritt / Ex-Gefahr', sortOrder: 1 },
{ label: 'Alarmierung Gesamt-Fw', sortOrder: 2 },
{ label: 'Alarmierung Ofw Wohlen', sortOrder: 3 },
{ label: 'Alarmierung Stp Baden', sortOrder: 4 },
{ label: 'Alarmierung Ambulanz', sortOrder: 5 },
{ label: 'Alarmierung BWL', sortOrder: 6 },
{ label: 'Alarmierung BL/Meister', sortOrder: 7 },
{ label: 'Brunnenchef Villmergen', sortOrder: 8 },
{ label: 'Berieselung Tank / Anl', sortOrder: 9 },
{ label: 'Druckerhöhung', sortOrder: 10 },
]
for (const tpl of somaTemplates) {
await prisma.journalCheckTemplate.upsert({
where: { id: tpl.label.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase() },
update: { label: tpl.label, sortOrder: tpl.sortOrder },
create: {
id: tpl.label.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase(),
label: tpl.label,
sortOrder: tpl.sortOrder,
},
})
}
console.log('✅ SOMA templates created:', somaTemplates.length)
// No default SOMA templates — each tenant defines their own via Admin → SOMA tab
console.log(' SOMA templates: keine Standard-Vorgaben (Tenants konfigurieren eigene)')
console.log('🎉 Seed completed successfully!')
}