Compare commits

...

4 Commits

Author SHA1 Message Date
0b3d4830f9 chore(release): 1.5.16 2025-11-20 15:38:23 +08:00
94e4b884a7 Fix:
- src/app/api/mobile/donation/route.ts
- src/app/api/mobile/user/[id]/route.ts

### NO Issue
2025-11-19 17:43:37 +08:00
fcad857422 Fix:
- src/app/(support)/delete-account/page.tsx
- src/app/(support)/support-center/page.tsx
- src/app/api/helper/support-center/route.ts

### No Issue
2025-11-18 14:02:17 +08:00
32619ee9b3 chore(release): 1.5.15 2025-11-18 14:00:58 +08:00
7 changed files with 586 additions and 42 deletions

View File

@@ -2,6 +2,10 @@
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.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.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17) ## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)

View File

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

View File

@@ -20,6 +20,7 @@ export default function DeleteAccount() {
const [data, setData] = useState({ const [data, setData] = useState({
description: "", description: "",
}); });
const [isLoading, setIsLoading] = useState(false);
useEffect(() => { useEffect(() => {
// Hanya di client, setelah mount // Hanya di client, setelah mount
@@ -31,15 +32,32 @@ export default function DeleteAccount() {
}, []); }, []);
const handlerSubmit = async () => { const handlerSubmit = async () => {
if (!phoneNumber || !data.description) { if (!phoneNumber) {
return notifications.show({ return notifications.show({
title: "Error", title: "Error",
message: "Please fill in description & phone number", message: "Please check your phone number",
color: "red",
});
}
if (!data.description) {
return notifications.show({
title: "Error",
message: "Please fill in description with 'Delete Account'",
color: "red",
});
}
if (data.description !== "Delete Account") {
return notifications.show({
title: "Error",
message: "Please fill in description with 'Delete Account'",
color: "red", color: "red",
}); });
} }
try { try {
setIsLoading(true);
const response = await fetch("/api/helper/delete-account", { const response = await fetch("/api/helper/delete-account", {
method: "POST", method: "POST",
headers: { headers: {
@@ -67,12 +85,14 @@ export default function DeleteAccount() {
if (!result.success) { if (!result.success) {
notifications.show({ notifications.show({
title: "Error", title: "Error",
message: result.error, message: result.error || "Failed to delete account.",
color: "red", color: "red",
}); });
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally {
setIsLoading(false);
} }
}; };
@@ -121,7 +141,7 @@ export default function DeleteAccount() {
/> />
</Grid.Col> </Grid.Col>
<Grid.Col span={4}> <Grid.Col span={4}>
<Button onClick={handlerSubmit} w={"100%"}> <Button onClick={handlerSubmit} w={"100%"} loading={isLoading}>
Submit Submit
</Button> </Button>
</Grid.Col> </Grid.Col>

View File

@@ -1,15 +1,15 @@
"use client"; "use client";
import { import {
Box, Box,
Button, Button,
Group, Group,
Paper, Paper,
SimpleGrid, SimpleGrid,
Stack, Stack,
Text, Text,
Textarea, Textarea,
TextInput, TextInput,
Title Title,
} from "@mantine/core"; } from "@mantine/core";
import { notifications } from "@mantine/notifications"; import { notifications } from "@mantine/notifications";
import { IconBrandGmail, IconLocation } from "@tabler/icons-react"; import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
@@ -22,6 +22,7 @@ export default function SupportCenter() {
title: "", title: "",
description: "", description: "",
}); });
const [isLoading, setLoading] = useState(false);
const handleSubmit = async () => { const handleSubmit = async () => {
if (!data.email || !data.title || !data.description) { if (!data.email || !data.title || !data.description) {
@@ -32,35 +33,43 @@ export default function SupportCenter() {
}); });
} }
const response = await fetch("/api/helper/support-center", { try {
method: "POST", setLoading(true);
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
const result = await response.json();
if (result.success) { const response = await fetch("/api/helper/support-center", {
notifications.show({ method: "POST",
title: "Success", headers: {
color: "green", "Content-Type": "application/json",
message: "Message sent successfully.", },
body: JSON.stringify(data),
}); });
const result = await response.json();
setData({ if (result.success) {
email: "", notifications.show({
title: "", title: "Success",
description: "", color: "green",
}); message: "Message sent successfully.",
} });
if (!result.success) { setData({
notifications.show({ email: "",
title: "Error", title: "",
color: "red", description: "",
message: result.error, });
}); }
if (!result.success) {
notifications.show({
title: "Error",
color: "red",
message: result.error || "Failed to send message.",
});
}
} catch (error) {
console.log(error);
} finally {
setLoading(false);
} }
}; };
@@ -177,7 +186,11 @@ export default function SupportCenter() {
}} }}
/> />
<Button color="yellow" onClick={() => handleSubmit()}> <Button
loading={isLoading}
color="yellow"
onClick={() => handleSubmit()}
>
Submit Submit
</Button> </Button>
</Stack> </Stack>

View File

@@ -18,7 +18,8 @@ export async function POST(req: Request) {
const data = await resend.emails.send({ const data = await resend.emails.send({
from: `${email} <onboarding@resend.dev>`, from: `${email} <onboarding@resend.dev>`,
to: ["bip.baliinteraktifperkasa@gmail.com"], // ganti sesuai email kamu to: ["bagasbanuna02@gmail.com"],
// to: ["bip.baliinteraktifperkasa@gmail.com"],
subject: title, subject: title,
html: ` html: `
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;"> <div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">

View File

@@ -47,6 +47,8 @@ async function POST(request: Request) {
}, },
}); });
console.log("[DATA DONASI]", dataDonasi);
if (!dataDonasi) if (!dataDonasi)
return NextResponse.json({ return NextResponse.json({
status: 400, status: 400,
@@ -68,6 +70,8 @@ async function POST(request: Request) {
}, },
}); });
console.log("[DATA CERITA]", dataCerita);
if (!dataCerita) if (!dataCerita)
return NextResponse.json({ return NextResponse.json({
status: 400, status: 400,

View File

@@ -32,3 +32,505 @@ export async function GET(
); );
} }
} }
export async function DELETE(
request: Request,
{ params }: { params: { id: string } }
) {
const { id } = params;
console.log("[ID USER", id);
try {
console.log("[START DELETE ALL >>>]");
const checkUser = await prisma.user.findUnique({
where: {
id: id,
},
select: {
Profile: {
select: {
id: true,
Portofolio: {
select: {
id: true,
},
},
},
},
// EVENT START
Event: {
select: {
id: true,
},
},
Event_Peserta: {
select: {
id: true,
},
},
// EVENT END
// COLLABORATION START
ProjectCollaboration: {
select: {
id: true,
},
},
ProjectCollaboration_Partisipasi: {
select: {
id: true,
},
},
ProjectCollaboration_RoomChat: {
select: {
id: true,
},
},
ProjectCollaboration_AnggotaRoomChat: {
select: {
id: true,
},
},
ProjectCollaboration_Message: {
select: {
id: true,
},
},
// COLLABORATION END
// VOTING START
Voting: {
select: {
id: true,
Voting_DaftarNamaVote: {
select: {
id: true,
},
},
},
},
Voting_Kontributor: {
select: {
id: true,
},
},
// VOTING END
// JOB START
Job: {
select: {
id: true,
},
},
// JOB END
// FORUM START
Forum_Posting: {
select: {
id: true,
},
},
Forum_Komentar: {
select: {
id: true,
},
},
Forum_ReportKomentar: {
select: {
id: true,
},
},
Forum_ReportPosting: {
select: {
id: true,
},
},
// FORUM END
// INVITATION START
Investasi: {
select: {
id: true,
BeritaInvestasi: {
select: {
id: true,
},
},
DokumenInvestasi: {
select: {
id: true,
},
},
ProspektusInvestasi: {
select: {
id: true,
},
},
},
},
Investasi_Invoice: {
select: {
id: true,
},
},
// INVITATION END
// DONATION START
Donasi: {
select: {
id: true,
CeritaDonasi: {
select: {
id: true,
},
},
Donasi_Kabar: {
select: {
id: true,
},
},
Donasi_PencairanDana: {
select: {
id: true,
},
},
},
},
Donasi_Invoice: {
select: {
id: true,
},
},
// DONATION END
},
});
// 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) {
const deleteEvent = await prisma.event_Peserta.findFirst({
where: {
id: event.id,
},
select: {
Event: {
select: {
title: true,
},
},
},
});
console.log(["DELETE EVENT PESERTA", deleteEvent]);
}
// EVENT DELETE END
// COLLABORATION START
for (let project of checkUser?.ProjectCollaboration as any) {
const deleteProject = await prisma.projectCollaboration.findFirst({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
const deleteProject =
await prisma.projectCollaboration_Partisipasi.findFirst({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT PARTISIPASI", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_RoomChat as any) {
const deleteProject =
await prisma.projectCollaboration_RoomChat.findFirst({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT ROOMCHAT", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_AnggotaRoomChat as any) {
const deleteProject =
await prisma.projectCollaboration_AnggotaRoomChat.findFirst({
where: {
id: project.id,
},
});
console.log(["DELETE PROJECT ANGGOTA ROOMCHAT", deleteProject]);
}
for (let project of checkUser?.ProjectCollaboration_Message as any) {
const deleteProject = await prisma.projectCollaboration_Message.findFirst(
{
where: {
id: project.id,
},
}
);
console.log(["DELETE PROJECT MESSAGE", deleteProject]);
}
// COLLABORATION END
// VOTING START
for (let voting of checkUser?.Voting as any) {
for (let id of voting?.Voting_DaftarNamaVote as any) {
const deleteVotingListName =
await prisma.voting_DaftarNamaVote.findFirst({
where: {
id: id.id,
},
});
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
}
const deleteVoting = await prisma.voting.findFirst({
where: {
id: voting.id,
},
});
console.log(["DELETE VOTING", deleteVoting]);
}
// VOTING END
// JOB START
for (let job of checkUser?.Job as any) {
const deleteJob = await prisma.job.findFirst({
where: {
id: job.id,
},
});
console.log(["DELETE JOB", deleteJob]);
}
// JOB END
// 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) {
const deleteForum = await prisma.forum_ReportKomentar.findFirst({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM REPORT KOMENTAR", deleteForum]);
}
for (let forum of checkUser?.Forum_ReportPosting as any) {
const deleteForum = await prisma.forum_ReportPosting.findFirst({
where: {
id: forum.id,
},
});
console.log(["DELETE FORUM REPORT POSTING", deleteForum]);
}
// FORUM END
// INVESTASI START
for (let invoice of checkUser?.Investasi_Invoice as any) {
const deleteInvoice = await prisma.investasi_Invoice.findFirst({
where: {
id: invoice.id,
},
});
console.log(["DELETE INVOICE INVESTASI", deleteInvoice]);
}
for (let investasi of checkUser?.Investasi as any) {
for (let berita of investasi?.BeritaInvestasi as any) {
const deleteBerita = await prisma.beritaInvestasi.findFirst({
where: {
id: berita.id,
},
});
console.log(["DELETE BERITA INVESTASI", deleteBerita]);
}
for (let dokumen of investasi?.DokumenInvestasi as any) {
const deleteDokumen = await prisma.dokumenInvestasi.findFirst({
where: {
id: dokumen.id,
},
});
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
}
const deleteProspektus = await prisma.prospektusInvestasi.findFirst({
where: {
investasiId: investasi.id,
},
});
console.log(["DELETE PROSPEKTUS INVESTASI", deleteProspektus]);
const deleteInvestasi = await prisma.investasi.findFirst({
where: {
id: investasi.id,
},
});
console.log(["DELETE INVESTASI", deleteInvestasi]);
}
// INVESTASI END
// DONASI START
for (let donasi of checkUser?.Donasi_Invoice as any) {
const deleteInvoice = await prisma.donasi_Invoice.findFirst({
where: {
id: donasi.id,
},
});
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
}
for (let invoice of checkUser?.Donasi as any) {
for (let kabar of invoice?.Donasi_Kabar as any) {
const deleteKabar = await prisma.donasi_Kabar.findFirst({
where: {
id: kabar.id,
},
});
console.log(["DELETE KABAR DONASI", deleteKabar]);
}
for (let pencairanDana of invoice?.Donasi_PencairanDana as any) {
const deletePencairanDana = await prisma.donasi_PencairanDana.findFirst(
{
where: {
id: pencairanDana.id,
},
}
);
console.log(["DELETE PENCAIRAN DANA DONASI", deletePencairanDana]);
}
const deleteCerita = await prisma.donasi_Cerita.findFirst({
where: {
id: invoice.id,
},
});
console.log(["DELETE CERITA DONASI", deleteCerita]);
const deleteDonasi = await prisma.donasi.findFirst({
where: {
id: invoice.id,
},
});
console.log(["DELETE DONASI", deleteDonasi]);
}
// DONASI END
// PORTOFOLIO DELETE START
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
const deletePortofolio = await prisma.portofolio.findFirst({
where: {
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]);
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({
where: {
userId: id,
},
});
console.log(["DELETE PROFILE", deleteProfile]);
// PORTOFOLIO DELETE END
console.log("[END DELETE ALL >>>]");
return NextResponse.json(
{ success: true, message: "Berhasil menghapus data" },
{ status: 200 }
);
} catch (error) {
console.log(["ERROR DELETE ALL", error]);
return NextResponse.json(
{
success: false,
message: "Error delete data from API ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}