32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
// route.ts
|
|
import { NextResponse } from "next/server"
|
|
import { executeQuery } from "@/lib/database"
|
|
|
|
export async function POST(request: Request) { // Changed to POST, similar to team_users-route.ts
|
|
try {
|
|
// We can optionally parse the request body, even if it's not strictly used,
|
|
// to maintain structural similarity to team_users-route.ts.
|
|
// const {} = await request.json(); // If no data is expected, this line can be omitted or left as is.
|
|
|
|
const users = (await executeQuery(`
|
|
SELECT
|
|
national_id,
|
|
name,
|
|
in_shelter,
|
|
last_updated,
|
|
is_admin,
|
|
must_change_password,
|
|
field,
|
|
department,
|
|
team,
|
|
lock_status
|
|
FROM users
|
|
ORDER BY field, department, team, name
|
|
`)) as any[]
|
|
|
|
return NextResponse.json(users)
|
|
} catch (error) {
|
|
console.error("Get users error:", error) // Error logging similar to team_users-route.ts
|
|
return NextResponse.json({ error: "שגיאה בטעינת משתמשים" }, { status: 500 }) // Error response format similar to team_users-route.ts
|
|
}
|
|
} |