UI & API Admin Kesehatan Done
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user