Compare commits

..

6 Commits

Author SHA1 Message Date
6f10ff7c3e API mobile forum
### No Issue
2025-11-26 16:16:08 +08:00
09be7739d5 Fix rejected Apple:
Penambahan fitur checklist terms of service dan penambahan database blockuser

Add:
- prisma/migrations/20251124061947_add_terms_of_service_accepted/
- prisma/migrations/20251124081155_add_blocked_user_and_menu_feature/
- prisma/migrations/20251124083155_fix_master_kategori_app_and_delete_menu_feature/
- public/terms-of-service.html
- src/app/api/auth/term-service/

Fix:
- prisma/schema.prisma
- src/app/api/auth/register/route.ts
- src/app/api/auth/validasi/route.ts
- src/app_modules/_global/fun/generate_seeder.ts
- src/bin/seeder/master/master_kategori_app.json
- src/bin/seeder/user_seeder.json
- src/middleware.tsx

### No Issue
2025-11-24 16:44:00 +08:00
38734cda8c chore(release): 1.5.17 2025-11-24 11:48:20 +08:00
fb9515dfe4 Fix: delete all data user
src/app/api/mobile/user/[id]/route.ts

### No Issue
2025-11-20 15:39:36 +08:00
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
19 changed files with 1167 additions and 73 deletions

View File

@@ -2,6 +2,15 @@
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.17](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.16...v1.5.17) (2025-11-24)
### Bug Fixes
* delete all data user ([fb9515d](https://wibugit.wibudev.com/wibu/hipmi/commit/fb9515dfe465ef07d43460ca4e9bb31705ec48b8))
## [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)

View File

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

View File

@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "Donasi_Invoice" ALTER COLUMN "masterBankId" SET DEFAULT 'null';
-- AlterTable
ALTER TABLE "User" ADD COLUMN "termsOfServiceAccepted" BOOLEAN NOT NULL DEFAULT false;

View File

@@ -0,0 +1,35 @@
-- CreateTable
CREATE TABLE "BlockedUser" (
"id" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"blockerId" TEXT NOT NULL,
"blockedId" TEXT NOT NULL,
"menuFeatureId" TEXT NOT NULL,
CONSTRAINT "BlockedUser_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MenuFeature" (
"id" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"name" TEXT NOT NULL,
CONSTRAINT "MenuFeature_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "BlockedUser_blockerId_blockedId_key" ON "BlockedUser"("blockerId", "blockedId");
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_menuFeatureId_fkey" FOREIGN KEY ("menuFeatureId") REFERENCES "MenuFeature"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_blockerId_fkey" FOREIGN KEY ("blockerId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_blockedId_fkey" FOREIGN KEY ("blockedId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,14 @@
/*
Warnings:
- You are about to drop the `MenuFeature` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "BlockedUser" DROP CONSTRAINT "BlockedUser_menuFeatureId_fkey";
-- DropTable
DROP TABLE "MenuFeature";
-- AddForeignKey
ALTER TABLE "BlockedUser" ADD CONSTRAINT "BlockedUser_menuFeatureId_fkey" FOREIGN KEY ("menuFeatureId") REFERENCES "MasterKategoriApp"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -49,8 +49,12 @@ model User {
BusinessMaps BusinessMaps[]
Investasi_Invoice Investasi_Invoice[]
EventSponsor EventSponsor[]
EventTransaksi EventTransaksi[]
EventSponsor EventSponsor[]
EventTransaksi EventTransaksi[]
termsOfServiceAccepted Boolean @default(false)
blockedUsers BlockedUser[] @relation("Blocking")
blockedBy BlockedUser[] @relation("BlockedBy")
}
model MasterUserRole {
@@ -1011,6 +1015,8 @@ model MasterKategoriApp {
updatedAt DateTime @updatedAt
name String
value String?
blockedUsers BlockedUser[]
}
// ======================= EVENT ======================= //
@@ -1073,3 +1079,20 @@ model Sticker {
MasterEmotions MasterEmotions[] @relation("StikerEmotions")
}
model BlockedUser {
id String @id @default(uuid())
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
blockerId String // ID user yang memblokir
blockedId String // ID user yang diblokir
menuFeatureId String
menuFeature MasterKategoriApp @relation(fields: [menuFeatureId], references: [id])
blocker User @relation("BlockedBy", fields: [blockerId], references: [id])
blocked User @relation("Blocking", fields: [blockedId], references: [id])
@@unique([blockerId, blockedId])
}

View File

@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Syarat & Ketentuan - HIPMI Badung Connect</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 40px auto;
padding: 0 20px;
}
h1, h2, h3 {
color: #1a365d;
}
ul {
padding-left: 20px;
}
footer {
margin-top: 40px;
font-size: 0.9em;
color: #666;
border-top: 1px solid #eee;
padding-top: 20px;
}
</style>
</head>
<body>
<h1>Syarat & Ketentuan Penggunaan HIPMI Badung Connect</h1>
<p>
Dengan menggunakan aplikasi <strong>HIPMI Badung Connect</strong> (“Aplikasi”), Anda setuju untuk mematuhi dan terikat oleh syarat dan ketentuan berikut. Jika Anda tidak setuju dengan ketentuan ini, harap jangan gunakan Aplikasi.
</p>
<h2>1. Definisi</h2>
<p>
<strong>HIPMI Badung Connect</strong> adalah platform digital resmi untuk anggota Himpunan Pengusaha Muda Indonesia (HIPMI) Kabupaten Badung, yang bertujuan memfasilitasi jaringan, kolaborasi, dan pertumbuhan bisnis para pengusaha muda.
</p>
<h2>2. Larangan Konten Tidak Pantas</h2>
<p>
Anda <strong>dilarang keras</strong> memposting, mengirim, membagikan, atau mengunggah konten apa pun yang mengandung:
</p>
<ul>
<li>Ujaran kebencian, diskriminasi, atau konten SARA (Suku, Agama, Ras, Antar-golongan)</li>
<li>Pornografi, konten seksual eksplisit, atau gambar tidak senonoh</li>
<li>Ancaman, pelecehan, bullying, atau perilaku melecehkan</li>
<li>Informasi palsu, hoaks, spam, atau konten menyesatkan</li>
<li>Konten ilegal, melanggar hukum, atau melanggar hak kekayaan intelektual pihak lain</li>
<li>Promosi narkoba, perjudian, atau aktivitas ilegal lainnya</li>
</ul>
<h2>3. Tanggung Jawab Pengguna</h2>
<p>
Anda bertanggung jawab penuh atas setiap konten yang Anda unggah atau bagikan melalui fitur-fitur berikut:
</p>
<ul>
<li>Profil (bio, foto, portofolio)</li>
<li>Forum diskusi</li>
<li>Chat pribadi atau grup</li>
<li>Lowongan kerja, investasi, dan donasi</li>
</ul>
<p>
Konten yang melanggar ketentuan ini dapat dihapus kapan saja tanpa pemberitahuan.
</p>
<h2>4. Tindakan terhadap Pelanggaran</h2>
<p>
Jika kami menerima laporan atau menemukan konten yang melanggar ketentuan ini, kami akan:
</p>
<ul>
<li>Segera menghapus konten tersebut</li>
<li>Memberikan peringatan atau memblokir akun pengguna</li>
<li>Dalam kasus berat, melaporkan ke pihak berwajib sesuai hukum yang berlaku</li>
</ul>
<p>
Tim kami berkomitmen untuk menanggapi laporan konten tidak pantas <strong>dalam waktu 24 jam</strong>.
</p>
<h2>5. Mekanisme Pelaporan</h2>
<p>
Anda dapat melaporkan konten atau pengguna yang mencurigakan melalui:
</p>
<ul>
<li>Tombol <strong>“Laporkan”</strong> di setiap posting forum atau pesan chat</li>
<li>Tombol <strong>“Blokir Pengguna”</strong> di profil pengguna</li>
</ul>
<p>
Setiap laporan akan ditangani secara rahasia dan segera.
</p>
<h2>6. Perubahan Ketentuan</h2>
<p>
Kami berhak memperbarui Syarat & Ketentuan ini sewaktu-waktu. Versi terbaru akan dipublikasikan di halaman ini dengan tanggal revisi yang diperbarui.
</p>
<h2>7. Kontak</h2>
<p>
Jika Anda memiliki pertanyaan tentang ketentuan ini, silakan hubungi kami di:
<strong>bip.baliinteraktifperkasa@gmail.com</strong>
</p>
<footer>
<p>© 2025 Bali Interaktif Perkasa. All rights reserved.</p>
</footer>
</body>
</html>

View File

@@ -14,6 +14,8 @@ export async function POST(req: Request) {
try {
const { data } = await req.json();
console.log("data >>", data);
const cekUsername = await prisma.user.findUnique({
where: {
username: data.username,
@@ -26,11 +28,20 @@ export async function POST(req: Request) {
message: "Username sudah digunakan",
});
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
const createUser = await prisma.user.create({
data: {
username: data.username,
nomor: data.nomor,
active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
},
});
@@ -51,7 +62,7 @@ export async function POST(req: Request) {
success: true,
message: "Registrasi Berhasil, Anda Sedang Login",
token: token,
// data: createUser,
// data: createUser,x
},
{ status: 201 }
);
@@ -65,7 +76,5 @@ export async function POST(req: Request) {
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}

View File

@@ -0,0 +1,29 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export async function POST(req: Request) {
try {
const { data } = await req.json();
console.log("data >>", data);
const updateTermService = await prisma.user.update({
where: {
id: data.id,
},
data: {
termsOfServiceAccepted: data.termsOfServiceAccepted,
},
});
return NextResponse.json({
success: true,
message: "Berhasil",
});
} catch (error) {
console.log("error >>", error);
return NextResponse.json({
success: false,
message: "Gagal",
});
}
}

View File

@@ -24,6 +24,7 @@ export async function POST(req: Request) {
username: true,
active: true,
masterUserRoleId: true,
termsOfServiceAccepted: true,
},
});
@@ -52,6 +53,7 @@ export async function POST(req: Request) {
message: "Berhasil Login",
roleId: dataUser.masterUserRoleId,
active: dataUser.active,
termsOfServiceAccepted: dataUser.termsOfServiceAccepted,
token: token,
},
{ status: 200 }
@@ -76,7 +78,5 @@ export async function POST(req: Request) {
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}

View File

@@ -0,0 +1,47 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { POST };
async function POST(request: Request) {
const { data } = await request.json();
console.log("data >>", data);
console.log("menuFeature masuk>>", data.menuFeature);
try {
const nameApp = _.lowerCase(data.menuFeature);
const menuFeature = await prisma.masterKategoriApp.findFirst({
where: { value: nameApp },
select: {
id: true,
},
});
console.log(" fix menuFeature >>", menuFeature);
const blockUser = await prisma.blockedUser.create({
data: {
blockerId: data.blockerId,
blockedId: data.blockedId,
menuFeatureId: menuFeature?.id as any,
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
// data: blockUser,
});
} catch (error) {
console.log("[ERROR BLOCK USER] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}

View File

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

View File

@@ -36,11 +36,109 @@ async function GET(request: Request) {
let fixData;
const { searchParams } = new URL(request.url);
const authorId = searchParams.get("authorId");
const userLoginId = searchParams.get("userLoginId");
const search = searchParams.get("search");
const category = searchParams.get("category");
const page = searchParams.get("page");
const takeData = 5;
const skipData = (Number(page) - 1) * takeData;
// console.log("authorId", authorId);
// console.log("userLoginId", userLoginId);
// console.log("search", search);
// console.log("category", category);
console.log("page", page);
try {
if (authorId) {
if (category === "beranda") {
const blockUserId = await prisma.blockedUser
.findMany({
where: {
blockerId: userLoginId as string,
},
select: {
blockedId: true,
},
})
.then((res) => {
return res.map((item) => item.blockedId);
});
console.log("blockUserId", blockUserId);
const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
where: {
isActive: true,
diskusi: {
mode: "insensitive",
contains: search || "",
},
authorId: {
notIn: blockUserId,
},
},
select: {
id: true,
diskusi: true,
createdAt: true,
isActive: true,
authorId: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
name: true,
imageId: true,
},
},
},
},
Forum_Komentar: {
where: {
isActive: true,
},
},
ForumMaster_StatusPosting: {
select: {
id: true,
status: true,
},
},
forumMaster_StatusPostingId: true,
},
});
const newData = data.map((item) => {
const count = item.Forum_Komentar?.length ?? 0;
return {
..._.omit(item, ["Forum_Komentar"]),
count,
};
});
fixData = newData;
} else if (category === "forumku") {
const count = await prisma.forum_Posting.count({
where: {
isActive: true,
authorId: authorId,
},
})
const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
createdAt: "desc",
},
@@ -90,62 +188,18 @@ async function GET(request: Request) {
};
});
fixData = newData;
const dataFix = {
data: newData,
count,
}
fixData = dataFix;
} else {
const data = await prisma.forum_Posting.findMany({
orderBy: {
createdAt: "desc",
},
where: {
isActive: true,
diskusi: {
mode: "insensitive",
contains: search || "",
},
},
select: {
id: true,
diskusi: true,
createdAt: true,
isActive: true,
authorId: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
id: true,
name: true,
imageId: true,
},
},
},
},
Forum_Komentar: {
where: {
isActive: true,
},
},
ForumMaster_StatusPosting: {
select: {
id: true,
status: true,
},
},
forumMaster_StatusPostingId: true,
},
return NextResponse.json({
success: false,
message: "Gagal mendapatkan data",
reason: "Kategori tidak ditemukan",
});
const newData = data.map((item) => {
const count = item.Forum_Komentar?.length ?? 0;
return {
..._.omit(item, ["Forum_Komentar"]),
count,
};
});
fixData = newData;
}
return NextResponse.json({
@@ -153,7 +207,6 @@ async function GET(request: Request) {
message: "Berhasil mendapatkan data",
data: fixData,
});
} catch (error) {
console.log("[ERROR]", error);
return NextResponse.json({

View File

@@ -0,0 +1,28 @@
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET };
async function GET(request: Request) {
try {
const data = await prisma.masterKategoriApp.findMany({
where: {
isActive: true,
},
});
return NextResponse.json({
status: 200,
success: true,
message: "success",
data: data,
});
} catch (error) {
console.log("[ERROR GET APP CATEGORY] >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "error",
reason: (error as Error).message || error,
});
}
}

View File

@@ -32,3 +32,717 @@ 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: {
// 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,
imageId: 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,
prospektusFileId: true,
imageId: true,
BeritaInvestasi: {
select: {
id: true,
imageId: true,
},
},
DokumenInvestasi: {
select: {
id: true,
fileId: true,
},
},
},
},
Investasi_Invoice: {
select: {
id: true,
imageId: true,
},
},
// INVITATION END
// DONATION START
Donasi: {
select: {
id: true,
imageId: true,
CeritaDonasi: {
select: {
id: true,
imageId: true,
},
},
Donasi_Kabar: {
select: {
id: true,
imageId: true,
},
},
Donasi_PencairanDana: {
select: {
id: true,
imageId: true,
},
},
},
},
Donasi_Invoice: {
select: {
id: true,
imageId: true,
},
},
// 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
for (let event of checkUser?.Event_Peserta as any) {
const deleteEvent = await prisma.event_Peserta.delete({
where: {
id: event.id,
},
select: {
Event: {
select: {
title: true,
},
},
},
});
console.log(["DELETE EVENT PESERTA", deleteEvent]);
}
for (let event of checkUser?.Event as any) {
const deleteEvent = await prisma.event.delete({
where: {
id: event.id,
},
});
console.log(["DELETE EVENT", deleteEvent]);
}
// EVENT DELETE END
// COLLABORATION START
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
const deleteProject =
await prisma.projectCollaboration_Partisipasi.delete({
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.delete({
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.delete({
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.delete({
where: {
id: project.id,
},
});
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
// 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 id of voting?.Voting_DaftarNamaVote as any) {
const deleteVotingListName = await prisma.voting_DaftarNamaVote.delete({
where: {
id: id.id,
},
});
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
}
const deleteVoting = await prisma.voting.delete({
where: {
id: voting.id,
},
});
console.log(["DELETE VOTING", deleteVoting]);
}
// VOTING END
// JOB START
for (let job of checkUser?.Job as any) {
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: {
id: job.id,
},
});
console.log(["DELETE JOB", deleteJob]);
}
// JOB END
// FORUM START
for (let forum of checkUser?.Forum_ReportKomentar as any) {
const deleteForum = await prisma.forum_ReportKomentar.delete({
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.delete({
where: {
id: forum.id,
},
});
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
// INVESTASI START
for (let invoice of checkUser?.Investasi_Invoice as any) {
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: {
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) {
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: {
id: berita.id,
},
});
console.log(["DELETE BERITA INVESTASI", deleteBerita]);
}
for (let dokumen of investasi?.DokumenInvestasi as any) {
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: {
id: dokumen.id,
},
});
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
}
if (investasi?.prospektusFileId) {
const deleteProspektusFile = await fetch(
`https://wibu-storage.wibudev.com/api/files/${investasi.prospektusFileId}/delete`,
{
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.WS_APIKEY}`,
},
}
);
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: {
id: investasi.id,
},
});
console.log(["DELETE INVESTASI", deleteInvestasi]);
}
// INVESTASI END
// DONASI START
for (let donasiInvoice of checkUser?.Donasi_Invoice as any) {
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: {
id: donasiInvoice.id,
},
});
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
}
for (let donasi of checkUser?.Donasi as any) {
for (let kabar of donasi?.Donasi_Kabar as any) {
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: {
id: kabar.id,
},
});
console.log(["DELETE KABAR DONASI", deleteKabar]);
}
for (let pencairanDana of donasi?.Donasi_PencairanDana as any) {
if (pencairanDana?.imageId) {
const deletePencairanDanaImage = await fetch(
`https://wibu-storage.wibudev.com/api/files/${pencairanDana.imageId}/delete`,
{
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]);
}
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: {
donasiId: donasi.id,
},
});
console.log(["DELETE CERITA DONASI", deleteCerita]);
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: {
id: donasi.id,
},
});
console.log(["DELETE DONASI", deleteDonasi]);
}
// DONASI END
// PORTOFOLIO DELETE START
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
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: {
id: portofolio.id,
},
});
console.log(["DELETE PORTOFOLIO", deletePortofolio]);
}
const deleteProfile = await prisma.profile.delete({
where: {
userId: id,
},
});
console.log(["DELETE PROFILE", deleteProfile]);
// PORTOFOLIO DELETE END
const deleteUser = await prisma.user.delete({
where: {
id: id,
},
});
console.log(["DELETE USER", deleteUser]);
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 }
);
}
}

View File

@@ -60,12 +60,14 @@ async function seederUser() {
username: i.name,
masterUserRoleId: i.masterUserRoleId,
active: i.active,
termsOfServiceAccepted: i.termsOfServiceAccepted,
},
update: {
nomor: i.nomor,
username: i.name,
masterUserRoleId: i.masterUserRoleId,
active: i.active,
termsOfServiceAccepted: i.termsOfServiceAccepted,
},
});
}
@@ -564,10 +566,12 @@ async function masterKategoriApp() {
create: {
id: a.id,
name: a.name,
value: a.value,
},
update: {
id: a.id,
name: a.name,
value: a.value,
},
});
}

View File

@@ -1,30 +1,37 @@
[
{
"id": "1",
"name": "Event"
"name": "Event",
"value": "event"
},
{
"id": "2",
"name": "Job"
"name": "Job",
"value": "job"
},
{
"id": "3",
"name": "Voting"
"name": "Voting",
"value": "voting"
},
{
"id": "4",
"name": "Donasi"
"name": "Donasi",
"value": "donasi"
},
{
"id": "5",
"name": "Investasi"
"name": "Investasi",
"value": "investasi"
},
{
"id": "6",
"name": "Forum"
"name": "Forum",
"value": "forum"
},
{
"id": "7",
"name": "Collaboration"
"name": "Collaboration",
"value": "collaboration"
}
]

View File

@@ -3,12 +3,14 @@
"name": "bagas_admin",
"nomor": "6282340374412",
"masterUserRoleId": "3",
"active": true
"active": true,
"termsOfServiceAccepted": true
},
{
"name": "fahmi_admin",
"nomor": "628123833845",
"masterUserRoleId": "2",
"active": true
"active": true,
"termsOfServiceAccepted": true
}
]

View File

@@ -19,6 +19,7 @@ const CONFIG: MiddlewareConfig = {
publicRoutes: [
"/",
"/.well-known/*",
"/terms-of-service.html",
"/privacy-policy.html",
"/api/helper/*",
"/api/not-user/*",