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:
@@ -6,10 +6,15 @@ export default async function dataBanjarFindMany(context: Context) {
|
||||
const page = Number(context.query.page) || 1;
|
||||
const limit = Number(context.query.limit) || 100;
|
||||
const search = (context.query.search as string) || '';
|
||||
const tahun = Number(context.query.tahun) || new Date().getFullYear();
|
||||
const tahun = context.query.tahun ? Number(context.query.tahun) : undefined;
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
const where: any = { isActive: true, tahun };
|
||||
const where: any = { isActive: true };
|
||||
|
||||
// Filter by tahun hanya jika dikirim
|
||||
if (tahun) {
|
||||
where.tahun = tahun;
|
||||
}
|
||||
|
||||
if (search) {
|
||||
where.OR = [
|
||||
|
||||
@@ -6,10 +6,15 @@ export default async function distribusiAgamaFindMany(context: Context) {
|
||||
const page = Number(context.query.page) || 1;
|
||||
const limit = Number(context.query.limit) || 100;
|
||||
const search = (context.query.search as string) || '';
|
||||
const tahun = Number(context.query.tahun) || new Date().getFullYear();
|
||||
const tahun = context.query.tahun ? Number(context.query.tahun) : undefined;
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
const where: any = { isActive: true, tahun };
|
||||
const where: any = { isActive: true };
|
||||
|
||||
// Filter by tahun hanya jika dikirim
|
||||
if (tahun) {
|
||||
where.tahun = tahun;
|
||||
}
|
||||
|
||||
// Tambahkan pencarian (jika ada)
|
||||
if (search) {
|
||||
|
||||
@@ -5,10 +5,15 @@ import { Context } from "elysia";
|
||||
export default async function distribusiUmurFindMany(context: Context) {
|
||||
const page = Number(context.query.page) || 1;
|
||||
const limit = Number(context.query.limit) || 100;
|
||||
const tahun = Number(context.query.tahun) || new Date().getFullYear();
|
||||
const tahun = context.query.tahun ? Number(context.query.tahun) : undefined;
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
const where: any = { isActive: true, tahun };
|
||||
const where: any = { isActive: true };
|
||||
|
||||
// Filter by tahun hanya jika dikirim
|
||||
if (tahun) {
|
||||
where.tahun = tahun;
|
||||
}
|
||||
|
||||
try {
|
||||
const [data, total] = await Promise.all([
|
||||
|
||||
@@ -7,7 +7,7 @@ export default async function migrasiPendudukFindMany(context: Context) {
|
||||
const limit = Number(context.query.limit) || 10;
|
||||
const search = (context.query.search as string) || '';
|
||||
const jenis = (context.query.jenis as string) || '';
|
||||
const tahun = Number(context.query.tahun) || new Date().getFullYear();
|
||||
const tahun = context.query.tahun ? Number(context.query.tahun) : undefined;
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
const where: any = { isActive: true };
|
||||
@@ -16,6 +16,7 @@ export default async function migrasiPendudukFindMany(context: Context) {
|
||||
where.jenis = jenis;
|
||||
}
|
||||
|
||||
// Filter by tahun hanya jika dikirim
|
||||
if (tahun) {
|
||||
where.tanggal = {
|
||||
gte: new Date(`${tahun}-01-01`),
|
||||
|
||||
@@ -23,6 +23,7 @@ import Inovasi from "./_lib/inovasi";
|
||||
import Lingkungan from "./_lib/lingkungan";
|
||||
import LandingPage from "./_lib/landing_page";
|
||||
import Pendidikan from "./_lib/pendidikan";
|
||||
import Kependudukan from "./_lib/kependudukan";
|
||||
import User from "./_lib/user";
|
||||
import Role from "./_lib/user/role";
|
||||
import Search from "./_lib/search";
|
||||
@@ -119,6 +120,7 @@ const ApiServer = new Elysia({ prefix: "/api" })
|
||||
.use(Inovasi)
|
||||
.use(Lingkungan)
|
||||
.use(Pendidikan)
|
||||
.use(Kependudukan)
|
||||
.use(User)
|
||||
.use(Role)
|
||||
.use(Search)
|
||||
|
||||
Reference in New Issue
Block a user