Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad91a48d82 | |||
| a06036cab7 | |||
| c3d8ccd490 | |||
| ba6a83f61d | |||
| dc05c4ef7e | |||
| d56a00a92b | |||
| 43deddca43 | |||
| 1e647c0391 | |||
| 6f10ff7c3e | |||
| 09be7739d5 | |||
| 94dc780ead | |||
| c710ca60b7 | |||
| 4164092100 | |||
| b118a6425c | |||
| 09e1f702e1 | |||
| ba5620bcc5 | |||
| 24e6fcd0f7 |
@@ -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.19](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.18...v1.5.19) (2025-12-01)
|
||||||
|
|
||||||
|
## [1.5.18](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.17...v1.5.18) (2025-11-28)
|
||||||
|
|
||||||
## [1.5.17](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.16...v1.5.17) (2025-11-24)
|
## [1.5.17](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.16...v1.5.17) (2025-11-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.5.17",
|
"version": "1.5.19",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "bun prisma/seed.ts"
|
"seed": "bun prisma/seed.ts"
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -49,8 +49,12 @@ model User {
|
|||||||
BusinessMaps BusinessMaps[]
|
BusinessMaps BusinessMaps[]
|
||||||
Investasi_Invoice Investasi_Invoice[]
|
Investasi_Invoice Investasi_Invoice[]
|
||||||
|
|
||||||
EventSponsor EventSponsor[]
|
EventSponsor EventSponsor[]
|
||||||
EventTransaksi EventTransaksi[]
|
EventTransaksi EventTransaksi[]
|
||||||
|
termsOfServiceAccepted Boolean @default(false)
|
||||||
|
|
||||||
|
blockedUsers BlockedUser[] @relation("Blocking")
|
||||||
|
blockedBy BlockedUser[] @relation("BlockedBy")
|
||||||
}
|
}
|
||||||
|
|
||||||
model MasterUserRole {
|
model MasterUserRole {
|
||||||
@@ -1011,6 +1015,8 @@ model MasterKategoriApp {
|
|||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
name String
|
name String
|
||||||
value String?
|
value String?
|
||||||
|
|
||||||
|
blockedUsers BlockedUser[]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======================= EVENT ======================= //
|
// ======================= EVENT ======================= //
|
||||||
@@ -1073,3 +1079,20 @@ model Sticker {
|
|||||||
|
|
||||||
MasterEmotions MasterEmotions[] @relation("StikerEmotions")
|
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])
|
||||||
|
}
|
||||||
|
|||||||
110
public/terms-of-service.html
Normal file
110
public/terms-of-service.html
Normal 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>
|
||||||
@@ -14,6 +14,8 @@ export async function POST(req: Request) {
|
|||||||
try {
|
try {
|
||||||
const { data } = await req.json();
|
const { data } = await req.json();
|
||||||
|
|
||||||
|
console.log("data >>", data);
|
||||||
|
|
||||||
const cekUsername = await prisma.user.findUnique({
|
const cekUsername = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
@@ -26,11 +28,20 @@ export async function POST(req: Request) {
|
|||||||
message: "Username sudah digunakan",
|
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({
|
const createUser = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
nomor: data.nomor,
|
nomor: data.nomor,
|
||||||
active: false,
|
active: false,
|
||||||
|
termsOfServiceAccepted: data.termsOfServiceAccepted,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -51,7 +62,7 @@ export async function POST(req: Request) {
|
|||||||
success: true,
|
success: true,
|
||||||
message: "Registrasi Berhasil, Anda Sedang Login",
|
message: "Registrasi Berhasil, Anda Sedang Login",
|
||||||
token: token,
|
token: token,
|
||||||
// data: createUser,
|
// data: createUser,x
|
||||||
},
|
},
|
||||||
{ status: 201 }
|
{ status: 201 }
|
||||||
);
|
);
|
||||||
@@ -65,7 +76,5 @@ export async function POST(req: Request) {
|
|||||||
},
|
},
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
} finally {
|
|
||||||
await prisma.$disconnect();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/app/api/auth/term-service/route.ts
Normal file
29
src/app/api/auth/term-service/route.ts
Normal 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",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ export async function POST(req: Request) {
|
|||||||
username: true,
|
username: true,
|
||||||
active: true,
|
active: true,
|
||||||
masterUserRoleId: true,
|
masterUserRoleId: true,
|
||||||
|
termsOfServiceAccepted: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ export async function POST(req: Request) {
|
|||||||
message: "Berhasil Login",
|
message: "Berhasil Login",
|
||||||
roleId: dataUser.masterUserRoleId,
|
roleId: dataUser.masterUserRoleId,
|
||||||
active: dataUser.active,
|
active: dataUser.active,
|
||||||
|
termsOfServiceAccepted: dataUser.termsOfServiceAccepted,
|
||||||
token: token,
|
token: token,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
@@ -76,7 +78,5 @@ export async function POST(req: Request) {
|
|||||||
},
|
},
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
} finally {
|
|
||||||
await prisma.$disconnect();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
78
src/app/api/mobile/block-user/[id]/route.tsx
Normal file
78
src/app/api/mobile/block-user/[id]/route.tsx
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import prisma from "@/lib/prisma";
|
||||||
|
|
||||||
|
export { GET, DELETE };
|
||||||
|
|
||||||
|
async function GET(request: Request, { params }: { params: { id: string } }) {
|
||||||
|
const { id } = params;
|
||||||
|
console.log("[ID] >>", id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await prisma.blockedUser.findUnique({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
blocked: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
imageId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
menuFeature: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 200,
|
||||||
|
success: true,
|
||||||
|
message: "success",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR GET BLOCK USER] >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 500,
|
||||||
|
success: false,
|
||||||
|
message: "error",
|
||||||
|
reason: (error as Error).message || error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function DELETE(request: Request, { params }: { params: { id: string } }) {
|
||||||
|
const { id } = params;
|
||||||
|
console.log("[ID] >>", id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await prisma.blockedUser.delete({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 200,
|
||||||
|
success: true,
|
||||||
|
message: "success",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR DELETE BLOCK USER] >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 500,
|
||||||
|
success: false,
|
||||||
|
message: "error",
|
||||||
|
reason: (error as Error).message || error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
109
src/app/api/mobile/block-user/route.ts
Normal file
109
src/app/api/mobile/block-user/route.ts
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import prisma from "@/lib/prisma";
|
||||||
|
|
||||||
|
export { POST, GET };
|
||||||
|
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GET(request: Request) {
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const id = searchParams.get("id");
|
||||||
|
const page = Number(searchParams.get("page"));
|
||||||
|
const search = searchParams.get("search");
|
||||||
|
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = page * takeData - takeData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await prisma.blockedUser.findMany({
|
||||||
|
take: page ? takeData : undefined,
|
||||||
|
skip: page ? skipData : undefined,
|
||||||
|
where: {
|
||||||
|
blockerId: id as any,
|
||||||
|
menuFeature: {
|
||||||
|
id: {
|
||||||
|
contains: search || "",
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
blocked: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
imageId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
menuFeature: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 200,
|
||||||
|
success: true,
|
||||||
|
message: "success",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR GET BLOCK USER] >>", error);
|
||||||
|
return NextResponse.json({
|
||||||
|
status: 500,
|
||||||
|
success: false,
|
||||||
|
message: "error",
|
||||||
|
reason: (error as Error).message || error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,11 +36,109 @@ async function GET(request: Request) {
|
|||||||
let fixData;
|
let fixData;
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const authorId = searchParams.get("authorId");
|
const authorId = searchParams.get("authorId");
|
||||||
|
const userLoginId = searchParams.get("userLoginId");
|
||||||
const search = searchParams.get("search");
|
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 {
|
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({
|
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: {
|
orderBy: {
|
||||||
createdAt: "desc",
|
createdAt: "desc",
|
||||||
},
|
},
|
||||||
@@ -90,62 +188,18 @@ async function GET(request: Request) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
fixData = newData;
|
const dataFix = {
|
||||||
|
data: newData,
|
||||||
|
count,
|
||||||
|
}
|
||||||
|
|
||||||
|
fixData = dataFix;
|
||||||
} else {
|
} else {
|
||||||
const data = await prisma.forum_Posting.findMany({
|
return NextResponse.json({
|
||||||
orderBy: {
|
success: false,
|
||||||
createdAt: "desc",
|
message: "Gagal mendapatkan data",
|
||||||
},
|
reason: "Kategori tidak ditemukan",
|
||||||
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,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const newData = data.map((item) => {
|
|
||||||
const count = item.Forum_Komentar?.length ?? 0;
|
|
||||||
return {
|
|
||||||
..._.omit(item, ["Forum_Komentar"]),
|
|
||||||
count,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
fixData = newData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
@@ -153,7 +207,6 @@ async function GET(request: Request) {
|
|||||||
message: "Berhasil mendapatkan data",
|
message: "Berhasil mendapatkan data",
|
||||||
data: fixData,
|
data: fixData,
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
|
|||||||
28
src/app/api/mobile/master/app-category/route.ts
Normal file
28
src/app/api/mobile/master/app-category/route.ts
Normal 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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -60,12 +60,14 @@ async function seederUser() {
|
|||||||
username: i.name,
|
username: i.name,
|
||||||
masterUserRoleId: i.masterUserRoleId,
|
masterUserRoleId: i.masterUserRoleId,
|
||||||
active: i.active,
|
active: i.active,
|
||||||
|
termsOfServiceAccepted: i.termsOfServiceAccepted,
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
nomor: i.nomor,
|
nomor: i.nomor,
|
||||||
username: i.name,
|
username: i.name,
|
||||||
masterUserRoleId: i.masterUserRoleId,
|
masterUserRoleId: i.masterUserRoleId,
|
||||||
active: i.active,
|
active: i.active,
|
||||||
|
termsOfServiceAccepted: i.termsOfServiceAccepted,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -564,10 +566,12 @@ async function masterKategoriApp() {
|
|||||||
create: {
|
create: {
|
||||||
id: a.id,
|
id: a.id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
|
value: a.value,
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
id: a.id,
|
id: a.id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
|
value: a.value,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,37 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Event"
|
"name": "Event",
|
||||||
|
"value": "event"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "2",
|
||||||
"name": "Job"
|
"name": "Job",
|
||||||
|
"value": "job"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "3",
|
"id": "3",
|
||||||
"name": "Voting"
|
"name": "Voting",
|
||||||
|
"value": "voting"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "4",
|
"id": "4",
|
||||||
"name": "Donasi"
|
"name": "Donasi",
|
||||||
|
"value": "donasi"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "5",
|
"id": "5",
|
||||||
"name": "Investasi"
|
"name": "Investasi",
|
||||||
|
"value": "investasi"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "6",
|
"id": "6",
|
||||||
"name": "Forum"
|
"name": "Forum",
|
||||||
|
"value": "forum"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "7",
|
"id": "7",
|
||||||
"name": "Collaboration"
|
"name": "Collaboration",
|
||||||
|
"value": "collaboration"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "bagas_admin",
|
"name": "default_user",
|
||||||
"nomor": "6282340374412",
|
"nomor": "6282340374412",
|
||||||
|
"masterUserRoleId": "1",
|
||||||
|
"active": true,
|
||||||
|
"termsOfServiceAccepted": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin_911",
|
||||||
|
"nomor": "6281339158911",
|
||||||
"masterUserRoleId": "3",
|
"masterUserRoleId": "3",
|
||||||
"active": true
|
"active": true,
|
||||||
|
"termsOfServiceAccepted": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fahmi_admin",
|
"name": "fahmi_admin",
|
||||||
"nomor": "628123833845",
|
"nomor": "628123833845",
|
||||||
"masterUserRoleId": "2",
|
"masterUserRoleId": "2",
|
||||||
"active": true
|
"active": true,
|
||||||
|
"termsOfServiceAccepted": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const CONFIG: MiddlewareConfig = {
|
|||||||
publicRoutes: [
|
publicRoutes: [
|
||||||
"/",
|
"/",
|
||||||
"/.well-known/*",
|
"/.well-known/*",
|
||||||
|
"/terms-of-service.html",
|
||||||
"/privacy-policy.html",
|
"/privacy-policy.html",
|
||||||
"/api/helper/*",
|
"/api/helper/*",
|
||||||
"/api/not-user/*",
|
"/api/not-user/*",
|
||||||
|
|||||||
Reference in New Issue
Block a user