feat(ekonomi): implement UMKM module with CRUD API and Dashboard analytics
This commit is contained in:
31
src/app/api/[[...slugs]]/_lib/ekonomi/umkm/del.ts
Normal file
31
src/app/api/[[...slugs]]/_lib/ekonomi/umkm/del.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
async function umkmDelete(context: Context) {
|
||||
const id = context.params.id;
|
||||
|
||||
try {
|
||||
// Soft delete
|
||||
const data = await prisma.umkm.update({
|
||||
where: { id },
|
||||
data: {
|
||||
deletedAt: new Date(),
|
||||
isActive: false,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Berhasil menghapus UMKM",
|
||||
data,
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Error di umkmDelete:", e);
|
||||
return {
|
||||
success: false,
|
||||
message: "Gagal menghapus UMKM",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default umkmDelete;
|
||||
Reference in New Issue
Block a user