- Add persentase field to ProgramKesehatan (for health stats bar chart) - Add BeasiswaConfig model (dana tersalurkan + tahun ajaran) - Add RingkasanKesehatanDesa model (ibu hamil, balita, alert stunting) - Add KegiatanDesa CRUD API (GET /api/desa/kegiatandesa/find-many?kategori=Budaya) - Add BeasiswaConfig API (GET/PUT /api/pendidikan/beasiswa/beasiswaconfig/...) - Add RingkasanKesehatan API (GET/PUT /api/kesehatan/ringkasankesehatan/...) - Migration: 20260430000000_add_sosial_fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
import prisma from "@/lib/prisma";
|
|
import { Context } from "elysia";
|
|
|
|
async function kegiatanDesaUpdate(context: Context) {
|
|
const { id } = context.params as { id: string };
|
|
const body = context.body as any;
|
|
|
|
try {
|
|
const data = await prisma.kegiatanDesa.update({
|
|
where: { id },
|
|
data: {
|
|
judul: body.judul,
|
|
deskripsiSingkat: body.deskripsiSingkat,
|
|
deskripsiLengkap: body.deskripsiLengkap,
|
|
tanggal: new Date(body.tanggal),
|
|
lokasi: body.lokasi,
|
|
partisipan: Number(body.partisipan) || 0,
|
|
kategoriKegiatanId: body.kategoriKegiatanId,
|
|
imageId: body.imageId || null,
|
|
},
|
|
include: { kategoriKegiatan: true, image: true },
|
|
});
|
|
|
|
return { success: true, message: "Kegiatan desa berhasil diupdate", data };
|
|
} catch (e) {
|
|
console.error("Error di kegiatanDesaUpdate:", e);
|
|
return { success: false, message: "Gagal mengupdate kegiatan desa" };
|
|
}
|
|
}
|
|
|
|
export default kegiatanDesaUpdate;
|