feat(sosial): add schema fields + API endpoints for Sosial dashboard - bump to 0.1.45
- 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>
This commit is contained in:
32
src/app/api/[[...slugs]]/_lib/desa/kegiatan-desa/updt.ts
Normal file
32
src/app/api/[[...slugs]]/_lib/desa/kegiatan-desa/updt.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/* 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;
|
||||
Reference in New Issue
Block a user