feat(kesehatan): refactor ringkasan kesehatan to auto-derived stats
- Add IbuHamil and Balita models to schema.prisma - Implement IbuHamil and Balita API modules (CRUD) - Implement /stats endpoint for aggregated health KPIs - Refactor ringkasan-kesehatan admin page to dashboard-style UI - Update sidebar with Ibu Hamil and Balita entries - Fix type errors and icon exports in admin UI - Bump version to 0.1.52
This commit is contained in:
22
src/app/api/[[...slugs]]/_lib/kesehatan/ibu-hamil/del.ts
Normal file
22
src/app/api/[[...slugs]]/_lib/kesehatan/ibu-hamil/del.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
export default async function ibuHamilDelete(context: Context) {
|
||||
const id = context.params?.id as string;
|
||||
|
||||
if (!id) {
|
||||
return { success: false, message: "ID tidak diberikan" };
|
||||
}
|
||||
|
||||
const existing = await prisma.ibuHamil.findUnique({ where: { id } });
|
||||
if (!existing) {
|
||||
return new Response(JSON.stringify({ success: false, message: "Data tidak ditemukan" }), {
|
||||
status: 404,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
await prisma.ibuHamil.update({ where: { id }, data: { isActive: false } });
|
||||
|
||||
return { success: true, message: "Ibu hamil berhasil dihapus" };
|
||||
}
|
||||
Reference in New Issue
Block a user