Fix tombolreplay, posisi tombol, posisi icon music. Fix create & edit apbdes upload image dan file optional

This commit is contained in:
2026-03-05 16:36:12 +08:00
parent 8b8c65dd1e
commit 63161e1a39

View File

@@ -1,6 +1,7 @@
import prisma from "@/lib/prisma"; import prisma from "@/lib/prisma";
import { Context } from "elysia"; import { Context } from "elysia";
import { assignParentIdsToApbdesItems } from "./lib/getParentsID"; import { assignParentIdsToApbdesItems } from "./lib/getParentsID";
import { RealisasiItem } from "@prisma/client";
type APBDesItemInput = { type APBDesItemInput = {
kode: string; kode: string;
@@ -51,7 +52,7 @@ export default async function apbdesUpdate(context: Context) {
// 2. Build map untuk preserve realisasiItems berdasarkan kode // 2. Build map untuk preserve realisasiItems berdasarkan kode
const existingItemsMap = new Map<string, { const existingItemsMap = new Map<string, {
id: string; id: string;
realisasiItems: any[]; realisasiItems: RealisasiItem[];
}>(); }>();
existing.items.forEach(item => { existing.items.forEach(item => {
@@ -128,7 +129,7 @@ export default async function apbdesUpdate(context: Context) {
} }
// 8. Recalculate totalRealisasi setelah re-create realisasiItems // 8. Recalculate totalRealisasi setelah re-create realisasiItems
for (const [kode, _] of existingItemsMap.entries()) { for (const kode of existingItemsMap.keys()) {
const newItemId = newItemIdsMap.get(kode); const newItemId = newItemIdsMap.get(kode);
if (newItemId) { if (newItemId) {
const realisasiItems = await prisma.realisasiItem.findMany({ const realisasiItems = await prisma.realisasiItem.findMany({
@@ -168,8 +169,8 @@ export default async function apbdesUpdate(context: Context) {
name: body.name || `APBDes Tahun ${body.tahun}`, name: body.name || `APBDes Tahun ${body.tahun}`,
deskripsi: body.deskripsi, deskripsi: body.deskripsi,
jumlah: body.jumlah, jumlah: body.jumlah,
imageId: body.imageId, imageId: body.imageId === '' ? null : body.imageId,
fileId: body.fileId, fileId: body.fileId === '' ? null : body.fileId,
}, },
}); });