Compare commits

...

8 Commits

Author SHA1 Message Date
27259cd86c Mobile APi: Investasi
### No Issue
2025-10-31 15:45:07 +08:00
a278470dbb chore(release): 1.5.9 2025-10-30 17:42:07 +08:00
b209a12315 Mobile Api: Admin investasi
Add:
- src/app/api/mobile/admin/investment/

Fix:
-   src/app/api/mobile/investment/route.ts

### No Issue
2025-10-30 17:41:59 +08:00
2e2a5c2566 Mobile API: Donation & Admin Donation
Add:
- src/app/api/mobile/admin/donation/[id]/disbursement/
- src/app/api/mobile/donation/[id]/disbursement/
- src/app/api/mobile/donation/[id]/donatur/

### No Issue
2025-10-29 17:31:41 +08:00
ccfb361564 chore(release): 1.5.8 2025-10-29 17:27:44 +08:00
5553f451e8 update version 2025-10-28 17:50:19 +08:00
027ec4f6c5 chore(release): 1.5.7 2025-10-28 17:49:52 +08:00
8485209a75 Mobile API: Donation & Admin Donation
Add:
- prisma/migrations/20251028063234_donasi_invoice_relation_bank_master/ : penambahan master bank ke donasi invoce
- src/app/api/mobile/admin/donation/[id]/invoice/

Fix:
- prisma/schema.prisma
- src/app/api/mobile/admin/donation/[id]/donatur/route.ts
- src/app/api/mobile/admin/donation/[id]/route.ts
- src/app/api/mobile/donation/[id]/invoice/route.ts

### No Issue
2025-10-28 17:48:36 +08:00
17 changed files with 1039 additions and 46 deletions

View File

@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.5.9](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.8...v1.5.9) (2025-10-30)
## [1.5.8](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.7...v1.5.8) (2025-10-29)
## [1.5.7](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.6...v1.5.7) (2025-10-28)
## [1.5.6](https://wibugit.wibudev.com/bip/hipmi/compare/v1.5.5...v1.5.6) (2025-10-21)
## [1.5.5](https://wibugit.wibudev.com/bip/hipmi/compare/v1.5.4...v1.5.5) (2025-10-20)

View File

@@ -1,6 +1,6 @@
{
"name": "hipmi",
"version": "1.5.6",
"version": "1.5.9",
"private": true,
"prisma": {
"seed": "bun prisma/seed.ts"

View File

@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "Donasi_Invoice" ADD COLUMN "masterBankId" TEXT;
-- AddForeignKey
ALTER TABLE "Donasi_Invoice" ADD CONSTRAINT "Donasi_Invoice_masterBankId_fkey" FOREIGN KEY ("masterBankId") REFERENCES "MasterBank"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@@ -202,6 +202,7 @@ model MasterBank {
updatedAt DateTime @updatedAt
Investasi_Invoice Investasi_Invoice[]
EventTransaksi EventTransaksi[]
Donasi_Invoice Donasi_Invoice[]
}
model MasterStatus {
@@ -576,7 +577,9 @@ model Donasi_Invoice {
Images Images? @relation(fields: [imagesId], references: [id])
imagesId String?
imageId String?
imageId String?
MasterBank MasterBank? @relation(fields: [masterBankId], references: [id])
masterBankId String? @default("null")
}
model Donasi_Kabar {

View File

@@ -0,0 +1,166 @@
import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
export { POST, GET };
async function POST(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await request.json();
try {
const dataDonasi = await prisma.donasi.findUnique({
where: {
id: id,
},
select: {
akumulasiPencairan: true,
totalPencairan: true,
},
});
if (!dataDonasi)
return NextResponse.json(
{
success: false,
message: "Pencarian Donasi Gagal",
reason: "Pencarian Donasi Gagal",
},
{ status: 400 }
);
const createPencairan = await prisma.donasi_PencairanDana.create({
data: {
donasiId: id,
nominalCair: +data.nominalCair,
deskripsi: data.deskripsi,
title: data.title,
imageId: data.imageId,
},
});
if (!createPencairan)
return NextResponse.json(
{
success: false,
message: "Pencairan Dana Gagal",
reason: "Pencairan Dana Gagal",
},
{ status: 400 }
);
const hasilTotalPencairan =
Number(dataDonasi.totalPencairan) + Number(data.nominalCair);
// const hasilAkumulasiPencairan = Number(dataDonasi.akumulasiPencairan) + 1;
const countPencairan = await prisma.donasi_PencairanDana.count({
where: {
donasiId: id,
},
});
const updateDonasi = await prisma.donasi.update({
where: {
id: id,
},
data: {
akumulasiPencairan: countPencairan,
totalPencairan: hasilTotalPencairan,
},
});
if (!updateDonasi)
return NextResponse.json(
{
success: false,
message: "Update Donasi Gagal",
reason: "Update Donasi Gagal",
},
{ status: 400 }
);
return NextResponse.json(
{
success: true,
message: "Pencairan Dana Berhasil",
// data: data,
},
{ status: 200 }
);
} catch (error) {
console.error("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Pencairan Dana Gagal",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
const page = searchParams.get("page");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
let fixData;
try {
if (category === "get-all") {
fixData = await prisma.donasi_PencairanDana.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
donasiId: id,
},
select: {
id: true,
createdAt: true,
nominalCair: true,
},
});
} else if (category === "get-one") {
fixData = await prisma.donasi_PencairanDana.findUnique({
where: {
id: id,
},
});
} else {
return NextResponse.json(
{
success: false,
message: "Category tidak ditemukan",
reason: "Category tidak ditemukan",
},
{ status: 400 }
);
}
return NextResponse.json(
{
success: true,
message: "Success get data disbursement",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
console.error("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Gagal mendapatkan data disbursement",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -13,40 +13,11 @@ async function GET(req: Request, { params }: { params: { id: string } }) {
const skipData = Number(page) * takeData - takeData;
const fixStatus = _.startCase(status || "");
console.log("[FIX STATUS]", fixStatus);
let fixData;
try {
if (fixStatus) {
const data = await prisma.donasi_Invoice.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
donasiId: id,
active: true,
DonasiMaster_StatusInvoice: {
name: {
contains: fixStatus,
mode: "insensitive",
},
},
},
select: {
id: true,
nominal: true,
createdAt: true,
Author: true,
DonasiMaster_Bank: true,
DonasiMaster_StatusInvoice: true,
donasiMaster_StatusInvoiceId: true,
imagesId: true,
imageId: true,
},
});
fixData = data;
} else {
if (status === null) {
fixData = await prisma.donasi_Invoice.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
@@ -67,8 +38,59 @@ async function GET(req: Request, { params }: { params: { id: string } }) {
donasiMaster_StatusInvoiceId: true,
imagesId: true,
imageId: true,
MasterBank: true,
},
});
} else {
const checkStatusTransaksi =
await prisma.donasiMaster_StatusInvoice.findFirst({
where: {
name: fixStatus,
},
});
console.log("[CHECK STATUS TRANSAKSI]", checkStatusTransaksi);
if (!checkStatusTransaksi)
return NextResponse.json(
{
success: false,
message: "Error get detail Investasi",
reason: "Status not found",
},
{ status: 500 }
);
const data = await prisma.donasi_Invoice.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
donasiId: id,
active: true,
DonasiMaster_StatusInvoice: {
name: {
contains: checkStatusTransaksi.name,
mode: "insensitive",
},
},
},
select: {
id: true,
nominal: true,
createdAt: true,
Author: true,
DonasiMaster_Bank: true,
DonasiMaster_StatusInvoice: true,
donasiMaster_StatusInvoiceId: true,
imagesId: true,
imageId: true,
},
});
fixData = data;
}
return NextResponse.json(

View File

@@ -0,0 +1,176 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import _ from "lodash";
export { GET, PUT };
async function GET(req: Request, { params }: { params: { id: string } }) {
const { id } = params;
console.log("[ID]", id);
try {
const data = await prisma.donasi_Invoice.findUnique({
where: {
id: id,
},
select: {
id: true,
donasiId: true,
nominal: true,
createdAt: true,
Author: true,
DonasiMaster_StatusInvoice: true,
imageId: true,
MasterBank: true,
},
});
return NextResponse.json(
{
success: true,
message: "Berhasil mendapatkan data",
data: data,
},
{ status: 200 }
);
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Error get detail Investasi",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}
// TYPE DATA
interface DataType {
donationId: string;
nominal: number;
}
async function PUT(req: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await req.json();
const { searchParams } = new URL(req.url);
const status = searchParams.get("status");
const fixStatus = _.startCase(status as string);
console.log("[ID]", id);
console.log("[DATA]", data);
console.log("[FIX STATUS]", fixStatus);
const cloneData = data as DataType;
try {
const checkStatusTransaksi =
await prisma.donasiMaster_StatusInvoice.findFirst({
where: {
name: fixStatus,
},
});
if (!checkStatusTransaksi)
return NextResponse.json(
{
success: false,
message: "Failed update status invoice",
reason: "Status not found",
},
{ status: 500 }
);
const donasi = await prisma.donasi.findUnique({
where: {
id: data?.donationId,
},
select: {
target: true,
terkumpul: true,
},
});
if (!donasi) {
return NextResponse.json(
{
success: false,
message: "Failed update status invoice",
reason: "Donasi not found",
},
{ status: 500 }
);
}
const updateInvoice = await prisma.donasi_Invoice.update({
where: {
id: id,
},
data: {
donasiMaster_StatusInvoiceId: checkStatusTransaksi.id,
},
});
if (!updateInvoice) {
return NextResponse.json(
{
success: false,
message: "Failed update status invoice",
reason: "Update invoice failed",
},
{ status: 500 }
);
}
let totalNominal =
Number(cloneData.nominal) + (Number(donasi.terkumpul) || 0);
const progres =
Math.floor((totalNominal / Number(donasi.target)) * 1000) / 10;
console.log("[STATUS]", checkStatusTransaksi);
console.log("[TOTAL NOMINAL]", totalNominal);
console.log("[PROGRES]", progres);
const updateDonasi = await prisma.donasi.update({
where: {
id: data?.donationId,
},
data: {
terkumpul: "" + totalNominal,
progres: "" + progres,
},
});
if (!updateDonasi) {
return NextResponse.json(
{
success: false,
message: "Failed update status invoice",
reason: "Update donasi failed",
},
{ status: 500 }
);
}
return NextResponse.json(
{
success: true,
message: "Berhasil update status invoice",
data: updateDonasi,
},
{ status: 200 }
);
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Error update status invoice",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -42,11 +42,23 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
},
});
const successInvoice = await prisma.donasi_Invoice.count({
where: {
donasiId: donasiId,
DonasiMaster_StatusInvoice: {
name: "Berhasil",
},
},
});
return NextResponse.json(
{
success: true,
message: "Data Donasi Berhasil Diambil",
data: data,
data: {
donasi: data,
donatur: successInvoice,
},
},
{ status: 200 }
);

View File

@@ -0,0 +1,70 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export async function GET(
request: Request,
{ params }: { params: { id: string } }
) {
try {
let fixData;
const { id } = params;
const { searchParams } = new URL(request.url);
const page = searchParams.get("page");
const status = searchParams.get("status");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
const fixStatus = _.startCase(status ? status : "");
const checkStatus = await prisma.investasiMaster_StatusInvoice.findFirst({
where: {
name: fixStatus,
},
});
const data = await prisma.investasi_Invoice.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
investasiId: id,
isActive: true,
StatusInvoice: {
name: {
contains: checkStatus?.name,
mode: "insensitive",
},
},
},
select: {
id: true,
Author: true,
StatusInvoice: true,
},
});
fixData = data;
return NextResponse.json(
{
success: true,
message: "Success get status transaksi",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
console.error("Eror get status transaksi", error);
return NextResponse.json(
{
success: false,
message: "Error get status transaksi",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,178 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET, PUT };
async function GET(req: Request, { params }: { params: { id: string } }) {
const { id } = params;
try {
const data = await prisma.investasi_Invoice.findUnique({
where: {
id: id,
},
select: {
id: true,
investasiId: true,
nominal: true,
createdAt: true,
Author: true,
StatusInvoice: true,
imageId: true,
MasterBank: true,
lembarTerbeli: true,
},
});
return NextResponse.json(
{
success: true,
message: "Berhasil mendapatkan data",
data: data,
},
{ status: 200 }
);
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Error get detail Investasi",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}
async function PUT(req: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await req.json();
const { searchParams } = new URL(req.url);
const category = searchParams.get("category");
console.log("[ID]", id);
console.log("[DATA]", data);
console.log("[CATEGORY]", category);
let fixData;
try {
if (category === "deny") {
const updt = await prisma.investasi_Invoice.update({
where: {
id: id,
},
data: {
statusInvoiceId: "4",
},
select: {
StatusInvoice: true,
authorId: true,
},
});
fixData = updt;
} else if (category === "accept") {
const dataInvestasi: any = await prisma.investasi.findFirst({
where: {
id: data.investasiId,
},
select: {
totalLembar: true,
sisaLembar: true,
lembarTerbeli: true,
},
});
// Hitung TOTAL SISA LEMBAR
const investasi_sisaLembar = Number(dataInvestasi?.sisaLembar);
const invoice_lembarTerbeli = Number(data.lembarTerbeli);
const resultSisaLembar = investasi_sisaLembar - invoice_lembarTerbeli;
// TAMBAH LEMBAR TERBELI
const investasi_lembarTerbeli = Number(dataInvestasi?.lembarTerbeli);
const resultLembarTerbeli =
investasi_lembarTerbeli + invoice_lembarTerbeli;
// Progress
const investasi_totalLembar = Number(dataInvestasi?.totalLembar);
const progress = (resultLembarTerbeli / investasi_totalLembar) * 100;
const resultProgres = Number(progress).toFixed(2);
const updt = await prisma.investasi_Invoice.update({
where: {
id: id,
},
data: {
statusInvoiceId: "1",
},
});
if (!updt) {
return NextResponse.json(
{
success: false,
message: "Gagal Update Status",
reason: "Update status failed",
},
{ status: 500 }
);
}
const updateInvestasi = await prisma.investasi.update({
where: {
id: data.investasiId,
},
data: {
sisaLembar: resultSisaLembar.toString(),
lembarTerbeli: resultLembarTerbeli.toString(),
progress: resultProgres,
},
include: {
MasterStatusInvestasi: true,
},
});
if (!updateInvestasi) {
return NextResponse.json(
{
success: false,
message: "Gagal Update Data Investasi",
reason: "Update data investasi failed",
},
{ status: 500 }
);
}
fixData = updt;
} else {
return NextResponse.json(
{
success: false,
message: "Invalid category",
reason: "Invalid category",
},
{ status: 400 }
);
}
return NextResponse.json(
{
success: true,
message: "Berhasil update data",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json(
{
success: false,
message: "Error update detail Investasi",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,139 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET, PUT };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
try {
const data = await prisma.investasi.findUnique({
where: {
id: id,
},
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,
countDown: true,
Investasi_Invoice: {
where: {
statusInvoiceId: {
in: ["1", "2", "3", "4"],
},
},
},
},
});
return NextResponse.json(
{
success: true,
message: "Success get data investment",
data: data,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error get data investment",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}
async function PUT(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await request.json();
const { searchParams } = new URL(request.url);
const status = searchParams.get("status");
console.log("[=======Start Investment console=======]")
console.log("[ID]", id);
console.log("[DATA]", data);
console.log("[STATUS]", status);
console.log("[=======End Investment console=======]")
const publishTime = new Date();
try {
if (status === "reject") {
const updatedData = await prisma.investasi.update({
where: {
id: id,
},
data: {
catatan: data,
masterStatusInvestasiId: "4",
},
});
console.log("[UPDATE REJECT]", updatedData);
} else if (status === "publish") {
const updatedData = await prisma.investasi.update({
where: {
id: id,
},
data: {
masterStatusInvestasiId: "1",
masterProgresInvestasiId: "1",
countDown: publishTime,
},
});
console.log("[UPDATE PUBLISH]", updatedData);
}
return NextResponse.json(
{
success: true,
message: "Success update data investment",
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error update data investment",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,104 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET };
async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
console.log("[PAGE]", page);
let fixData;
try {
if (category === "dashboard") {
const publish = await prisma.investasi.count({
where: {
MasterStatusInvestasi: {
name: "Publish",
},
},
});
const review = await prisma.investasi.count({
where: {
MasterStatusInvestasi: {
name: "Review",
},
},
});
const reject = await prisma.investasi.count({
where: {
MasterStatusInvestasi: {
name: "Reject",
},
},
});
fixData = {
publish,
review,
reject,
};
} else {
const fixCategoryToStatus = _.startCase(category || "");
console.log("[STATUS]", fixCategoryToStatus);
const data = await prisma.investasi.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
updatedAt: "desc",
},
where: {
active: true,
MasterStatusInvestasi: {
name: fixCategoryToStatus,
},
title: {
contains: search || "",
mode: "insensitive",
},
},
select: {
id: true,
title: true,
author: {
select: {
id: true,
username: true,
},
},
},
});
fixData = data;
}
return NextResponse.json(
{
success: true,
message: "Success get data investment",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
console.error("[ERROR GET DATA INVESTMENT]", error);
return NextResponse.json(
{
success: false,
message: "Error get data investment",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,37 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { GET };
async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const page = Number(searchParams.get("page"));
const takeData = 5;
const skipData = page * takeData - takeData;
try {
const data = await prisma.donasi_PencairanDana.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "asc",
},
where: {
donasiId: id,
},
});
return NextResponse.json({
success: true,
message: "Success get disbursement data",
data: data,
});
} catch (error) {
return NextResponse.json({
success: false,
message: "Error get disbursement data",
reason: error as Error,
});
}
}

View File

@@ -0,0 +1,74 @@
import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
export async function GET(
request: Request,
{ params }: { params: { id: string } }
) {
try {
let fixData;
const { id } = params;
const { searchParams } = new URL(request.url);
const page = Number(searchParams.get("page"));
const takeData = 10;
const skipData = page * takeData - takeData;
fixData = await prisma.donasi_Invoice.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
donasiId: id,
DonasiMaster_StatusInvoice: {
name: "Berhasil",
},
},
select: {
id: true,
Author: {
select: {
id: true,
username: true,
},
},
nominal: true,
createdAt: true,
// updatedAt: true,
// DonasiMaster_StatusInvoice: true,
// donasiMaster_StatusInvoiceId: true,
// Donasi: {
// select: {
// id: true,
// title: true,
// target: true,
// progres: true,
// authorId: true,
// imagesId: true,
// publishTime: true,
// donasiMaster_KategoriId: true,
// donasiMaster_DurasiId: true,
// donasiMaster_StatusDonasiId: true,
// imageDonasi: true,
// DonasiMaster_Ketegori: true,
// DonasiMaster_Durasi: true,
// DonasiMaster_Status: true,
// },
// },
},
});
return NextResponse.json({
success: true,
message: "Data berhasil diambil",
data: fixData,
});
} catch (error) {
return NextResponse.json({
success: false,
message: "Terjadi kesalahan saat mengambil data",
reason: error as Error,
});
}
}

View File

@@ -13,7 +13,7 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
data: {
donasiId: id,
nominal: data.nominal,
donasiMaster_BankId: data.bankId,
masterBankId: data.bankId,
authorId: data.authorId,
},
select: {
@@ -48,7 +48,7 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
reason: (error as Error).message,
});
}
}
}
async function GET(request: Request, { params }: { params: { id: string } }) {
try {
@@ -65,6 +65,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
createdAt: true,
donasiMaster_BankId: true,
donasiMaster_StatusInvoiceId: true,
MasterBank: true,
Donasi: {
select: {
id: true,
@@ -137,13 +138,14 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
message: "Status tidak ditemukan",
});
}
const update = await prisma.donasi_Invoice.update({
where: {
id: id,
},
data: {
donasiMaster_StatusInvoiceId: checkStatus.id,
imageId: data.fileId,
imageId: data || null,
},
select: {
id: true,
@@ -162,6 +164,8 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
},
});
console.log("[UPDATE INVOICE]", update);
return NextResponse.json({
status: 200,
success: true,

View File

@@ -4,6 +4,7 @@ import prisma from "@/lib/prisma";
import moment from "moment";
export { POST, GET };
async function POST(request: Request) {
const { data } = await request.json();
console.log(["DATA INVESTASI"], data);

View File

@@ -13,10 +13,10 @@ export async function adminInvestasi_funAcceptTransaksiById({
invoiceId: string;
investasiId: string;
lembarTerbeli: string;
}) {
console.log("Ini invoiceid", invoiceId)
console.log("Ini investasid", investasiId)
console.log("Ini lembar terbeli", lembarTerbeli)
}) {
console.log("Ini invoiceid", invoiceId);
console.log("Ini investasid", investasiId);
console.log("Ini lembar terbeli", lembarTerbeli);
const dataInvestasi: any = await prisma.investasi.findFirst({
where: {
@@ -50,7 +50,6 @@ export async function adminInvestasi_funAcceptTransaksiById({
statusInvoiceId: "1",
},
});
if (!updt) {
return { status: 400, message: "Gagal Update Status" };
@@ -87,6 +86,3 @@ export async function adminInvestasi_funAcceptTransaksiById({
};
}
}