feat(ekonomi): implement UMKM module with CRUD API and Dashboard analytics
This commit is contained in:
31
src/app/api/[[...slugs]]/_lib/ekonomi/umkm/findManyAll.ts
Normal file
31
src/app/api/[[...slugs]]/_lib/ekonomi/umkm/findManyAll.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
async function umkmFindManyAll() {
|
||||
try {
|
||||
const data = await prisma.umkm.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
deletedAt: null,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
nama: true,
|
||||
},
|
||||
orderBy: { nama: 'asc' },
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Berhasil mengambil semua UMKM aktif",
|
||||
data,
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Error di umkmFindManyAll:", e);
|
||||
return {
|
||||
success: false,
|
||||
message: "Gagal mengambil data UMKM",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default umkmFindManyAll;
|
||||
Reference in New Issue
Block a user