From 63161e1a39347630a86e0d0c8144a2e53f80b41f Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 5 Mar 2026 16:36:12 +0800 Subject: [PATCH] Fix tombolreplay, posisi tombol, posisi icon music. Fix create & edit apbdes upload image dan file optional --- .../[[...slugs]]/_lib/landing_page/apbdes/updt.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/api/[[...slugs]]/_lib/landing_page/apbdes/updt.ts b/src/app/api/[[...slugs]]/_lib/landing_page/apbdes/updt.ts index 4951764f..424ece54 100644 --- a/src/app/api/[[...slugs]]/_lib/landing_page/apbdes/updt.ts +++ b/src/app/api/[[...slugs]]/_lib/landing_page/apbdes/updt.ts @@ -1,6 +1,7 @@ import prisma from "@/lib/prisma"; import { Context } from "elysia"; import { assignParentIdsToApbdesItems } from "./lib/getParentsID"; +import { RealisasiItem } from "@prisma/client"; type APBDesItemInput = { kode: string; @@ -49,9 +50,9 @@ export default async function apbdesUpdate(context: Context) { } // 2. Build map untuk preserve realisasiItems berdasarkan kode - const existingItemsMap = new Map(); existing.items.forEach(item => { @@ -128,7 +129,7 @@ export default async function apbdesUpdate(context: Context) { } // 8. Recalculate totalRealisasi setelah re-create realisasiItems - for (const [kode, _] of existingItemsMap.entries()) { + for (const kode of existingItemsMap.keys()) { const newItemId = newItemIdsMap.get(kode); if (newItemId) { const realisasiItems = await prisma.realisasiItem.findMany({ @@ -168,8 +169,8 @@ export default async function apbdesUpdate(context: Context) { name: body.name || `APBDes Tahun ${body.tahun}`, deskripsi: body.deskripsi, jumlah: body.jumlah, - imageId: body.imageId, - fileId: body.fileId, + imageId: body.imageId === '' ? null : body.imageId, + fileId: body.fileId === '' ? null : body.fileId, }, });