Merge pull request 'API Mobile: Donatiion' (#30) from mobile/7-oct-25 into staging
Reviewed-on: bip/hipmi#30
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
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.
|
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.4.45](https://wibugit.wibudev.com/bip/hipmi/compare/v1.4.44...v1.4.45) (2025-10-06)
|
||||||
|
|
||||||
## [1.4.44](https://wibugit.wibudev.com/bip/hipmi/compare/v1.4.43...v1.4.44) (2025-10-02)
|
## [1.4.44](https://wibugit.wibudev.com/bip/hipmi/compare/v1.4.43...v1.4.44) (2025-10-02)
|
||||||
|
|
||||||
## [1.4.43](https://wibugit.wibudev.com/bip/hipmi/compare/v1.4.42...v1.4.43) (2025-09-29)
|
## [1.4.43](https://wibugit.wibudev.com/bip/hipmi/compare/v1.4.42...v1.4.43) (2025-09-29)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.4.44",
|
"version": "1.4.45",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "bun prisma/seed.ts"
|
"seed": "bun prisma/seed.ts"
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
|
|||||||
const category = searchParams.get("category");
|
const category = searchParams.get("category");
|
||||||
let fixData;
|
let fixData;
|
||||||
|
|
||||||
console.log("[ID]", id);
|
|
||||||
console.log("[CATEGORY]", category);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (category === "temporary") {
|
if (category === "temporary") {
|
||||||
fixData = await prisma.donasi_TemporaryCreate.findUnique({
|
fixData = await prisma.donasi_TemporaryCreate.findUnique({
|
||||||
@@ -61,8 +58,6 @@ async function DELETE(
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
console.log("[ID]", id);
|
|
||||||
|
|
||||||
const checkData = await prisma.donasi.findUnique({
|
const checkData = await prisma.donasi.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -76,8 +71,6 @@ async function DELETE(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(["DATA"], checkData);
|
|
||||||
|
|
||||||
const deleteStory = await prisma.donasi_Cerita.delete({
|
const deleteStory = await prisma.donasi_Cerita.delete({
|
||||||
where: {
|
where: {
|
||||||
donasiId: id,
|
donasiId: id,
|
||||||
@@ -154,10 +147,6 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
|
|||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const category = searchParams.get("category");
|
const category = searchParams.get("category");
|
||||||
|
|
||||||
console.log("[ID]", id);
|
|
||||||
console.log("[DATA]", data);
|
|
||||||
console.log("[CATEGORY]", category);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (category === "edit-donation") {
|
if (category === "edit-donation") {
|
||||||
if (data && data.newImageId) {
|
if (data && data.newImageId) {
|
||||||
@@ -203,8 +192,67 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
|
|||||||
if (!deleteImageDonasi) {
|
if (!deleteImageDonasi) {
|
||||||
console.log("[DELETE IMAGE DONASI]", deleteImageDonasi);
|
console.log("[DELETE IMAGE DONASI]", deleteImageDonasi);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (category === "edit-story") {
|
} else if (category === "edit-story") {
|
||||||
|
|
||||||
|
if (data && data.newImageId) {
|
||||||
|
await prisma.donasi_Cerita.update({
|
||||||
|
where: {
|
||||||
|
donasiId: id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
imageId: data.newImageId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const update = await prisma.donasi_Cerita.update({
|
||||||
|
where: {
|
||||||
|
donasiId: id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
pembukaan: data.pembukaan,
|
||||||
|
cerita: data.cerita,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!update)
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 400,
|
||||||
|
success: false,
|
||||||
|
reason: "Gagal mengupdate cerita donasi",
|
||||||
|
});
|
||||||
|
|
||||||
|
const deleteImageStory = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${data.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!deleteImageStory) {
|
||||||
|
console.log("[DELETE IMAGE STORY]", deleteImageStory);
|
||||||
|
}
|
||||||
} else if (category === "edit-bank-account") {
|
} else if (category === "edit-bank-account") {
|
||||||
|
const update = await prisma.donasi.update({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
namaBank: data.namaBank,
|
||||||
|
rekening: data.rekening,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!update)
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 400,
|
||||||
|
success: false,
|
||||||
|
reason: "Gagal mengupdate bank donasi",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/lib";
|
import { prisma } from "@/lib";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
// GET ALL DATA MASTER UNTUK INVESTASI
|
// GET ALL DATA MASTER UNTUK INVESTASI
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user