[darmasaba-dashboard][2026-03-27] feat: modular seeders and database-backed dashboard
- Split seeders into modular files per feature category - Added seed:auth, seed:demographics, seed:divisions, seed:services, seed:dashboard commands - Connected dashboard components to live database (Budget, SDGs, Satisfaction) - Added API endpoints: /api/dashboard/budget, /api/dashboard/sdgs, /api/dashboard/satisfaction - Updated prisma schema with dashboard metrics models - Added loading states to dashboard components - Fixed header navigation to /admin Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -31,7 +31,6 @@ model User {
|
||||
innovationIdeas InnovationIdea[] @relation("IdeaReviewer")
|
||||
healthRecords HealthRecord[]
|
||||
populationDynamics PopulationDynamic[]
|
||||
budgets Budget[]
|
||||
budgetTransactions BudgetTransaction[]
|
||||
posyandus Posyandu[]
|
||||
securityReports SecurityReport[]
|
||||
@@ -315,6 +314,46 @@ model Banjar {
|
||||
@@map("banjar")
|
||||
}
|
||||
|
||||
// --- KATEGORI 4: KEUANGAN & ANGGARAN ---
|
||||
|
||||
model Budget {
|
||||
id String @id @default(cuid())
|
||||
category String // "Belanja", "Pangan", "Pembiayaan", "Pendapatan"
|
||||
amount Float @default(0)
|
||||
percentage Float @default(0)
|
||||
color String @default("#3B82F6")
|
||||
fiscalYear Int @default(2025)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([category, fiscalYear])
|
||||
@@map("budget")
|
||||
}
|
||||
|
||||
// --- KATEGORI 5: METRIK DASHBOARD & SDGS ---
|
||||
|
||||
model SdgsScore {
|
||||
id String @id @default(cuid())
|
||||
title String @unique
|
||||
score Float @default(0)
|
||||
image String? // filename in public folder
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("sdgs_score")
|
||||
}
|
||||
|
||||
model SatisfactionRating {
|
||||
id String @id @default(cuid())
|
||||
category String @unique // "Sangat Puas", "Puas", "Cukup", "Kurang"
|
||||
value Int @default(0)
|
||||
color String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("satisfaction_rating")
|
||||
}
|
||||
|
||||
// --- STUBS FOR PHASE 2+ (To maintain relations) ---
|
||||
|
||||
model HealthRecord {
|
||||
@@ -337,12 +376,6 @@ model PopulationDynamic {
|
||||
documentor User @relation(fields: [documentedBy], references: [id])
|
||||
}
|
||||
|
||||
model Budget {
|
||||
id String @id @default(cuid())
|
||||
approvedBy String?
|
||||
approver User? @relation(fields: [approvedBy], references: [id])
|
||||
}
|
||||
|
||||
model BudgetTransaction {
|
||||
id String @id @default(cuid())
|
||||
createdBy String
|
||||
|
||||
Reference in New Issue
Block a user