From 0e4d00c9c64185846667877665e3021f5e23a498 Mon Sep 17 00:00:00 2001 From: Tom Ruff Date: Mon, 23 Jun 2025 12:32:38 +0300 Subject: [PATCH] reduced cooldown to 30 seconds, added console logging for reset attempts. --- app/api/admin/department-reset/route.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/admin/department-reset/route.ts b/app/api/admin/department-reset/route.ts index a842d44..257098c 100644 --- a/app/api/admin/department-reset/route.ts +++ b/app/api/admin/department-reset/route.ts @@ -34,10 +34,10 @@ export async function POST(request: NextRequest) { if (lastReset.length > 0) { const lastResetTime = new Date(lastReset[0].timestamp).getTime() const now = new Date().getTime() - const cooldownMs = 90 * 10 // 1.5 minutes for department resets + const cooldownMs = 30 * 10 // 1.5 minutes for department resets if (now - lastResetTime < cooldownMs) { - return NextResponse.json({ error: "יש להמתין 90 שניות בין איפוסי מסגרת" }, { status: 429 }) + return NextResponse.json({ error: "יש להמתין 30 שניות בין איפוסי מסגרת" }, { status: 429 }) } } @@ -47,6 +47,8 @@ export async function POST(request: NextRequest) { [adminField, adminDepartment], ) + console.log(`Department reset was called by: ${adminId}`) + // Get count of locked users that were skipped const lockedUsers = (await safeQuery( "SELECT COUNT(*) as count FROM users WHERE field = ? AND department = ? AND lock_status = TRUE",