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,27 @@
import { type NextRequest, NextResponse } from "next/server"
import { executeQuery } from "@/lib/database"
export async function DELETE(request: NextRequest, { params }: { params: { id: string } }) {
try {
const nationalId = params.id
// Check if user exists
const users = (await executeQuery("SELECT national_id FROM users WHERE national_id = ?", [nationalId])) as any[]
if (users.length === 0) {
return NextResponse.json({ error: "משתמש לא נמצא" }, { status: 404 })
}
// Delete user
await executeQuery(
"DELETE FROM admin_actions WHERE admin_id = ? OR target_user_id = ?",
[nationalId, nationalId]
);
await executeQuery("DELETE FROM users WHERE national_id = ?", [nationalId])
return NextResponse.json({ success: true })
} catch (error) {
console.error("Delete user error:", error)
return NextResponse.json({ error: "שגיאה במחיקת משתמש" }, { status: 500 })
}
}