Compare commits

...

9 Commits

Author SHA1 Message Date
f06482a159 fix version 2025-12-10 17:31:23 +08:00
7ab25655f2 chore(release): 1.5.26 2025-12-10 17:30:39 +08:00
9d17b442e2 Fix api APP Informastion untuk QC ( Ayu )
Fix:
- modified:   src/app/api/mobile/admin/master/business-field/[id]/route.ts
- modified:   src/app/api/mobile/admin/master/business-field/route.ts

### No Issue
2025-12-10 17:28:59 +08:00
b3410a5804 Fix API Mobile for QC: Ayu
Fix:
- modified:   src/app/api/mobile/admin/forum/route.ts

### No Issue
2025-12-09 17:38:25 +08:00
2cdc57d844 chore(release): 1.5.25 2025-12-09 17:33:33 +08:00
695046583f Fix API untuk QC: Ayu
Fix:
- modified:   src/app/api/mobile/admin/collaboration/[id]/route.ts
- modified:   src/app/api/mobile/collaboration/route.ts
- modified:   src/app/api/mobile/voting/route.ts

### No Issue
2025-12-09 14:31:02 +08:00
6ee0b98f07 Fix Apple Reject
Add:
- prisma/migrations/20251208042529_add_accepted_terms_at/
- prisma/schema.prisma.backup
- src/app/api/mobile/user/[id]/terms-of-app/

Fix:

prisma/schema.prisma
src/app/api/auth/mobile-register/route.ts
src/app/api/mobile/forum/[id]/report-commentar/route.ts
src/app/api/mobile/forum/[id]/report-posting/route.ts

### No Issue
2025-12-08 15:29:12 +08:00
cc78d82ca4 chore(release): 1.5.24 2025-12-08 15:23:52 +08:00
3c2a8b3543 Fix QC Admin ( Inno )
- app.config.js
- app/(application)/(user)/forum/[id]/edit.tsx
- app/(application)/(user)/forum/[id]/index.tsx
- app/(application)/(user)/forum/create.tsx
- ios/HIPMIBadungConnect/Info.plist

### No Issue
2025-12-05 17:12:15 +08:00
19 changed files with 1516 additions and 40 deletions

View File

@@ -2,6 +2,12 @@
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.26](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.25...v1.5.26) (2025-12-10)
## [1.5.25](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.24...v1.5.25) (2025-12-09)
## [1.5.24](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.22...v1.5.24) (2025-12-08)
## [1.5.22](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.21...v1.5.22) (2025-12-03)
## [1.5.21](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.20...v1.5.21) (2025-12-03)

View File

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

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "acceptedForumTermsAt" TIMESTAMP(3),
ADD COLUMN "acceptedTermsAt" TIMESTAMP(3);

View File

@@ -55,6 +55,9 @@ model User {
blockedUsers BlockedUser[] @relation("Blocking")
blockedBy BlockedUser[] @relation("BlockedBy")
acceptedTermsAt DateTime?
acceptedForumTermsAt DateTime?
}
model MasterUserRole {

1098
prisma/schema.prisma.backup Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,7 @@ export async function POST(req: Request) {
nomor: data.nomor,
active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
acceptedTermsAt: new Date(),
},
});

View File

@@ -78,6 +78,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
select: {
User: {
select: {
nomor: true,
username: true,
id: true,
Profile: {

View File

@@ -1,5 +1,6 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
export { GET };
@@ -12,7 +13,6 @@ async function GET(request: Request) {
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
let fixData;
try {
if (category === "dashboard") {

View File

@@ -29,6 +29,11 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
},
},
},
Event: {
select: {
tanggal: true,
},
},
},
});

View File

@@ -153,6 +153,7 @@ async function GET(request: Request) {
select: {
id: true,
title: true,
tanggal: true,
Author: {
select: {
id: true,

View File

@@ -1,5 +1,6 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import _ from "lodash";
export { GET };
@@ -51,7 +52,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
reportComment,
};
} else if (category === "posting") {
fixData = await prisma.forum_Posting.findMany({
const data = await prisma.forum_Posting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
@@ -75,10 +76,24 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
Profile: true,
},
},
_count: {
select: {
Forum_ReportPosting: true,
Forum_Komentar: true,
},
},
},
});
fixData = data.map((item) => ({
..._.omit(item, "_count"),
reportPosting: item._count.Forum_ReportPosting,
komentar: item._count.Forum_Komentar,
}));
console.log("fixData >>", fixData);
} else if (category === "report_posting") {
fixData = await prisma.forum_ReportPosting.findMany({
const data = await prisma.forum_ReportPosting.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
@@ -123,8 +138,25 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
},
},
});
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
const key = item.Forum_Posting?.id;
if (!key) return acc;
if (
!acc[key] ||
new Date(item.createdAt) > new Date(acc[key].createdAt)
) {
acc[key] = item;
}
return acc;
}, {})
);
fixData = filterLatest(data);
} else if (category === "report_comment") {
fixData = await prisma.forum_ReportKomentar.findMany({
const data = await prisma.forum_ReportKomentar.findMany({
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
orderBy: {
@@ -160,6 +192,23 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
},
},
});
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
const key = item.Forum_Komentar?.id;
if (!key) return acc;
if (
!acc[key] ||
new Date(item.createdAt) > new Date(acc[key].createdAt)
) {
acc[key] = item;
}
return acc;
}, {})
);
fixData = filterLatest(data);
} else {
return NextResponse.json(
{
@@ -171,7 +220,6 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
);
}
return NextResponse.json(
{
success: true,

View File

@@ -4,19 +4,55 @@ import { prisma } from "@/lib";
export { GET, PUT };
async function GET(request: Request, { params }: { params: { id: string } }) {
let fixData;
try {
const { id } = params;
const data = await prisma.masterBidangBisnis.findUnique({
where: {
id: id,
},
});
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
const subBidangId = searchParams.get("subBidangId");
if (category === "all") {
const bidang = await prisma.masterBidangBisnis.findUnique({
where: {
id: id,
},
});
const subBidang = await prisma.masterSubBidangBisnis.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterBidangBisnisId: id,
},
});
fixData = {
bidang,
subBidang,
};
} else if (category === "bidang") {
const bidang = await prisma.masterBidangBisnis.findUnique({
where: {
id: id,
},
});
fixData = bidang;
} else if (category === "sub-bidang") {
const subBidang = await prisma.masterSubBidangBisnis.findUnique({
where: {
id: subBidangId as any,
},
});
fixData = subBidang;
}
return NextResponse.json({
status: 200,
success: true,
message: "Berhasil mendapatkan data",
data: data,
data: fixData,
});
} catch (error) {
console.error("Error Get Master Bank >>", error);
@@ -32,17 +68,34 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
async function PUT(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { data } = await request.json();
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
console.log("category", category);
console.log("data", data);
try {
const updateData = await prisma.masterBidangBisnis.update({
where: {
id: id,
},
data: {
name: data.name,
active: data.active,
},
});
if (category === "bidang") {
const updateData = await prisma.masterBidangBisnis.update({
where: {
id: id,
},
data: {
name: data.name,
active: data.active,
},
});
} else if (category === "sub-bidang") {
const updateData = await prisma.masterSubBidangBisnis.update({
where: {
id: id,
},
data: {
name: data.name,
isActive: data.isActive,
},
});
}
return NextResponse.json({
status: 200,

View File

@@ -1,5 +1,7 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import _ from "lodash";
import { Prisma } from "@prisma/client";
export { GET, POST };
@@ -31,35 +33,186 @@ async function GET(request: Request) {
}
}
type BidangInput = {
name: string;
};
type SubBidangInput = {
name: string;
};
type RequestBody = {
data: {
bidang: BidangInput;
subBidang: SubBidangInput[];
};
};
/* ---------------------------
POST handler
- body: { bidang: { name }, subBidang: [{ name }, ...] }
- buat masterBidangBisnis (id incremental dari count + 1)
- generate id untuk tiap subBidang, cek unik, dan createMany via transaction
--------------------------- */
async function POST(request: Request) {
const { data } = await request.json();
try {
const count = await prisma.masterBidangBisnis.count();
const createNewId = count + 1;
const { data } = (await request.json()) as RequestBody;
const slugName = data.name.toLowerCase().replace(/\s+/g, "_");
if (!data.bidang.name || !Array.isArray(data.subBidang)) {
return NextResponse.json(
{
status: 400,
success: false,
message:
"Invalid payload. Expect { bidang: { name }, subBidang: [] }",
},
{ status: 400 }
);
}
const create = await prisma.masterBidangBisnis.create({
data: {
id: createNewId.toString(),
name: data.name,
slug: slugName,
},
// run in transaction to avoid race conditions
const result = await prisma.$transaction(async (tx) => {
// ambil last id numerik dengan cast (Postgres)
const rows = await tx.$queryRaw<{ id: string }[]>`
SELECT id FROM "MasterBidangBisnis" ORDER BY (id::int) DESC LIMIT 1;
`;
const lastId = rows[0]?.id ?? null;
const bidangId = lastId ? String(Number(lastId) + 1) : "1";
const slugName = data.bidang.name.toLowerCase().replace(/\s+/g, "_");
const createdBidang = await tx.masterBidangBisnis.create({
data: {
id: bidangId,
name: data.bidang.name,
slug: slugName,
},
});
// 2) hitung existing sub bidang untuk bidang ini
const existingSubCount = await tx.masterSubBidangBisnis.count({
where: { masterBidangBisnisId: createdBidang.id },
});
// 3) generate unique ids satu-per-satu (cek ke DB via tx)
const subBidangToCreate: {
id: string;
name: string;
masterBidangBisnisId: string;
}[] = [];
for (let i = 0; i < data.subBidang.length; i++) {
const seqNumber = existingSubCount + i + 1; // 1-based
const uniqueId = await generateUniqueSubBidangId(
data.bidang.name,
seqNumber,
tx
);
// push object to array
subBidangToCreate.push({
id: uniqueId,
name: data.subBidang[i].name,
masterBidangBisnisId: createdBidang.id,
});
}
// 4) createMany (batched) -- note: createMany doesn't return created rows
if (subBidangToCreate.length > 0) {
await tx.masterSubBidangBisnis.createMany({
data: subBidangToCreate,
skipDuplicates: false, // kita sudah memastikan unik, so false
});
}
return { createdBidang, subBidang: subBidangToCreate };
});
return NextResponse.json({
status: 200,
success: true,
message: "Berhasil menambahkan data",
data: create,
message: "Berhasil menambahkan bidang dan sub bidang",
data: result,
});
} catch (error) {
console.error("Error Post Master Business Field >>", error);
return NextResponse.json({
status: 500,
success: false,
message: "API Error Post Data",
reason: (error as Error).message,
});
const msg = error instanceof Error ? error.message : String(error);
return NextResponse.json(
{
status: 500,
success: false,
message: "API Error Post Data",
reason: msg,
},
{ status: 500 }
);
}
}
/* ---------------------------
Helper: generate base code
- mengabaikan stop words: 'dan', 'atau', '&'
- ambil dua kata pertama yang tersisa
- ambil 3 huruf pertama tiap kata (jika ada)
--------------------------- */
function generateBaseCode(name: string) {
const stopWords = new Set(["dan", "atau", "&"]);
// keep only letters and spaces, normalize spaces
const cleaned = name
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "") // remove diacritics
.replace(/[^a-zA-Z\s&]/g, " ")
.replace(/\s+/g, " ")
.trim()
.toLowerCase();
const words = cleaned
.split(" ")
.filter((w) => w.length > 0 && !stopWords.has(w));
const primary = (words[0] ?? "xxx").substring(0, 3).toUpperCase();
const secondary = words[1] ? words[1].substring(0, 3).toUpperCase() : "";
return { primary, secondary };
}
function padNumber(n: number) {
return String(n).padStart(2, "0");
}
/* ---------------------------
generateUniqueSubBidangId
- cek urutan strategi:
1) PRIMARY-<NN>
2) PRIMARY-SECONDARY-<NN> (jika secondary ada)
3) PRIMARYSECONDARY-<NN> (jika secondary ada)
4) fallback: PRIMARY + last4Timestamp -<NN>
- menggunakan tx (Prisma.TransactionClient) untuk cek di DB
--------------------------- */
async function generateUniqueSubBidangId(
bidangName: string,
number: number,
tx: Prisma.TransactionClient
): Promise<string> {
const { primary, secondary } = generateBaseCode(bidangName);
const num = padNumber(number);
const candidates: string[] = [];
candidates.push(`${primary}-${num}`);
if (secondary) candidates.push(`${primary}-${secondary}-${num}`);
if (secondary) candidates.push(`${primary}${secondary}-${num}`);
// final fallback
candidates.push(`${primary}${String(Date.now()).slice(-4)}-${num}`);
for (const id of candidates) {
// findUnique requires unique field; assuming `id` is the PK/unique
const found = await tx.masterSubBidangBisnis.findUnique({
where: { id },
select: { id: true },
});
if (!found) return id;
}
// theoretically unreachable, but return a final deterministic fallback
return `${primary}-${String(Math.floor(Math.random() * 9000) + 1000)}-${num}`;
}

View File

@@ -113,6 +113,7 @@ async function GET(request: Request) {
Author: {
select: {
id: true,
username: true,
Profile: true,
},
},
@@ -141,6 +142,7 @@ async function GET(request: Request) {
Author: {
select: {
id: true,
username: true,
Profile: true,
},
},

View File

@@ -11,6 +11,24 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
console.log("[ID]", id);
try {
const content = await prisma.forum_Komentar.findUnique({
where: {
id: id,
},
});
const reportList = await prisma.forumMaster_KategoriReport.findUnique({
where: {
id: data.categoryId,
},
});
const msg = `Report Komentar: "${content?.komentar}" dengan kategori \n\n\n${reportList?.title} : \n\n${reportList?.deskripsi}`;
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);
if (data.categoryId) {
fixData = await prisma.forum_ReportKomentar.create({
data: {

View File

@@ -11,6 +11,18 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
console.log("[ID]", id);
try {
const content = await prisma.forum_Posting.findUnique({
where: {
id: id,
},
});
const msg = `Report Postingan: "${content?.diskusi}"`;
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);
if (data.categoryId) {
fixData = await prisma.forum_ReportPosting.create({
data: {

View File

@@ -0,0 +1,68 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { POST };
async function POST(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
console.log("[ID USER", id);
console.log("[SEARCH PARAMS", category);
try {
const user = await prisma.user.findUnique({
where: {
id: id,
},
});
if (!user) {
return NextResponse.json(
{
success: false,
message: "User not found",
},
{ status: 404 }
);
}
const updateUser = await prisma.user.update({
where: {
id: id,
},
data: {
acceptedForumTermsAt: new Date(),
},
});
if (!updateUser) {
return NextResponse.json(
{
success: false,
message: "Gagal mengupdate data",
},
{ status: 400 }
);
}
return NextResponse.json(
{
success: true,
message: "Syarat dan Ketentuan berhasil diterima",
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error update data from API ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -123,6 +123,10 @@ async function GET(request: Request) {
},
},
});
fixData = data;
} else if (category === "contribution") {
const data = await prisma.voting_Kontributor.findMany({
orderBy: {

View File

@@ -23,6 +23,6 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app_modules/investasi/proses_transaksi/view.jsx", "src/app/api/investasi/midtrans/[id]/route.ts", "src/app_modules/job/create/TextEdit.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app_modules/investasi/proses_transaksi/view.jsx", "src/app/api/investasi/midtrans/[id]/route.ts", "src/app_modules/job/create/TextEdit.tsx", "src/app/api/mobile/forum/[id]/report-comment/route.ts"],
"exclude": ["node_modules"]
}