UI & API Admin Kesehatan Done

This commit is contained in:
2025-06-20 08:11:31 +08:00
parent 4a5524ce88
commit fc08b2e790
19 changed files with 1209 additions and 423 deletions

View File

@@ -30,6 +30,9 @@ const infoWabahPenyakitDelete = async (context: Context) => {
try {
const filePath = path.join(infoWabahPenyakit.image.path, infoWabahPenyakit.image.name);
await fs.unlink(filePath);
await prisma.fileStorage.delete({
where: { id: infoWabahPenyakit.image.id },
});
} catch (err) {
console.error("Gagal hapus gambar:", err);
}
@@ -41,7 +44,8 @@ const infoWabahPenyakitDelete = async (context: Context) => {
return {
status: 200,
body: "Info wabah penyakit berhasil dihapus",
success: true,
message: "Penanganan darurat dan file terkait berhasil dihapus",
};
};
export default infoWabahPenyakitDelete;

View File

@@ -30,6 +30,9 @@ const kontakDaruratDelete = async (context: Context) => {
try {
const filePath = path.join(kontakDarurat.image.path, kontakDarurat.image.name);
await fs.unlink(filePath);
await prisma.fileStorage.delete({
where: { id: kontakDarurat.image.id },
});
} catch (error) {
console.error("Error deleting image file:", error);
}
@@ -41,7 +44,8 @@ const kontakDaruratDelete = async (context: Context) => {
return {
status: 200,
body: "Kontak darurat berhasil dihapus",
success: true,
message: "Kontak darurat dan file terkait berhasil dihapus",
};
};
export default kontakDaruratDelete;

View File

@@ -12,7 +12,6 @@ const KontakDarurat = new Elysia({
.post("/create", kontakDaruratCreate, {
body: t.Object({
name: t.String(),
nomor: t.String(),
deskripsi: t.String(),
imageId: t.String(),
})
@@ -32,7 +31,6 @@ const KontakDarurat = new Elysia({
{
body: t.Object({
name: t.String(),
nomor: t.String(),
deskripsi: t.String(),
imageId: t.String(),
})