Update Versi 1.5.27 #32

Merged
bagasbanuna merged 1009 commits from staging into main 2025-12-17 12:22:28 +08:00
809 changed files with 39392 additions and 11230 deletions
Showing only changes of commit 1df244402b - Show all commits

BIN
bun.lockb

Binary file not shown.

15
eslint.config.mjs Normal file
View File

@@ -0,0 +1,15 @@
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const dirname = dirname(filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];
export default eslintConfig;

View File

@@ -102,5 +102,8 @@
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0",
"yaml": "^2.3.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0"
}
}

3
push-staging.wibu Normal file
View File

@@ -0,0 +1,3 @@
git add -A
git commit -m "data auto"
git push origin staging

View File

@@ -1,39 +1,25 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import _ from "lodash";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const method = request.method;
if (method !== 'GET') {
return NextResponse.json({
success: false,
message: 'Method not allowed',
},
{ status: 405 }
)
}
try {
let fixData;
fixData = await prisma.donasiMaster_Kategori.count({});
return NextResponse.json({
success: true,
message: 'Success get data donasi dashboard',
data: fixData
},
{ status: 200 }
)
} catch (error) {
backendLogger.error('Error get data donasi dashboard >>', error);
return NextResponse.json({
success: false,
message: 'Error get data donasi dashboard',
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}
export async function GET() {
try {
const fixData = await prisma.donasiMaster_Kategori.count({});
return NextResponse.json(
{
success: true,
message: "Success get data donasi dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: true,
message: "gagal mendapatkan data donasi dashboard",
error: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -3,18 +3,9 @@ import backendLogger from "@/util/backendLogger";
import _ from "lodash";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json(
{ success: false, message: "Method not allowed" },
{ status: 405 }
);
}
export async function GET() {
try {
let fixData;
fixData = await prisma.eventMaster_TipeAcara.count({
const fixData = await prisma.eventMaster_TipeAcara.count({
where: {
active: true,
},
@@ -38,7 +29,5 @@ export async function GET(request: Request) {
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}

View File

@@ -2,43 +2,31 @@ import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function GET(request: Request, { params }: {
params: { status: string }
}) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method not allowed",
},
{ status: 405 }
)
}
try {
let fixData;
fixData = await prisma.forum_Posting.count({
where: {
isActive: true,
}
})
export async function GET() {
try {
const fixData = await prisma.forum_Posting.count({
where: {
isActive: true,
},
});
return NextResponse.json({
success: true,
message: "Success get data forum dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data forum dashboard", error);
return NextResponse.json({
success: false,
message: "Error get data forum dashboard",
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}
return NextResponse.json(
{
success: true,
message: "Success get data forum dashboard",
data: fixData,
},
{ status: 200 }
);
} catch (error) {
backendLogger.error("Error get data forum dashboard", error);
return NextResponse.json(
{
success: false,
message: "Error get data forum dashboard",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}

View File

@@ -1,30 +1,44 @@
import { useDisclosure } from "@mantine/hooks";
import { PrismaClient } from "@prisma/client";
import { PrismaClient } from '@prisma/client';
// Singleton PrismaClient untuk pengembangan
const globalForPrisma = globalThis as unknown as {
__prisma__: PrismaClient | undefined;
};
let prisma: PrismaClient;
export const prisma =
globalForPrisma.__prisma__ ??
new PrismaClient({
// log: process.env.NODE_ENV === 'development' ? ['query', 'info', 'warn', 'error'] : [],
});
// Gunakan PrismaClient yang sama jika sudah ada
if (process.env.NODE_ENV !== "production") {
if (!globalForPrisma.__prisma__) {
console.log("PrismaClient initialized in development mode");
}
globalForPrisma.__prisma__ = prisma;
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient();
} else {
const globalWithPrisma = global as typeof globalThis & {
prisma: PrismaClient;
};
if (!globalWithPrisma.prisma) {
globalWithPrisma.prisma = new PrismaClient();
}
prisma = globalWithPrisma.prisma;
}
process.on("SIGINT", async () => {
// console.log("Start in Disconnecting PrismaClient...");
const disconnect = await prisma.$disconnect();
// console.log("End of Disconnecting PrismaClient...", disconnect);
process.exit(0);
// Handle uncaught errors
process.on('uncaughtException', async (error) => {
console.error('Uncaught Exception:', error);
await prisma.$disconnect();
process.exit(1);
});
export default prisma;
// Handle unhandled promise rejections
process.on('unhandledRejection', async (error) => {
console.error('Unhandled Rejection:', error);
await prisma.$disconnect();
process.exit(1);
});
// Handle graceful shutdown
process.on('SIGINT', async () => {
console.log('Received SIGINT signal. Closing database connections...');
await prisma.$disconnect();
process.exit(0);
});
process.on('SIGTERM', async () => {
console.log('Received SIGTERM signal. Closing database connections...');
await prisma.$disconnect();
process.exit(0);
});
export default prisma;