- Add Prisma models: DataBanjar, DistribusiAgama, DistribusiUmur, MigrasiPenduduk, DinamikaPenduduk - Create seeders for all kependudukan models with year 2026 data - Register Kependudukan API routes in route.ts - Update API findMany endpoints to make tahun parameter optional - Add YearFilter reusable component for admin pages - Update 4 kependudukan admin pages with year filter UI - Fix Mantine color array in AdminThemeProvider (add 10th element) - Fix invalid Mantine color scale in paguTable.tsx (gray.50 -> gray.1) - Add Kependudukan menu to navbar-list-menu.ts - Fix Bun JSON import resolution with loadJsonData helper - Update 74 seeder files to use dynamic JSON loading Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
14 lines
496 B
TypeScript
14 lines
496 B
TypeScript
import { readFileSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
/**
|
|
* Load JSON file dynamically from prisma/data directory
|
|
* @param relativePath - Relative path from prisma/data (e.g., 'pendidikan/beasiswa-pendaftar/beasiswa-pendaftar.json')
|
|
* @returns Parsed JSON data
|
|
*/
|
|
export function loadJsonData<T = any>(relativePath: string): T {
|
|
const fullPath = join(process.cwd(), "prisma/data", relativePath);
|
|
const content = readFileSync(fullPath, "utf-8");
|
|
return JSON.parse(content);
|
|
}
|