reduced cooldown to 30 seconds, added logging

This commit is contained in:
2025-06-23 12:34:47 +03:00
parent 0e4d00c9c6
commit f048fc86b8

View File

@@ -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)',