Delete Await Disconnect & Method API

This commit is contained in:
2025-02-11 12:14:24 +08:00
parent 2a93fa787f
commit 7c1d17079a
22 changed files with 21 additions and 226 deletions

View File

@@ -3,15 +3,7 @@ import backendLogger from "@/util/backendLogger";
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.forum_ReportKomentar.count({
@@ -35,7 +27,5 @@ export async function GET(request: Request) {
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}

View File

@@ -3,15 +3,6 @@ import backendLogger from "@/util/backendLogger";
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.forum_ReportPosting.count({
@@ -35,7 +26,5 @@ export async function GET(request: Request) {
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}

View File

@@ -5,15 +5,6 @@ import { NextResponse } from "next/server";
import _ from 'lodash';
export async function GET(request: Request) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method not allowed"
},
{ status: 405 }
);
}
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
@@ -127,7 +118,5 @@ export async function GET(request: Request) {
reason: (error as Error).message
},
)
} finally {
await prisma.$disconnect();
}
}

View File

@@ -5,16 +5,6 @@ import { NextResponse } from "next/server";
export async function GET(request: Request,
{ postingId }: { postingId: string }) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method not allowed",
},
{ status: 405 }
)
}
const { searchParams } = new URL(request.url);
const search = searchParams.get('search');
@@ -144,7 +134,5 @@ export async function GET(request: Request,
},
{ status: 500 }
)
} finally {
await prisma.$disconnect();
}
}
}

View File

@@ -4,15 +4,6 @@ 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 }
)
}
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
@@ -124,7 +115,5 @@ export async function GET(request: Request) {
},
{ status: 500 }
)
} finally {
await prisma.$disconnect()
}
}