Compare commits

...

9 Commits

Author SHA1 Message Date
714cf5cd5a chore(release): 1.6.2 2026-02-25 15:22:40 +08:00
a68343599d Fix type env
Fix:
- modified:   types/env.d.ts

### No Issue
2026-02-25 14:25:13 +08:00
419b87fc92 chore(release): 1.6.1 2026-02-25 12:00:20 +08:00
0271c87ba9 Delete termsOfServiceAccepted on register
### No issue
2026-02-24 18:04:05 +08:00
5551f30721 Fix API and clear code
modified:   src/app/api/auth/register/route.ts
 modified:   src/app_modules/auth/login/view.tsx

### No Issue
2026-02-24 07:38:44 +08:00
00d36454d1 chore(release): 1.6.0 2026-02-24 07:33:28 +08:00
a762fbe9b1 Fix Api Mobile
API – Admin Forum
- src/app/api/mobile/admin/forum/route.ts
- src/app/api/mobile/admin/forum/[id]/comment/route.ts
- src/app/api/mobile/admin/forum/[id]/report-posting/route.ts

Docs
- PROMPT-AI.md

### No Issue
2026-02-20 16:47:28 +08:00
a98ab18423 Fix API Mobile
API – Admin Forum & Investment
- src/app/api/mobile/admin/forum/route.ts
- src/app/api/mobile/admin/investment/route.ts
- src/app/api/mobile/admin/investment/[id]/investor/route.ts

Docs
- PROMPT-AI.md

### No Issue
2026-02-19 16:44:17 +08:00
1c227a2850 Fix Admin API Mobile
API – Admin Donation
- src/app/api/mobile/admin/donation/[id]/disbursement/route.ts
- src/app/api/mobile/admin/donation/[id]/donatur/route.ts
- src/app/api/mobile/admin/donation/route.ts

API – Master Data (Admin)
- src/app/api/mobile/admin/master/donation/route.ts
- src/app/api/mobile/admin/master/type-of-event/route.ts

API – Admin Voting
- src/app/api/mobile/admin/voting/route.ts

Docs
- PROMPT-AI.md
- QWEN.md

Deleted
- CHANGELOG_BRANCH.md

### No Issue
2026-02-18 17:22:54 +08:00
19 changed files with 131 additions and 124 deletions

View File

@@ -2,6 +2,19 @@
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.6.2](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.1...v1.6.2) (2026-02-25)
## [1.6.1](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.0...v1.6.1) (2026-02-25)
## [1.6.0](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.40...v1.6.0) (2026-02-23)
### Features
* Implementasi pagination pada endpoint mobile donation ([e89886e](https://wibugit.wibudev.com/wibu/hipmi/commit/e89886e1dbc8cb4d95e6cc7c2787fb22a1dcaf56))
* Tambahkan pagination pada API mobile investasi ([a7694bd](https://wibugit.wibudev.com/wibu/hipmi/commit/a7694bd7d5d72b6499443faf99301faca730d3ed))
* update mobile donation API and related dependencies ([934d6a3](https://wibugit.wibudev.com/wibu/hipmi/commit/934d6a3ef1015367bee85779796df4f11c5e779c))
## [1.5.40](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.39...v1.5.40) (2026-02-06)
## [1.5.39](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.38...v1.5.39) (2026-01-30)

View File

@@ -1,63 +0,0 @@
# Changelog for Branch: fixed-bug/12-feb-26
## Summary
This branch contains several bug fixes and performance improvements, primarily focusing on:
- Database connection management
- MQTT client stability
- Logging optimization
- API enhancements
## Detailed Changes
### Fixed Issues
1. **Database Connection Management**
- Removed `prisma.$disconnect()` from user-validate API route to prevent connection pool exhaustion
- Added proper connection handling in global Prisma setup
- Reduced logging verbosity in production environments
2. **MQTT Client Improvements**
- Enhanced MQTT client initialization with proper error handling
- Added reconnection logic with configurable intervals
- Implemented cleanup functions to prevent memory leaks
- Added separate initialization logic for server and client-side code
3. **Logging Optimization**
- Removed excessive logging in middleware that was causing high CPU usage
- Configured appropriate log levels for development and production
4. **Component Stability**
- Added safety checks in text editor component to prevent MQTT operations on the server side
- Improved MQTT publishing logic with client availability checks
### New Files
- `src/lib/prismaUtils.ts` - Utility functions for safe database operations
### Modified Files
1. `src/app/api/user-validate/route.ts`
- Removed problematic `prisma.$disconnect()` call
2. `src/lib/prisma.ts`
- Configured different logging levels for dev/prod
- Removed process listeners that were causing disconnections
- Exported prisma instance separately
3. `src/middleware.tsx`
- Removed excessive logging statements
4. `src/util/mqtt_client.ts`
- Enhanced initialization with error handling
- Added reconnection and timeout configurations
5. `src/util/mqtt_loader.tsx`
- Added proper cleanup functions
- Improved connection handling
6. `src/app_modules/_global/component/new/comp_V3_text_editor_stiker.tsx`
- Added MQTT client availability checks
- Prevented server-side MQTT operations
### Performance Improvements
- Reduced database connection overhead
- Optimized MQTT connection handling
- Eliminated unnecessary logging in production
- Better memory management with proper cleanup functions

View File

@@ -1,5 +1,5 @@
File utama: src/app/api/mobile/admin/event/[id]/participants/route.ts
File utama: src/app/api/mobile/admin/forum/[id]/comment/route.ts
Terapkan pagination pada file "File utama" pada method GET
Analisa juga file "File utama", jika belum memiliki page dari seachParams maka terapkan. Juga pastikan take dan skip sudah sesuai dengan pagination. Buat default nya menjadi 10 untuk take data

View File

@@ -198,4 +198,4 @@ References: #issue-number
### Data Protection
- Encrypted tokens
- Secure API routes
- Proper CORS configuration
- Proper CORS configuration

View File

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

View File

@@ -14,8 +14,6 @@ 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,
@@ -29,12 +27,12 @@ export async function POST(req: Request) {
});
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
// 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: {

View File

@@ -10,6 +10,7 @@ import {
NotificationMobileTitleType,
} from "../../../../../../../../types/type-mobile-notification";
import { routeUserMobile } from "@/lib/mobile/route-page-mobile";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { POST, GET };
@@ -154,7 +155,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
const page = searchParams.get("page");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
@@ -174,6 +175,7 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
id: true,
createdAt: true,
nominalCair: true,
title: true,
},
});
} else if (category === "get-one") {

View File

@@ -1,6 +1,7 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET };
@@ -9,7 +10,7 @@ async function GET(req: Request, { params }: { params: { id: string } }) {
const { searchParams } = new URL(req.url);
const page = searchParams.get("page");
const status = searchParams.get("status");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
const fixStatus = _.startCase(status || "");

View File

@@ -1,6 +1,7 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET };
@@ -9,11 +10,10 @@ async function GET(request: Request) {
const category = searchParams.get("category");
const page = searchParams.get("page");
const search = searchParams.get("search");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
let fixData;
try {
if (category === "dashboard") {
const publish = await prisma.donasi.count({
@@ -48,7 +48,7 @@ async function GET(request: Request) {
where: {
active: true,
},
}
},
);
const categoryDonation = countCategoryDonation.length;
@@ -68,7 +68,6 @@ async function GET(request: Request) {
},
});
console.log("[STATUS]", checkStatus);
if (!checkStatus) {
return NextResponse.json(
@@ -77,7 +76,7 @@ async function GET(request: Request) {
message: "Failed to get data donation",
reason: "Status not found",
},
{ status: 500 }
{ status: 500 },
);
}
@@ -100,6 +99,12 @@ async function GET(request: Request) {
select: {
id: true,
title: true,
target: true,
DonasiMaster_Durasi: {
select: {
name: true,
},
},
Author: {
select: {
id: true,
@@ -109,7 +114,6 @@ async function GET(request: Request) {
},
});
console.log("[LIST]", fixData);
}
return NextResponse.json(
@@ -118,7 +122,7 @@ async function GET(request: Request) {
message: `Success get data donation ${category}`,
data: fixData,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
console.error("Error get data donation:", error);
@@ -128,7 +132,7 @@ async function GET(request: Request) {
message: "Failed to get data donation",
reason: (error as Error).message,
},
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -7,6 +7,7 @@ import {
NotificationMobileTitleType,
} from "../../../../../../../../types/type-mobile-notification";
import { routeUserMobile } from "@/lib/mobile/route-page-mobile";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET, PUT };
@@ -14,9 +15,9 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
const page = Number(searchParams.get("page"));
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = page * takeData - takeData;
const category = searchParams.get("category");
let fixData;
try {

View File

@@ -1,15 +1,16 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export async function GET(
request: Request,
{ params }: { params: { id: string } }
{ params }: { params: { id: string } },
) {
const { id } = params;
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
let fixData;
@@ -60,7 +61,7 @@ export async function GET(
message: "Success get list report posting",
data: fixData,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
console.error("[ERROR GET LIST REPORT POSTING]", error);
@@ -70,7 +71,7 @@ export async function GET(
message: "Error get list report posting",
reason: (error as Error).message,
},
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -1,6 +1,7 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import _ from "lodash";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET };
@@ -9,7 +10,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
const category = searchParams.get("category");
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
let fixData;
@@ -79,7 +80,11 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
_count: {
select: {
Forum_ReportPosting: true,
Forum_Komentar: true,
Forum_Komentar: {
where: {
isActive: true,
},
},
},
},
},
@@ -139,6 +144,14 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
},
});
// Hitung count report untuk setiap Forum_Posting id
const countByPostingId = data.reduce((acc: any, item: any) => {
const key = item.Forum_Posting?.id;
if (!key) return acc;
acc[key] = (acc[key] || 0) + 1;
return acc;
}, {});
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
@@ -151,10 +164,16 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
acc[key] = item;
}
return acc;
}, {})
}, {}),
);
fixData = filterLatest(data);
const filteredData = filterLatest(data);
// Tambahkan count ke setiap item
fixData = filteredData.map((item: any) => ({
...item,
count: countByPostingId[item.Forum_Posting?.id] || 0,
}));
} else if (category === "report_comment") {
const data = await prisma.forum_ReportKomentar.findMany({
take: page ? takeData : undefined,
@@ -193,6 +212,14 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
},
});
// Hitung count report untuk setiap Forum_Komentar id
const countByKomentarId = data.reduce((acc: any, item: any) => {
const key = item.Forum_Komentar?.id;
if (!key) return acc;
acc[key] = (acc[key] || 0) + 1;
return acc;
}, {});
const filterLatest = (data: any) =>
Object.values(
data.reduce((acc: any, item: any) => {
@@ -205,10 +232,16 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
acc[key] = item;
}
return acc;
}, {})
}, {}),
);
fixData = filterLatest(data);
const filteredData = filterLatest(data);
// Tambahkan count ke setiap item
fixData = filteredData.map((item: any) => ({
...item,
count: countByKomentarId[item.Forum_Komentar?.id] || 0,
}));
} else {
return NextResponse.json(
{
@@ -216,7 +249,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
message: "Invalid category",
reason: "Invalid category",
},
{ status: 400 }
{ status: 400 },
);
}
@@ -226,7 +259,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
message: `Success get data forum ${category}`,
data: fixData,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
return NextResponse.json(
@@ -235,7 +268,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
message: `Error get data forum ${category}`,
reason: (error as Error).message,
},
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -1,19 +1,20 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export async function GET(
request: Request,
{ params }: { params: { id: string } }
{ params }: { params: { id: string } },
) {
try {
let fixData;
const { id } = params;
const { searchParams } = new URL(request.url);
const page = searchParams.get("page");
const page = Number(searchParams.get("page"));
const status = searchParams.get("status");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = page * takeData - takeData;
const fixStatus = _.startCase(status ? status : "");
@@ -43,6 +44,7 @@ export async function GET(
id: true,
Author: true,
StatusInvoice: true,
nominal: true,
},
});
@@ -54,7 +56,7 @@ export async function GET(
message: "Success get status transaksi",
data: fixData,
},
{ status: 200 }
{ status: 200 },
);
} catch (error) {
console.error("Eror get status transaksi", error);
@@ -64,7 +66,7 @@ export async function GET(
message: "Error get status transaksi",
reason: (error as Error).message,
},
{ status: 500 }
{ status: 500 },
);
}
}

View File

@@ -1,6 +1,7 @@
import _ from "lodash";
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET };
@@ -9,12 +10,9 @@ async function GET(request: Request) {
const category = searchParams.get("category");
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
console.log("[CATEGORY]", category);
console.log("[PAGE]", page);
let fixData;
try {
if (category === "dashboard") {
@@ -49,7 +47,6 @@ async function GET(request: Request) {
};
} else {
const fixCategoryToStatus = _.startCase(category || "");
console.log("[STATUS]", fixCategoryToStatus);
const data = await prisma.investasi.findMany({
take: page ? takeData : undefined,
@@ -70,6 +67,12 @@ async function GET(request: Request) {
select: {
id: true,
title: true,
targetDana: true,
MasterPencarianInvestor: {
select: {
name: true,
},
},
author: {
select: {
id: true,

View File

@@ -1,10 +1,14 @@
import { NextResponse } from "next/server";
import { NextRequest, NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET, POST };
async function GET(request: Request) {
async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const page = Number(searchParams.get("page"));
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = page * takeData - takeData;
// const category = searchParams.get("category");
let fixData;
@@ -13,6 +17,8 @@ async function GET(request: Request) {
orderBy: {
createdAt: "asc",
},
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
});
// if (category === "category") {

View File

@@ -1,14 +1,22 @@
import { NextResponse } from "next/server";
import { NextRequest, NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET, POST };
async function GET(request: Request) {
async function GET(request: NextRequest) {
try {
const searchParams = request.nextUrl.searchParams;
const page = Number(searchParams.get("page"));
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = page * takeData - takeData;
const data = await prisma.eventMaster_TipeAcara.findMany({
orderBy: {
updatedAt: "desc",
},
take: page ? takeData : undefined,
skip: page ? skipData : undefined,
});
return NextResponse.json({

View File

@@ -2,6 +2,7 @@ import _ from "lodash";
import moment from "moment";
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
export { GET };
@@ -12,7 +13,7 @@ async function GET(request: Request) {
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const takeData = PAGINATION_DEFAULT_TAKE;
const skipData = Number(page) * takeData - takeData;
let fixData;

View File

@@ -28,13 +28,10 @@ export default function Login({ version }: { version: string }) {
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
async function onLogin() {
console.log("phone >>", phone);
const nomor = phone;
if (nomor.length <= 4) return setError(true);
const fixPhone = `${countryCode}${nomor}`;
console.log("fixPhone >>", fixPhone);
try {
setLoading(true);
@@ -46,7 +43,6 @@ export default function Login({ version }: { version: string }) {
router.push("/validasi", { scroll: false });
} else {
setLoading(false);
console.log("respone >>", respone);
ComponentGlobal_NotifikasiPeringatan(respone?.message);
}
} catch (error) {
@@ -108,9 +104,6 @@ export default function Login({ version }: { version: string }) {
// Simpan hasil akhir
setCountryCode(dialCode);
setPhone(localNumber);
// console.log("Country Code:", dialCode);
// console.log("Clean Local Number:", localNumber);
}}
/>

4
types/env.d.ts vendored
View File

@@ -11,5 +11,9 @@ declare namespace NodeJS {
NEXT_PUBLIC_BASE_SESSION_KEY?: string;
RESEND_APIKEY?: string;
WA_SERVER_TOKEN?: string;
FIREBASE_ADMIN_PRIVATE_KEY?: string;
FIREBASE_ADMIN_CLIENT_EMAIL?: string;
FIREBASE_ADMIN_PROJECT_ID?: string;
NEXT_PUBLIC_API_URL?: string;
}
}