1.1.4 - updated user modals
This commit is contained in:
@@ -10,7 +10,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
// Get admin's field, department, and team
|
||||
const adminData = (await executeQuery("SELECT field, department, team FROM users WHERE national_id = ? AND role IS NOT NULL AND role != 'user'", [
|
||||
const adminData = (await executeQuery("SELECT role, field, department, team FROM users WHERE national_id = ? AND role IS NOT NULL AND role != 'user'", [
|
||||
adminId,
|
||||
])) as any[]
|
||||
|
||||
@@ -18,10 +18,10 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ error: "מנהל לא נמצא" }, { status: 404 })
|
||||
}
|
||||
|
||||
const { field: adminField, department: adminDepartment, team: adminTeam } = adminData[0]
|
||||
const { role: adminRole, field: adminField, department: adminDepartment, team: adminTeam } = adminData[0]
|
||||
|
||||
if (!adminField || !adminDepartment || !adminTeam) {
|
||||
return NextResponse.json({ error: "למנהל לא הוגדרו תחום, מסגרת וצוות" }, { status: 400 })
|
||||
if (adminRole !== "team_admin" && adminRole !== "global_admin" || !adminField || !adminDepartment || !adminTeam) {
|
||||
return NextResponse.json({ users: [], field: adminField, department: adminDepartment, team: adminTeam })
|
||||
}
|
||||
|
||||
// Get team users with full context (field + department + team)
|
||||
@@ -30,6 +30,7 @@ export async function POST(request: Request) {
|
||||
SELECT
|
||||
national_id,
|
||||
name,
|
||||
role,
|
||||
in_shelter,
|
||||
last_updated,
|
||||
is_admin,
|
||||
|
||||
Reference in New Issue
Block a user