Update app/api/admin/department-reset/route.ts

This commit is contained in:
2025-06-23 12:46:01 +03:00
parent f048fc86b8
commit df8140d5dd

View File

@@ -37,8 +37,10 @@ export async function POST(request: NextRequest) {
const cooldownMs = 30 * 10 // 1.5 minutes for department resets const cooldownMs = 30 * 10 // 1.5 minutes for department resets
if (now - lastResetTime < cooldownMs) { if (now - lastResetTime < cooldownMs) {
return NextResponse.json({ error: "יש להמתין 30 שניות בין איפוסי מסגרת" }, { status: 429 }) const remainingSeconds = Math.ceil((cooldownMs - (now - lastResetTime)) / 1000)
return NextResponse.json({ error: "יש להמתין 30 שניות בין איפוסי מסגרת", remainingSeconds }, { status: 429 })
} }
} }
// Reset department users' statuses with field and department context, but exclude locked users // Reset department users' statuses with field and department context, but exclude locked users