Fix: admin investasi

Deskripsi:
- Fix image dari server wibu
## No Issue
This commit is contained in:
2024-11-04 11:08:29 +08:00
parent 604077cc8d
commit 9b4a6fdc1c
49 changed files with 793 additions and 192 deletions

View File

@@ -9,6 +9,9 @@ export async function adminInvestasi_funRejectInvoiceById({
}: {
invoiceId: string;
}) {
const updt = await prisma.investasi_Invoice.update({
where: {
id: invoiceId,

View File

@@ -13,6 +13,22 @@ export async function adminInvestasi_funEditStatusPublishById({
statusId: string;
progesInvestasiId: string;
}) {
const cekStatus = await prisma.investasi.findFirst({
where: {
id: investasiId,
},
select: {
masterStatusInvestasiId: true,
},
});
if (cekStatus?.masterStatusInvestasiId !== "2") {
return {
status: 400,
message: "User membatalkan review",
};
}
const publishTime = new Date();
const res = await prisma.investasi.update({
where: {
@@ -31,8 +47,8 @@ export async function adminInvestasi_funEditStatusPublishById({
select: {
name: true,
},
},
}
},
},
});
if (!res) return { status: 400, message: "Gagal Update" };

View File

@@ -6,6 +6,21 @@ import { revalidatePath } from "next/cache";
export default async function Admin_funRejectInvestasi(data: any) {
// console.log(data)
const cekStatus = await prisma.investasi.findFirst({
where: {
id: data.id,
},
select: {
masterStatusInvestasiId: true,
},
});
if (cekStatus?.masterStatusInvestasiId !== "2") {
return {
status: 400,
message: "User membatalkan review",
};
}
const res = await prisma.investasi.update({
where: { id: data.id },

View File

@@ -0,0 +1,58 @@
"use server";
import prisma from "@/app/lib/prisma";
export default async function adminInvestasi_getOneById({
investasiId,
}: {
investasiId: string;
}) {
const data = await prisma.investasi.findUnique({
where: {
id: investasiId,
},
select: {
imageId: true,
prospektusFileId: true,
id: true,
author: {
select: {
id: true,
username: true,
nomor: true,
Profile: true,
},
},
title: true,
authorId: true,
hargaLembar: true,
targetDana: true,
totalLembar: true,
sisaLembar: true,
lembarTerbeli: true,
progress: true,
roi: true,
active: true,
createdAt: true,
updatedAt: true,
catatan: true,
imagesId: true,
MasterStatusInvestasi: true,
BeritaInvestasi: true,
DokumenInvestasi: true,
ProspektusInvestasi: true,
MasterPembagianDeviden: true,
MasterPencarianInvestor: true,
MasterPeriodeDeviden: true,
MasterProgresInvestasi: true,
masterStatusInvestasiId: true,
Investasi_Invoice: {
where: {
statusInvoiceId: "1",
},
},
countDown: true,
},
});
return data;
}

View File

@@ -1,9 +1,11 @@
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_getOneById from "./get/fun_get_investasi_by_id";
import { adminInvestasi_getStatusInvestasi } from "./get/fun_get_status_transaksi";
export { adminInvestasi_getStatusInvestasi };
export { adminInvestasi_funGetAllTransaksiById };
export { adminInvestasi_funRejectInvoiceById };
export { adminInvestasi_funAcceptTransaksiById };
export { adminInvestasi_getOneById };