From f048fc86b8f2a33e5b4c77e416f6052ccddccdca Mon Sep 17 00:00:00 2001 From: Tom Ruff Date: Mon, 23 Jun 2025 12:34:47 +0300 Subject: [PATCH] reduced cooldown to 30 seconds, added logging --- app/api/admin/field-reset/route.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/admin/field-reset/route.ts b/app/api/admin/field-reset/route.ts index 0bafb6a..ca3ae3a 100644 --- a/app/api/admin/field-reset/route.ts +++ b/app/api/admin/field-reset/route.ts @@ -33,10 +33,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 = 2 * 60 * 10 // 2 minutes for field resets + const cooldownMs = 30 * 10 // 30 seconds for field resets if (now - lastResetTime < cooldownMs) { - return NextResponse.json({ error: "יש להמתין 2 דקות בין איפוסי תחום" }, { status: 429 }) + return NextResponse.json({ error: "יש להמתין 30 שניות בין איפוסי תחום" }, { status: 429 }) } } @@ -51,6 +51,8 @@ export async function POST(request: NextRequest) { ])) as any[] const lockedCount = lockedUsers[0]?.count || 0 + console.log(`Department reset was called by: ${adminId}`) + // Log the action await safeQuery( 'INSERT INTO admin_actions (admin_id, action_type, target_user_id) VALUES (?, "reset_field", NULL)',