Merge pull request 'Fix Rejected Apple' (#15) from fix-mobile/20-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/15
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.5.16](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.15...v1.5.16) (2025-11-20)
|
||||||
|
|
||||||
## [1.5.15](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.14...v1.5.15) (2025-11-18)
|
## [1.5.15](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.14...v1.5.15) (2025-11-18)
|
||||||
|
|
||||||
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
|
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.5.15",
|
"version": "1.5.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "bun prisma/seed.ts"
|
"seed": "bun prisma/seed.ts"
|
||||||
|
|||||||
@@ -46,17 +46,6 @@ export async function DELETE(
|
|||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
Profile: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
Portofolio: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// EVENT START
|
// EVENT START
|
||||||
Event: {
|
Event: {
|
||||||
select: {
|
select: {
|
||||||
@@ -121,6 +110,7 @@ export async function DELETE(
|
|||||||
Job: {
|
Job: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// JOB END
|
// JOB END
|
||||||
@@ -152,19 +142,18 @@ export async function DELETE(
|
|||||||
Investasi: {
|
Investasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
prospektusFileId: true,
|
||||||
|
imageId: true,
|
||||||
BeritaInvestasi: {
|
BeritaInvestasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DokumenInvestasi: {
|
DokumenInvestasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
},
|
fileId: true,
|
||||||
},
|
|
||||||
ProspektusInvestasi: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -173,6 +162,7 @@ export async function DELETE(
|
|||||||
Investasi_Invoice: {
|
Investasi_Invoice: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -182,19 +172,23 @@ export async function DELETE(
|
|||||||
Donasi: {
|
Donasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
CeritaDonasi: {
|
CeritaDonasi: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Donasi_Kabar: {
|
Donasi_Kabar: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Donasi_PencairanDana: {
|
Donasi_PencairanDana: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -203,26 +197,46 @@ export async function DELETE(
|
|||||||
Donasi_Invoice: {
|
Donasi_Invoice: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
imageId: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// DONATION END
|
// DONATION END
|
||||||
|
|
||||||
|
// PROFILE & PORTOFOLOIO START
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
Portofolio: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
logoId: true,
|
||||||
|
BusinessMaps: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
imageId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Portofolio_MediaSosial: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// PROFILE & PORTOFOLOIO END
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// =================================================== //
|
||||||
|
// ================ START DELETE ALL ================= //
|
||||||
|
// =================================================== //
|
||||||
|
|
||||||
// EVENT DELETE START
|
// EVENT DELETE START
|
||||||
for (let event of checkUser?.Event as any) {
|
|
||||||
const deleteEvent = await prisma.event.findFirst({
|
|
||||||
where: {
|
|
||||||
id: event.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(["DELETE EVENT", deleteEvent]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let event of checkUser?.Event_Peserta as any) {
|
for (let event of checkUser?.Event_Peserta as any) {
|
||||||
const deleteEvent = await prisma.event_Peserta.findFirst({
|
const deleteEvent = await prisma.event_Peserta.delete({
|
||||||
where: {
|
where: {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
},
|
},
|
||||||
@@ -237,22 +251,23 @@ export async function DELETE(
|
|||||||
|
|
||||||
console.log(["DELETE EVENT PESERTA", deleteEvent]);
|
console.log(["DELETE EVENT PESERTA", deleteEvent]);
|
||||||
}
|
}
|
||||||
// EVENT DELETE END
|
|
||||||
|
|
||||||
// COLLABORATION START
|
for (let event of checkUser?.Event as any) {
|
||||||
for (let project of checkUser?.ProjectCollaboration as any) {
|
const deleteEvent = await prisma.event.delete({
|
||||||
const deleteProject = await prisma.projectCollaboration.findFirst({
|
|
||||||
where: {
|
where: {
|
||||||
id: project.id,
|
id: event.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(["DELETE PROJECT", deleteProject]);
|
console.log(["DELETE EVENT", deleteEvent]);
|
||||||
}
|
}
|
||||||
|
// EVENT DELETE END
|
||||||
|
|
||||||
|
// COLLABORATION START
|
||||||
|
|
||||||
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
|
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
|
||||||
const deleteProject =
|
const deleteProject =
|
||||||
await prisma.projectCollaboration_Partisipasi.findFirst({
|
await prisma.projectCollaboration_Partisipasi.delete({
|
||||||
where: {
|
where: {
|
||||||
id: project.id,
|
id: project.id,
|
||||||
},
|
},
|
||||||
@@ -262,19 +277,18 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let project of checkUser?.ProjectCollaboration_RoomChat as any) {
|
for (let project of checkUser?.ProjectCollaboration_RoomChat as any) {
|
||||||
const deleteProject =
|
const deleteProject = await prisma.projectCollaboration_RoomChat.delete({
|
||||||
await prisma.projectCollaboration_RoomChat.findFirst({
|
where: {
|
||||||
where: {
|
id: project.id,
|
||||||
id: project.id,
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
console.log(["DELETE PROJECT ROOMCHAT", deleteProject]);
|
console.log(["DELETE PROJECT ROOMCHAT", deleteProject]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let project of checkUser?.ProjectCollaboration_AnggotaRoomChat as any) {
|
for (let project of checkUser?.ProjectCollaboration_AnggotaRoomChat as any) {
|
||||||
const deleteProject =
|
const deleteProject =
|
||||||
await prisma.projectCollaboration_AnggotaRoomChat.findFirst({
|
await prisma.projectCollaboration_AnggotaRoomChat.delete({
|
||||||
where: {
|
where: {
|
||||||
id: project.id,
|
id: project.id,
|
||||||
},
|
},
|
||||||
@@ -284,31 +298,49 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let project of checkUser?.ProjectCollaboration_Message as any) {
|
for (let project of checkUser?.ProjectCollaboration_Message as any) {
|
||||||
const deleteProject = await prisma.projectCollaboration_Message.findFirst(
|
const deleteProject = await prisma.projectCollaboration_Message.delete({
|
||||||
{
|
where: {
|
||||||
where: {
|
id: project.id,
|
||||||
id: project.id,
|
},
|
||||||
},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(["DELETE PROJECT MESSAGE", deleteProject]);
|
console.log(["DELETE PROJECT MESSAGE", deleteProject]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let project of checkUser?.ProjectCollaboration as any) {
|
||||||
|
const deleteProject = await prisma.projectCollaboration.delete({
|
||||||
|
where: {
|
||||||
|
id: project.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(["DELETE PROJECT", deleteProject]);
|
||||||
|
}
|
||||||
|
|
||||||
// COLLABORATION END
|
// COLLABORATION END
|
||||||
|
|
||||||
// VOTING START
|
// VOTING START
|
||||||
|
for (let voting of checkUser?.Voting_Kontributor as any) {
|
||||||
|
const deleteVotingKontributor = await prisma.voting_Kontributor.delete({
|
||||||
|
where: {
|
||||||
|
id: voting.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(["DELETE VOTING KONTRIBUTOR", deleteVotingKontributor]);
|
||||||
|
}
|
||||||
|
|
||||||
for (let voting of checkUser?.Voting as any) {
|
for (let voting of checkUser?.Voting as any) {
|
||||||
for (let id of voting?.Voting_DaftarNamaVote as any) {
|
for (let id of voting?.Voting_DaftarNamaVote as any) {
|
||||||
const deleteVotingListName =
|
const deleteVotingListName = await prisma.voting_DaftarNamaVote.delete({
|
||||||
await prisma.voting_DaftarNamaVote.findFirst({
|
where: {
|
||||||
where: {
|
id: id.id,
|
||||||
id: id.id,
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
|
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteVoting = await prisma.voting.findFirst({
|
const deleteVoting = await prisma.voting.delete({
|
||||||
where: {
|
where: {
|
||||||
id: voting.id,
|
id: voting.id,
|
||||||
},
|
},
|
||||||
@@ -319,7 +351,23 @@ export async function DELETE(
|
|||||||
|
|
||||||
// JOB START
|
// JOB START
|
||||||
for (let job of checkUser?.Job as any) {
|
for (let job of checkUser?.Job as any) {
|
||||||
const deleteJob = await prisma.job.findFirst({
|
if (job.imageId) {
|
||||||
|
const deleteJobImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${job.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteJobImage.ok) {
|
||||||
|
console.log("Success delete job image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteJob = await prisma.job.delete({
|
||||||
where: {
|
where: {
|
||||||
id: job.id,
|
id: job.id,
|
||||||
},
|
},
|
||||||
@@ -329,26 +377,9 @@ export async function DELETE(
|
|||||||
// JOB END
|
// JOB END
|
||||||
|
|
||||||
// FORUM START
|
// FORUM START
|
||||||
for (let forum of checkUser?.Forum_Posting as any) {
|
|
||||||
const deleteForum = await prisma.forum_Posting.findFirst({
|
|
||||||
where: {
|
|
||||||
id: forum.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(["DELETE FORUM POSTING", deleteForum]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let forum of checkUser?.Forum_Komentar as any) {
|
|
||||||
const deleteForum = await prisma.forum_Komentar.findFirst({
|
|
||||||
where: {
|
|
||||||
id: forum.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(["DELETE FORUM KOMENTAR", deleteForum]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let forum of checkUser?.Forum_ReportKomentar as any) {
|
for (let forum of checkUser?.Forum_ReportKomentar as any) {
|
||||||
const deleteForum = await prisma.forum_ReportKomentar.findFirst({
|
const deleteForum = await prisma.forum_ReportKomentar.delete({
|
||||||
where: {
|
where: {
|
||||||
id: forum.id,
|
id: forum.id,
|
||||||
},
|
},
|
||||||
@@ -357,19 +388,53 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let forum of checkUser?.Forum_ReportPosting as any) {
|
for (let forum of checkUser?.Forum_ReportPosting as any) {
|
||||||
const deleteForum = await prisma.forum_ReportPosting.findFirst({
|
const deleteForum = await prisma.forum_ReportPosting.delete({
|
||||||
where: {
|
where: {
|
||||||
id: forum.id,
|
id: forum.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(["DELETE FORUM REPORT POSTING", deleteForum]);
|
console.log(["DELETE FORUM REPORT POSTING", deleteForum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let forum of checkUser?.Forum_Komentar as any) {
|
||||||
|
const deleteForum = await prisma.forum_Komentar.delete({
|
||||||
|
where: {
|
||||||
|
id: forum.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(["DELETE FORUM KOMENTAR", deleteForum]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let forum of checkUser?.Forum_Posting as any) {
|
||||||
|
const deleteForum = await prisma.forum_Posting.delete({
|
||||||
|
where: {
|
||||||
|
id: forum.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(["DELETE FORUM POSTING", deleteForum]);
|
||||||
|
}
|
||||||
// FORUM END
|
// FORUM END
|
||||||
|
|
||||||
// INVESTASI START
|
// INVESTASI START
|
||||||
|
|
||||||
for (let invoice of checkUser?.Investasi_Invoice as any) {
|
for (let invoice of checkUser?.Investasi_Invoice as any) {
|
||||||
const deleteInvoice = await prisma.investasi_Invoice.findFirst({
|
if (invoice?.imageId) {
|
||||||
|
const deleteInvoiceImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${invoice.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteInvoiceImage.ok) {
|
||||||
|
console.log("Success delete invoice image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteInvoice = await prisma.investasi_Invoice.delete({
|
||||||
where: {
|
where: {
|
||||||
id: invoice.id,
|
id: invoice.id,
|
||||||
},
|
},
|
||||||
@@ -379,7 +444,22 @@ export async function DELETE(
|
|||||||
|
|
||||||
for (let investasi of checkUser?.Investasi as any) {
|
for (let investasi of checkUser?.Investasi as any) {
|
||||||
for (let berita of investasi?.BeritaInvestasi as any) {
|
for (let berita of investasi?.BeritaInvestasi as any) {
|
||||||
const deleteBerita = await prisma.beritaInvestasi.findFirst({
|
if (berita?.imageId) {
|
||||||
|
const deleteBeritaImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${berita.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteBeritaImage.ok) {
|
||||||
|
console.log("Success delete image berita investasi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteBerita = await prisma.beritaInvestasi.delete({
|
||||||
where: {
|
where: {
|
||||||
id: berita.id,
|
id: berita.id,
|
||||||
},
|
},
|
||||||
@@ -388,7 +468,22 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let dokumen of investasi?.DokumenInvestasi as any) {
|
for (let dokumen of investasi?.DokumenInvestasi as any) {
|
||||||
const deleteDokumen = await prisma.dokumenInvestasi.findFirst({
|
if (dokumen?.fileId) {
|
||||||
|
const deleteDokumenImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${dokumen.fileId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteDokumenImage.ok) {
|
||||||
|
console.log("Success delete image dokumen investasi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteDokumen = await prisma.dokumenInvestasi.delete({
|
||||||
where: {
|
where: {
|
||||||
id: dokumen.id,
|
id: dokumen.id,
|
||||||
},
|
},
|
||||||
@@ -396,14 +491,39 @@ export async function DELETE(
|
|||||||
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
|
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteProspektus = await prisma.prospektusInvestasi.findFirst({
|
if (investasi?.prospektusFileId) {
|
||||||
where: {
|
const deleteProspektusFile = await fetch(
|
||||||
investasiId: investasi.id,
|
`https://wibu-storage.wibudev.com/api/files/${investasi.prospektusFileId}/delete`,
|
||||||
},
|
{
|
||||||
});
|
method: "DELETE",
|
||||||
console.log(["DELETE PROSPEKTUS INVESTASI", deleteProspektus]);
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const deleteInvestasi = await prisma.investasi.findFirst({
|
if (deleteProspektusFile.ok) {
|
||||||
|
console.log("Success delete prospektus file investasi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (investasi?.imageId) {
|
||||||
|
const deleteInvestasiImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${investasi.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteInvestasiImage.ok) {
|
||||||
|
console.log("Success delete image investasi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteInvestasi = await prisma.investasi.delete({
|
||||||
where: {
|
where: {
|
||||||
id: investasi.id,
|
id: investasi.id,
|
||||||
},
|
},
|
||||||
@@ -414,18 +534,48 @@ export async function DELETE(
|
|||||||
|
|
||||||
// DONASI START
|
// DONASI START
|
||||||
|
|
||||||
for (let donasi of checkUser?.Donasi_Invoice as any) {
|
for (let donasiInvoice of checkUser?.Donasi_Invoice as any) {
|
||||||
const deleteInvoice = await prisma.donasi_Invoice.findFirst({
|
if (donasiInvoice?.imageId) {
|
||||||
|
const deleteInvoiceImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${donasiInvoice.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteInvoiceImage.ok) {
|
||||||
|
console.log("Success delete invoice image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteInvoice = await prisma.donasi_Invoice.delete({
|
||||||
where: {
|
where: {
|
||||||
id: donasi.id,
|
id: donasiInvoice.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
|
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let invoice of checkUser?.Donasi as any) {
|
for (let donasi of checkUser?.Donasi as any) {
|
||||||
for (let kabar of invoice?.Donasi_Kabar as any) {
|
for (let kabar of donasi?.Donasi_Kabar as any) {
|
||||||
const deleteKabar = await prisma.donasi_Kabar.findFirst({
|
if (kabar?.imageId) {
|
||||||
|
const deleteKabarImage = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${kabar.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteKabarImage.ok) {
|
||||||
|
console.log("Success delete kabar image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteKabar = await prisma.donasi_Kabar.delete({
|
||||||
where: {
|
where: {
|
||||||
id: kabar.id,
|
id: kabar.id,
|
||||||
},
|
},
|
||||||
@@ -433,28 +583,70 @@ export async function DELETE(
|
|||||||
console.log(["DELETE KABAR DONASI", deleteKabar]);
|
console.log(["DELETE KABAR DONASI", deleteKabar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let pencairanDana of invoice?.Donasi_PencairanDana as any) {
|
for (let pencairanDana of donasi?.Donasi_PencairanDana as any) {
|
||||||
const deletePencairanDana = await prisma.donasi_PencairanDana.findFirst(
|
if (pencairanDana?.imageId) {
|
||||||
{
|
const deletePencairanDanaImage = await fetch(
|
||||||
where: {
|
`https://wibu-storage.wibudev.com/api/files/${pencairanDana.imageId}/delete`,
|
||||||
id: pencairanDana.id,
|
{
|
||||||
},
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deletePencairanDanaImage.ok) {
|
||||||
|
console.log("Success delete pencairan dana image");
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
|
||||||
|
const deletePencairanDana = await prisma.donasi_PencairanDana.delete({
|
||||||
|
where: {
|
||||||
|
id: pencairanDana.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
console.log(["DELETE PENCAIRAN DANA DONASI", deletePencairanDana]);
|
console.log(["DELETE PENCAIRAN DANA DONASI", deletePencairanDana]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteCerita = await prisma.donasi_Cerita.findFirst({
|
const deleteImageCerita = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${donasi?.CeritaDonasi?.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteImageCerita.ok) {
|
||||||
|
console.log("Success delete image cerita donasi");
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteCerita = await prisma.donasi_Cerita.delete({
|
||||||
where: {
|
where: {
|
||||||
id: invoice.id,
|
donasiId: donasi.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(["DELETE CERITA DONASI", deleteCerita]);
|
console.log(["DELETE CERITA DONASI", deleteCerita]);
|
||||||
|
|
||||||
const deleteDonasi = await prisma.donasi.findFirst({
|
const deleteImageDonasi = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${donasi?.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteImageDonasi.ok) {
|
||||||
|
console.log("Success delete image donasi");
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteDonasi = await prisma.donasi.delete({
|
||||||
where: {
|
where: {
|
||||||
id: invoice.id,
|
id: donasi.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(["DELETE DONASI", deleteDonasi]);
|
console.log(["DELETE DONASI", deleteDonasi]);
|
||||||
@@ -464,51 +656,64 @@ export async function DELETE(
|
|||||||
|
|
||||||
// PORTOFOLIO DELETE START
|
// PORTOFOLIO DELETE START
|
||||||
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
|
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
|
||||||
const deletePortofolio = await prisma.portofolio.findFirst({
|
if (portofolio?.BusinessMaps?.id) {
|
||||||
|
const deleteLogo = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${portofolio?.BusinessMaps?.imageId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteLogo.ok) {
|
||||||
|
console.log("Success delete logo");
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteMaps = await prisma.businessMaps.delete({
|
||||||
|
where: {
|
||||||
|
id: portofolio?.BusinessMaps?.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(["DELETE MAPS", deleteMaps]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (portofolio?.Portofolio_MediaSosial?.id) {
|
||||||
|
const deleteSosialMedia = await prisma.portofolio_MediaSosial.delete({
|
||||||
|
where: {
|
||||||
|
portofolioId: portofolio.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(["DELETE SOSIAL MEDIA", deleteSosialMedia]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (portofolio?.logoId) {
|
||||||
|
const deleteLogo = await fetch(
|
||||||
|
`https://wibu-storage.wibudev.com/api/files/${portofolio?.logoId}/delete`,
|
||||||
|
{
|
||||||
|
method: "DELETE",
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (deleteLogo.ok) {
|
||||||
|
console.log("Success delete logo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deletePortofolio = await prisma.portofolio.delete({
|
||||||
where: {
|
where: {
|
||||||
id: portofolio.id,
|
id: portofolio.id,
|
||||||
},
|
},
|
||||||
select: {
|
|
||||||
logoId: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// const deleteLogo = await fetch(
|
|
||||||
// `https://wibu-storage.wibudev.com/api/files/${deletePortofolio.logoId}/delete`,
|
|
||||||
// {
|
|
||||||
// method: "DELETE",
|
|
||||||
// headers: {
|
|
||||||
// Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (deleteLogo.ok) {
|
|
||||||
// console.log("Success delete logo");
|
|
||||||
// }
|
|
||||||
|
|
||||||
console.log(["DELETE PORTOFOLIO", deletePortofolio]);
|
console.log(["DELETE PORTOFOLIO", deletePortofolio]);
|
||||||
|
|
||||||
const deleteMaps = await prisma.businessMaps.findFirst({
|
|
||||||
where: {
|
|
||||||
portofolioId: portofolio.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(["DELETE MAPS", deleteMaps]);
|
|
||||||
|
|
||||||
const deleteSosialMedia = await prisma.portofolio_MediaSosial.findFirst({
|
|
||||||
where: {
|
|
||||||
portofolioId: portofolio.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(["DELETE SOSIAL MEDIA", deleteSosialMedia]);
|
|
||||||
|
|
||||||
console.log(["DELETE PORTOFOLIOID:", portofolio.id]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteProfile = await prisma.profile.findFirst({
|
const deleteProfile = await prisma.profile.delete({
|
||||||
where: {
|
where: {
|
||||||
userId: id,
|
userId: id,
|
||||||
},
|
},
|
||||||
@@ -516,6 +721,13 @@ export async function DELETE(
|
|||||||
console.log(["DELETE PROFILE", deleteProfile]);
|
console.log(["DELETE PROFILE", deleteProfile]);
|
||||||
// PORTOFOLIO DELETE END
|
// PORTOFOLIO DELETE END
|
||||||
|
|
||||||
|
const deleteUser = await prisma.user.delete({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(["DELETE USER", deleteUser]);
|
||||||
|
|
||||||
console.log("[END DELETE ALL >>>]");
|
console.log("[END DELETE ALL >>>]");
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
|
|||||||
Reference in New Issue
Block a user