Compare commits

..

12 Commits

Author SHA1 Message Date
dc05c4ef7e Push Staging
### No Issue
2025-11-28 11:20:42 +08:00
d56a00a92b Merge pull request 'Penambahan fitur open blockir' (#17) from apple-reject/28-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/17
2025-11-28 10:49:04 +08:00
43deddca43 Penambahan fitur open blockir
Add:
- src/app/api/mobile/block-user/[id]/

Fix:
-src/app/api/mobile/block-user/route.ts

### No Issue
2025-11-28 10:48:18 +08:00
1e647c0391 Merge pull request 'Fix Apple Rejected' (#16) from fix-mobile/26-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/16
2025-11-27 12:18:18 +08:00
6f10ff7c3e API mobile forum
### No Issue
2025-11-26 16:16:08 +08:00
94dc780ead 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
2025-11-20 15:40:50 +08:00
c710ca60b7 Merge pull request 'Route: Delete Account' (#14) from fix-mobile/19-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/14
2025-11-19 17:49:17 +08:00
4164092100 Merge pull request 'Delete Account & Support Center fix' (#13) from fix-mobile/18-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/13
2025-11-18 14:04:14 +08:00
b118a6425c Merge pull request 'Fix Apple Rejected' (#12) from fix-mobile/17-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/12
2025-11-17 17:48:05 +08:00
09e1f702e1 Merge pull request 'fix-mobile/17-nov-25' (#11) from fix-mobile/17-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/11
2025-11-17 11:30:49 +08:00
ba5620bcc5 Merge pull request 'QRCode Mobile' (#10) from mobile-qrcode/13-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/10
2025-11-13 17:14:03 +08:00
24e6fcd0f7 Merge pull request 'Penambahan akses untuk metode scan QRCode:' (#9) from mobile-access/12-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/9
2025-11-12 16:38:49 +08:00
5 changed files with 340 additions and 59 deletions

View 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,
});
}
}

View File

@@ -0,0 +1,115 @@
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;
// console.log("[BLOCKED ID]", id);
// console.log("[PAGE]", page);
// console.log("[TAKE DATA]", takeData);
// console.log("[SKIP DATA]", skipData);
// console.log("[SEARCH]", search);
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,
});
}
}

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

@@ -1,16 +1,23 @@
[
{
"name": "bagas_admin",
"name": "default_user",
"nomor": "6282340374412",
"masterUserRoleId": "1",
"active": true,
"termsOfServiceAccepted": false
},
{
"name": "admin_911",
"nomor": "6281339158911",
"masterUserRoleId": "3",
"active": true,
"termsOfServiceAccepted": true
"termsOfServiceAccepted": false
},
{
"name": "fahmi_admin",
"nomor": "628123833845",
"masterUserRoleId": "2",
"active": true,
"termsOfServiceAccepted": true
"termsOfServiceAccepted": false
}
]