Fix Edit di Admin APbdes, dan fix data real di apbdes user

This commit is contained in:
2025-11-18 16:26:09 +08:00
parent 6c32f3ebdb
commit 2608a5ffdd
7 changed files with 56 additions and 163 deletions

View File

@@ -12,7 +12,7 @@ type APBDesItemInput = {
selisih: number;
persentase: number;
level: number;
tipe: string;
tipe?: string | null;
};
type FormCreate = {

View File

@@ -15,7 +15,7 @@ const ApbdesItemSchema = t.Object({
selisih: t.Number(),
persentase: t.Number(),
level: t.Number(),
tipe: t.String(), // misal: "pendapatan" atau "belanja"
tipe: t.Optional(t.Union([t.String(), t.Null()])) // misal: "pendapatan" atau "belanja"
});
const APBDes = new Elysia({

View File

@@ -10,7 +10,7 @@ type APBDesItemInput = {
selisih: number;
persentase: number;
level: number;
tipe: string;
tipe?: string | null;
};
type FormUpdateBody = {
@@ -54,7 +54,7 @@ export default async function apbdesUpdate(context: Context) {
selisih: item.anggaran - item.realisasi,
persentase: item.anggaran > 0 ? (item.realisasi / item.anggaran) * 100 : 0,
level: item.level,
tipe: item.tipe,
tipe: item.tipe || null,
isActive: true,
})),
});