fix: Admin
Deskripsi: - Penambahan field nama rekening di db bank - Optimalisasi event ## No Issue
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminInvestasi_funAcceptTransaksiById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
},
|
||||
data: {
|
||||
statusInvoiceId: "1",
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function adminInvestasi_funRejectInvoiceById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {
|
||||
const updt = await prisma.investasi_Invoice.update({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
},
|
||||
data: {
|
||||
statusInvoiceId: "4",
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterAdminInvestasi.detail_publish);
|
||||
return {
|
||||
status: 200,
|
||||
message: "Update Berhasil",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminInvestasi_funGetAllTransaksiById({
|
||||
investasiId,
|
||||
page,
|
||||
selectStatus,
|
||||
}: {
|
||||
investasiId: string;
|
||||
page: number;
|
||||
selectStatus?: string;
|
||||
}) {
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi_Invoice.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
{
|
||||
createdAt: "desc",
|
||||
},
|
||||
],
|
||||
where: {
|
||||
investasiId: investasiId,
|
||||
isActive: true,
|
||||
statusInvoiceId: {
|
||||
contains: selectStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: true,
|
||||
Images: true,
|
||||
StatusInvoice: true,
|
||||
MasterBank: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.investasi_Invoice.count({
|
||||
where: {
|
||||
investasiId: investasiId,
|
||||
isActive: true,
|
||||
statusInvoiceId: {
|
||||
contains: selectStatus,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
export async function adminInvestasi_funGetOneTransaksiById({
|
||||
invoiceId,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
}) {}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function adminInvestasi_getStatusInvestasi() {
|
||||
const data = await prisma.investasiMaster_StatusInvoice.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
9
src/app_modules/admin/investasi/fun/index.ts
Normal file
9
src/app_modules/admin/investasi/fun/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { adminInvestasi_funAcceptTransaksiById } from "./edit/fun_accept_invoice_by_id";
|
||||
import { adminInvestasi_funRejectInvoiceById } from "./edit/fun_reject_invoice_by_id";
|
||||
import { adminInvestasi_funGetAllTransaksiById } from "./get/fun_get_all_transaksi_by_id";
|
||||
import { adminInvestasi_getStatusInvestasi } from "./get/fun_get_status_transaksi";
|
||||
|
||||
export { adminInvestasi_getStatusInvestasi };
|
||||
export { adminInvestasi_funGetAllTransaksiById };
|
||||
export { adminInvestasi_funRejectInvoiceById };
|
||||
export { adminInvestasi_funAcceptTransaksiById };
|
||||
Reference in New Issue
Block a user