Updated to v1.0.4, fixed admin global page and overall speed
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { executeQuery } from "@/lib/database"
|
||||
|
||||
export async function GET() {
|
||||
export async function POST(request: Request) { // Changed to POST, similar to team_stats-route.ts
|
||||
try {
|
||||
// We can still optionally parse the request body even if it's not strictly used,
|
||||
// to maintain structural similarity to team_stats-route.ts.
|
||||
// const {} = await request.json(); // If no data is expected, this line can be omitted or left as is.
|
||||
|
||||
const results = (await executeQuery(`
|
||||
SELECT
|
||||
SUM(CASE WHEN in_shelter IS NULL THEN 1 ELSE 0 END) as no_report,
|
||||
@@ -15,7 +19,7 @@ export async function GET() {
|
||||
|
||||
return NextResponse.json(results[0])
|
||||
} catch (error) {
|
||||
console.error("Stats error:", error)
|
||||
return NextResponse.json({ error: "שגיאה בטעינת סטטיסטיקות" }, { status: 500 })
|
||||
console.error("Stats error:", error) // Error logging similar to team_stats-route.ts
|
||||
return NextResponse.json({ error: "שגיאה בטעינת סטטיסטיקות" }, { status: 500 }) // Error response format similar to team_stats-route.ts
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user