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:
@@ -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 },
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user