feat(umkm): migrate KategoriProduk to KategoriProdukUmkm for UMKM isolation

- update prisma schema to use KategoriProdukUmkm for Umkm model
- add @@map to KategoriProdukUmkm for lowercase table naming
- update API endpoints and KPI dashboard to use new model
- bump version to 0.1.33
This commit is contained in:
2026-04-28 00:47:22 +08:00
parent 5ab014281a
commit a4c7a97593
13 changed files with 533 additions and 158 deletions

View File

@@ -86,7 +86,7 @@ async function umkmDashboardKpi(context: Context) {
});
if (kategoriTerbanyakUmkm.length > 0) {
const kategori = await prisma.kategoriProduk.findUnique({
const kategori = await prisma.kategoriProdukUmkm.findUnique({
where: { id: kategoriTerbanyakUmkm[0].kategoriId },
select: { nama: true },
});

View File

@@ -6,7 +6,7 @@ const KategoriProduk = new Elysia({
})
.get("/find-many-all", async () => {
try {
const data = await prisma.kategoriProduk.findMany({
const data = await prisma.kategoriProdukUmkm.findMany({
where: {
isActive: true,
deletedAt: null,
@@ -40,13 +40,13 @@ const KategoriProduk = new Elysia({
};
const [data, total] = await Promise.all([
prisma.kategoriProduk.findMany({
prisma.kategoriProdukUmkm.findMany({
where,
skip,
take,
orderBy: { createdAt: 'desc' },
}),
prisma.kategoriProduk.count({ where }),
prisma.kategoriProdukUmkm.count({ where }),
]);
return {
@@ -74,7 +74,7 @@ const KategoriProduk = new Elysia({
})
.post("/create", async ({ body }) => {
try {
const data = await prisma.kategoriProduk.create({
const data = await prisma.kategoriProdukUmkm.create({
data: {
nama: body.nama,
isActive: true,
@@ -100,7 +100,7 @@ const KategoriProduk = new Elysia({
})
.put("/:id", async ({ params, body }) => {
try {
const data = await prisma.kategoriProduk.update({
const data = await prisma.kategoriProdukUmkm.update({
where: { id: params.id },
data: {
nama: body.nama,
@@ -129,7 +129,7 @@ const KategoriProduk = new Elysia({
})
.delete("/del/:id", async ({ params }) => {
try {
const data = await prisma.kategoriProduk.update({
const data = await prisma.kategoriProdukUmkm.update({
where: { id: params.id },
data: {
isActive: false,

View File

@@ -1,12 +1,12 @@
import { Client } from "minio";
const minioClient = new Client({
endPoint: process.env.MINIO_ENDPOINT!,
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
endPoint: process.env.MINIO_ENDPOINT ?? "localhost",
accessKey: process.env.MINIO_ACCESS_KEY ?? "",
secretKey: process.env.MINIO_SECRET_KEY ?? "",
useSSL: process.env.MINIO_USE_SSL === "true",
});
export const MINIO_BUCKET = process.env.MINIO_BUCKET!;
export const MINIO_BUCKET = process.env.MINIO_BUCKET ?? "";
export default minioClient;