Compare commits
11 Commits
mobile-api
...
v1.6.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 58e1afaa45 | |||
| 250b7c5261 | |||
| 935e519662 | |||
| c6dbd152d5 | |||
| 714cf5cd5a | |||
| a68343599d | |||
| 419b87fc92 | |||
| 0271c87ba9 | |||
| 5551f30721 | |||
| 00d36454d1 | |||
| a762fbe9b1 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -2,6 +2,23 @@
|
|||||||
|
|
||||||
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.6.4](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.3...v1.6.4) (2026-03-03)
|
||||||
|
|
||||||
|
## [1.6.3](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.2...v1.6.3) (2026-03-03)
|
||||||
|
|
||||||
|
## [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.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)
|
## [1.5.39](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.38...v1.5.39) (2026-01-30)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
File utama: src/app/api/mobile/admin/investment/[id]/investor/route.ts
|
File utama: src/app/api/mobile/admin/forum/[id]/comment/route.ts
|
||||||
|
|
||||||
Terapkan pagination pada file "File utama" pada method GET
|
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
|
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
|
||||||
|
|||||||
@@ -3,12 +3,20 @@ const nextConfig = {
|
|||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
experimental: {
|
experimental: {
|
||||||
serverActions: true,
|
serverActions: true,
|
||||||
|
serverComponentsExternalPackages: ['@prisma/client'],
|
||||||
},
|
},
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
staticPageGenerationTimeout: 180, // tingkatkan menjadi 3 menit
|
staticPageGenerationTimeout: 180, // tingkatkan menjadi 3 menit
|
||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: true,
|
ignoreDuringBuilds: true,
|
||||||
},
|
},
|
||||||
|
webpack: (config, { isServer }) => {
|
||||||
|
if (isServer) {
|
||||||
|
config.externals = config.externals || [];
|
||||||
|
config.externals.push('@prisma/client');
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
},
|
||||||
// async headers() {
|
// async headers() {
|
||||||
// return [
|
// return [
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "hipmi",
|
"name": "hipmi",
|
||||||
"version": "1.5.40",
|
"version": "1.6.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "bun prisma/seed.ts"
|
"seed": "bun prisma/seed.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --experimental-https",
|
"dev": "next dev --experimental-https",
|
||||||
"build": "next build",
|
"build": "prisma generate && next build",
|
||||||
"build:dev": "next build",
|
"build:dev": "prisma generate && next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
"postbuild": "node scripts/postbuild.js",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"ver": "bunx commit-and-tag-version -- --prerelease"
|
"ver": "bunx commit-and-tag-version -- --prerelease"
|
||||||
},
|
},
|
||||||
|
|||||||
41
scripts/postbuild.js
Normal file
41
scripts/postbuild.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const standaloneDir = path.join(__dirname, '../.next/standalone');
|
||||||
|
const prismaDir = path.join(__dirname, '../node_modules/.prisma');
|
||||||
|
|
||||||
|
console.log('🚀 Running postbuild script...');
|
||||||
|
|
||||||
|
// Copy Prisma binaries ke standalone output
|
||||||
|
if (fs.existsSync(prismaDir)) {
|
||||||
|
const dest = path.join(standaloneDir, 'node_modules/.prisma');
|
||||||
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
||||||
|
fs.cpSync(prismaDir, dest, { recursive: true });
|
||||||
|
console.log('✓ Prisma binaries copied to standalone output');
|
||||||
|
} else {
|
||||||
|
console.warn('⚠ Prisma binaries directory not found, skipping...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy schema.prisma jika diperlukan
|
||||||
|
const schemaSrc = path.join(__dirname, '../prisma/schema.prisma');
|
||||||
|
const schemaDest = path.join(standaloneDir, 'prisma/schema.prisma');
|
||||||
|
if (fs.existsSync(schemaSrc)) {
|
||||||
|
fs.mkdirSync(path.dirname(schemaDest), { recursive: true });
|
||||||
|
fs.copyFileSync(schemaSrc, schemaDest);
|
||||||
|
console.log('✓ schema.prisma copied to standalone output');
|
||||||
|
} else {
|
||||||
|
console.warn('⚠ schema.prisma not found, skipping...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy prisma client dari node_modules/@prisma/client
|
||||||
|
const prismaClientSrc = path.join(__dirname, '../node_modules/@prisma/client');
|
||||||
|
const prismaClientDest = path.join(standaloneDir, 'node_modules/@prisma/client');
|
||||||
|
if (fs.existsSync(prismaClientSrc)) {
|
||||||
|
fs.mkdirSync(path.dirname(prismaClientDest), { recursive: true });
|
||||||
|
fs.cpSync(prismaClientSrc, prismaClientDest, { recursive: true });
|
||||||
|
console.log('✓ @prisma/client copied to standalone output');
|
||||||
|
} else {
|
||||||
|
console.warn('⚠ @prisma/client not found, skipping...');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ Postbuild script completed!');
|
||||||
@@ -14,8 +14,6 @@ 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,
|
||||||
@@ -29,12 +27,12 @@ export async function POST(req: Request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ✅ Validasi wajib setuju Terms
|
// ✅ Validasi wajib setuju Terms
|
||||||
if (data.termsOfServiceAccepted !== true) {
|
// if (data.termsOfServiceAccepted !== true) {
|
||||||
return NextResponse.json({
|
// return NextResponse.json({
|
||||||
success: false,
|
// success: false,
|
||||||
message: "You must agree to the Terms of Service",
|
// message: "You must agree to the Terms of Service",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
const createUser = await prisma.user.create({
|
const createUser = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
NotificationMobileTitleType,
|
NotificationMobileTitleType,
|
||||||
} from "../../../../../../../../types/type-mobile-notification";
|
} from "../../../../../../../../types/type-mobile-notification";
|
||||||
import { routeUserMobile } from "@/lib/mobile/route-page-mobile";
|
import { routeUserMobile } from "@/lib/mobile/route-page-mobile";
|
||||||
|
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
|
||||||
|
|
||||||
export { GET, PUT };
|
export { GET, PUT };
|
||||||
|
|
||||||
@@ -14,9 +15,9 @@ async function GET(request: Request, { params }: { params: { id: string } }) {
|
|||||||
const { id } = params;
|
const { id } = params;
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const search = searchParams.get("search");
|
const search = searchParams.get("search");
|
||||||
const page = searchParams.get("page");
|
const page = Number(searchParams.get("page"));
|
||||||
const takeData = 10;
|
const takeData = PAGINATION_DEFAULT_TAKE;
|
||||||
const skipData = Number(page) * takeData - takeData;
|
const skipData = page * takeData - takeData;
|
||||||
const category = searchParams.get("category");
|
const category = searchParams.get("category");
|
||||||
let fixData;
|
let fixData;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { prisma } from "@/lib";
|
import { prisma } from "@/lib";
|
||||||
|
import { PAGINATION_DEFAULT_TAKE } from "@/lib/constans-value/constansValue";
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
{ params }: { params: { id: string } },
|
||||||
) {
|
) {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const search = searchParams.get("search");
|
const search = searchParams.get("search");
|
||||||
const page = searchParams.get("page");
|
const page = searchParams.get("page");
|
||||||
const takeData = 10;
|
const takeData = PAGINATION_DEFAULT_TAKE;
|
||||||
const skipData = Number(page) * takeData - takeData;
|
const skipData = Number(page) * takeData - takeData;
|
||||||
let fixData;
|
let fixData;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ export async function GET(
|
|||||||
message: "Success get list report posting",
|
message: "Success get list report posting",
|
||||||
data: fixData,
|
data: fixData,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 },
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[ERROR GET LIST REPORT POSTING]", error);
|
console.error("[ERROR GET LIST REPORT POSTING]", error);
|
||||||
@@ -70,7 +71,7 @@ export async function GET(
|
|||||||
message: "Error get list report posting",
|
message: "Error get list report posting",
|
||||||
reason: (error as Error).message,
|
reason: (error as Error).message,
|
||||||
},
|
},
|
||||||
{ status: 500 }
|
{ status: 500 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,11 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
_count: {
|
_count: {
|
||||||
select: {
|
select: {
|
||||||
Forum_ReportPosting: true,
|
Forum_ReportPosting: true,
|
||||||
Forum_Komentar: true,
|
Forum_Komentar: {
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -140,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) =>
|
const filterLatest = (data: any) =>
|
||||||
Object.values(
|
Object.values(
|
||||||
data.reduce((acc: any, item: any) => {
|
data.reduce((acc: any, item: any) => {
|
||||||
@@ -152,10 +164,16 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
acc[key] = item;
|
acc[key] = item;
|
||||||
}
|
}
|
||||||
return acc;
|
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") {
|
} else if (category === "report_comment") {
|
||||||
const data = await prisma.forum_ReportKomentar.findMany({
|
const data = await prisma.forum_ReportKomentar.findMany({
|
||||||
take: page ? takeData : undefined,
|
take: page ? takeData : undefined,
|
||||||
@@ -194,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) =>
|
const filterLatest = (data: any) =>
|
||||||
Object.values(
|
Object.values(
|
||||||
data.reduce((acc: any, item: any) => {
|
data.reduce((acc: any, item: any) => {
|
||||||
@@ -206,10 +232,16 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
acc[key] = item;
|
acc[key] = item;
|
||||||
}
|
}
|
||||||
return acc;
|
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 {
|
} else {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
@@ -217,7 +249,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
message: "Invalid category",
|
message: "Invalid category",
|
||||||
reason: "Invalid category",
|
reason: "Invalid category",
|
||||||
},
|
},
|
||||||
{ status: 400 }
|
{ status: 400 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +259,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
message: `Success get data forum ${category}`,
|
message: `Success get data forum ${category}`,
|
||||||
data: fixData,
|
data: fixData,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 },
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
@@ -236,7 +268,7 @@ async function GET(request: Request, { params }: { params: { name: string } }) {
|
|||||||
message: `Error get data forum ${category}`,
|
message: `Error get data forum ${category}`,
|
||||||
reason: (error as Error).message,
|
reason: (error as Error).message,
|
||||||
},
|
},
|
||||||
{ status: 500 }
|
{ status: 500 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,10 @@ export default function Login({ version }: { version: string }) {
|
|||||||
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
|
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
|
||||||
|
|
||||||
async function onLogin() {
|
async function onLogin() {
|
||||||
console.log("phone >>", phone);
|
|
||||||
|
|
||||||
const nomor = phone;
|
const nomor = phone;
|
||||||
if (nomor.length <= 4) return setError(true);
|
if (nomor.length <= 4) return setError(true);
|
||||||
|
|
||||||
const fixPhone = `${countryCode}${nomor}`;
|
const fixPhone = `${countryCode}${nomor}`;
|
||||||
console.log("fixPhone >>", fixPhone);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -46,7 +43,6 @@ export default function Login({ version }: { version: string }) {
|
|||||||
router.push("/validasi", { scroll: false });
|
router.push("/validasi", { scroll: false });
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.log("respone >>", respone);
|
|
||||||
ComponentGlobal_NotifikasiPeringatan(respone?.message);
|
ComponentGlobal_NotifikasiPeringatan(respone?.message);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -108,9 +104,6 @@ export default function Login({ version }: { version: string }) {
|
|||||||
// Simpan hasil akhir
|
// Simpan hasil akhir
|
||||||
setCountryCode(dialCode);
|
setCountryCode(dialCode);
|
||||||
setPhone(localNumber);
|
setPhone(localNumber);
|
||||||
|
|
||||||
// console.log("Country Code:", dialCode);
|
|
||||||
// console.log("Clean Local Number:", localNumber);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,21 @@ export default function WaitingRoom_View({
|
|||||||
const [isLoadingHome, setIsLoadingHome] = useState(false);
|
const [isLoadingHome, setIsLoadingHome] = useState(false);
|
||||||
|
|
||||||
async function onClickLogout() {
|
async function onClickLogout() {
|
||||||
setLoading(true);
|
try {
|
||||||
const res = await fetch(`/api/auth/logout?id=${userLoginId}`, {
|
setLoading(true);
|
||||||
method: "GET",
|
const res = await fetch(`/api/auth/logout?id=${userLoginId}`, {
|
||||||
});
|
method: "GET",
|
||||||
|
});
|
||||||
|
|
||||||
const result = await res.json();
|
const result = await res.json();
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
ComponentGlobal_NotifikasiBerhasil(result.message);
|
ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||||
router.push("/", { scroll: false });
|
router.push("/", { scroll: false });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error button to home", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +89,8 @@ export default function WaitingRoom_View({
|
|||||||
</Text>
|
</Text>
|
||||||
<Text fw={"bold"} c={"white"} align="center">
|
<Text fw={"bold"} c={"white"} align="center">
|
||||||
Harap tunggu, Anda akan menerima pemberitahuan melalui
|
Harap tunggu, Anda akan menerima pemberitahuan melalui
|
||||||
Whatsapp setelah disetujui.
|
Whatsapp setelah disetujui, untuk sementara anda bisa
|
||||||
|
menunggu pada halaman ini atau keluar.
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
{isAccess && (
|
{isAccess && (
|
||||||
@@ -110,6 +117,10 @@ export default function WaitingRoom_View({
|
|||||||
Home
|
Home
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Button color="red" loading={loading} onClick={onClickLogout}>
|
||||||
|
Keluar
|
||||||
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
</ComponentGlobal_CardStyles>
|
</ComponentGlobal_CardStyles>
|
||||||
|
|||||||
@@ -12,11 +12,21 @@ if (process.env.NODE_ENV === "production") {
|
|||||||
prisma = new PrismaClient({
|
prisma = new PrismaClient({
|
||||||
// Reduce logging in production to improve performance
|
// Reduce logging in production to improve performance
|
||||||
log: ['error', 'warn'],
|
log: ['error', 'warn'],
|
||||||
|
datasources: {
|
||||||
|
db: {
|
||||||
|
url: process.env.DATABASE_URL,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (!global.prisma) {
|
if (!global.prisma) {
|
||||||
global.prisma = new PrismaClient({
|
global.prisma = new PrismaClient({
|
||||||
log: ['error', 'warn', 'info', 'query'], // More verbose logging in development
|
log: ['error', 'warn', 'info', 'query'], // More verbose logging in development
|
||||||
|
datasources: {
|
||||||
|
db: {
|
||||||
|
url: process.env.DATABASE_URL,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
prisma = global.prisma;
|
prisma = global.prisma;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const middleware = async (req: NextRequest) => {
|
|||||||
|
|
||||||
const { pathname } = req.nextUrl;
|
const { pathname } = req.nextUrl;
|
||||||
|
|
||||||
const apiBaseUrl = new URL(req.url).origin || process.env.NEXT_PUBLIC_API_URL;
|
const apiBaseUrl = process.env.NEXT_PUBLIC_API_URL || new URL(req.url).origin;
|
||||||
// Removed excessive logging that was causing high CPU usage
|
// Removed excessive logging that was causing high CPU usage
|
||||||
// const dbUrl = process.env.DATABASE_URL;
|
// const dbUrl = process.env.DATABASE_URL;
|
||||||
// console.log("DATABASE_URL >>", dbUrl);
|
// console.log("DATABASE_URL >>", dbUrl);
|
||||||
|
|||||||
4
types/env.d.ts
vendored
4
types/env.d.ts
vendored
@@ -11,5 +11,9 @@ declare namespace NodeJS {
|
|||||||
NEXT_PUBLIC_BASE_SESSION_KEY?: string;
|
NEXT_PUBLIC_BASE_SESSION_KEY?: string;
|
||||||
RESEND_APIKEY?: string;
|
RESEND_APIKEY?: string;
|
||||||
WA_SERVER_TOKEN?: 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user