Initial commit

This commit is contained in:
2025-06-22 00:01:22 +03:00
parent fd70166cf6
commit 033b80bfad
153 changed files with 26874 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
import { NextResponse } from "next/server"
import { executeQuery } from "@/lib/database"
export async function GET() {
try {
const results = (await executeQuery(`
SELECT
SUM(CASE WHEN in_shelter IS NULL THEN 1 ELSE 0 END) as no_report,
SUM(CASE WHEN in_shelter = 'yes' THEN 1 ELSE 0 END) as in_shelter,
SUM(CASE WHEN in_shelter = 'no' THEN 1 ELSE 0 END) as not_in_shelter,
SUM(CASE WHEN in_shelter = 'no_alarm' THEN 1 ELSE 0 END) as no_alarm,
SUM(CASE WHEN in_shelter = 'safe_after_exit' THEN 1 ELSE 0 END) as safe_after_exit
FROM users
`)) as any[]
return NextResponse.json(results[0])
} catch (error) {
console.error("Stats error:", error)
return NextResponse.json({ error: "שגיאה בטעינת סטטיסטיקות" }, { status: 500 })
}
}