feat: add kependudukan seeders, API routes, year filter, and navbar menu

- 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>
This commit is contained in:
2026-04-10 11:54:36 +08:00
parent 5e822f0b05
commit 8b14c6ce44
146 changed files with 3051 additions and 201 deletions

View File

@@ -1,6 +1,8 @@
import prisma from "@/lib/prisma";
import kategoriBerita from "../../../data/desa/berita/kategori-berita.json";
import beritaJson from "../../../data/desa/berita/berita.json";
import { loadJsonData } from "../../../load-json";
const kategoriBerita = loadJsonData("desa/berita/kategori-berita.json");
const beritaJson = loadJsonData("desa/berita/berita.json");
export async function seedBerita() {
// ================== SUBMENU BERITA ========================

View File

@@ -1,5 +1,7 @@
import prisma from "@/lib/prisma";
import foto from "../../../../data/desa/gallery/foto/foto.json";
import { loadJsonData } from "../../../../load-json";
const foto = loadJsonData("desa/gallery/foto/foto.json");
export async function seedFoto() {
console.log("🔄 Seeding Foto...");

View File

@@ -1,5 +1,7 @@
import prisma from "@/lib/prisma";
import galleryVideo from "../../../../data/desa/gallery/video/video.json";
import { loadJsonData } from "../../../../load-json";
const galleryVideo = loadJsonData("desa/gallery/video/video.json");
export async function seedVideo() {
console.log("🔄 Seeding Gallery Video...");

View File

@@ -1,8 +1,10 @@
import prisma from "@/lib/prisma";
import pelayananSuratKeterangan from "../../../data/desa/layanan/pelayananSuratKeterangan.json";
import pelayananTelunjukSaktiDesa from "../../../data/desa/layanan/pelayananTelunjukSaktiDesa.json";
import pelayananPerizinanBerusaha from "../../../data/desa/layanan/pelayananPerizinanBerusaha.json";
import pelayananPendudukNonPermanen from "../../../data/desa/layanan/pelayananPendudukNonPermanen.json";
import { loadJsonData } from "../../../load-json";
const pelayananSuratKeterangan = loadJsonData("desa/layanan/pelayananSuratKeterangan.json");
const pelayananTelunjukSaktiDesa = loadJsonData("desa/layanan/pelayananTelunjukSaktiDesa.json");
const pelayananPerizinanBerusaha = loadJsonData("desa/layanan/pelayananPerizinanBerusaha.json");
const pelayananPendudukNonPermanen = loadJsonData("desa/layanan/pelayananPendudukNonPermanen.json");
export async function seedLayanan() {
console.log("🔄 Seeding Pelayanan Surat Keterangan...");

View File

@@ -0,0 +1,57 @@
import prisma from "@/lib/prisma";
import { loadJsonData } from "../../../load-json";
const musikJson = loadJsonData("desa/musik-desa/musik-desa.json");
export async function seedMusikDesa() {
console.log("Seeding Musik Desa...");
for (const item of musikJson) {
let audioFileId: string | null = null;
let coverImageId: string | null = null;
if (item.audioFileName) {
const audio = await prisma.fileStorage.findUnique({
where: { name: item.audioFileName },
select: { id: true },
});
if (audio) audioFileId = audio.id;
}
if (item.coverImageName) {
const cover = await prisma.fileStorage.findUnique({
where: { name: item.coverImageName },
select: { id: true },
});
if (cover) coverImageId = cover.id;
}
await prisma.musikDesa.upsert({
where: { id: item.id },
update: {
judul: item.judul,
artis: item.artis,
deskripsi: item.deskripsi,
durasi: item.durasi,
audioFileId,
coverImageId,
genre: item.genre,
tahunRilis: item.tahunRilis,
},
create: {
id: item.id,
judul: item.judul,
artis: item.artis,
deskripsi: item.deskripsi,
durasi: item.durasi,
audioFileId,
coverImageId,
genre: item.genre,
tahunRilis: item.tahunRilis,
},
});
console.log(` Musik: ${item.judul} - ${item.artis}`);
}
console.log("Musik Desa seed selesai");
}

View File

@@ -1,5 +1,7 @@
import prisma from "@/lib/prisma";
import penghargaan from "../../../data/desa/penghargaan/penghargaan.json"
import { loadJsonData } from "../../../load-json";
const penghargaan = loadJsonData("desa/penghargaan/penghargaan.json");
export async function seedPenghargaan() {
console.log("🔄 Seeding Penghargaan...");

View File

@@ -1,7 +1,9 @@
import prisma from "@/lib/prisma";
import { loadJsonData } from "../../../load-json";
import { safeSeedUnique } from "../../../safeseedUnique";
import kategoriPengumuman from "../../../data/desa/pengumuman/kategori-pengumuman.json";
import pengumuman from "../../../data/desa/pengumuman/pengumuman.json";
const kategoriPengumuman = loadJsonData("desa/pengumuman/kategori-pengumuman.json");
const pengumuman = loadJsonData("desa/pengumuman/pengumuman.json");
export async function seedPengumuman() {
console.log("🔄 Seeding Kategori Pengumuman...");

View File

@@ -1,6 +1,8 @@
import prisma from "@/lib/prisma";
import kategoriPotensi from "../../../data/desa/potensi/kategori-potensi.json";
import potensiDesa from "../../../data/desa/potensi/potensi-desa.json";
import { loadJsonData } from "../../../load-json";
const kategoriPotensi = loadJsonData("desa/potensi/kategori-potensi.json");
const potensiDesa = loadJsonData("desa/potensi/potensi-desa.json");
export async function seedPotensi() {
console.log("🔄Seeding Kategori Potensi Desa ...");

View File

@@ -1,10 +1,12 @@
import prisma from "@/lib/prisma";
import lambangDesa from "../../../data/desa/profile/lambang_desa.json";
import maskotDesa from "../../../data/desa/profile/maskot_desa.json";
import profilePerbekel from "../../../data/desa/profile/profil_perbekel.json";
import profileDesaImage from "../../../data/desa/profile/profileDesaImage.json";
import sejarahDesa from "../../../data/desa/profile/sejarah_desa.json";
import visiMisiDesa from "../../../data/desa/profile/visi_misi_desa.json";
import { loadJsonData } from "../../../load-json";
const lambangDesa = loadJsonData("desa/profile/lambang_desa.json");
const maskotDesa = loadJsonData("desa/profile/maskot_desa.json");
const profilePerbekel = loadJsonData("desa/profile/profil_perbekel.json");
const profileDesaImage = loadJsonData("desa/profile/profileDesaImage.json");
const sejarahDesa = loadJsonData("desa/profile/sejarah_desa.json");
const visiMisiDesa = loadJsonData("desa/profile/visi_misi_desa.json");
export async function seedProfileDesa() {
// =========== SEJARAH DESA ===========

View File

@@ -1,5 +1,7 @@
import prisma from "@/lib/prisma";
import perbekelDariMasaKeMasa from "../../../data/desa/profile/profile-perbekel-lalu.json";
import { loadJsonData } from "../../../load-json";
const perbekelDariMasaKeMasa = loadJsonData("desa/profile/profile-perbekel-lalu.json");
export async function seedProfilePerbekel() {
console.log("🔄 Seeding Perbekel Dari Masa Ke Masa...");