reduced cooldown to 30 seconds, added logging
This commit is contained in:
@@ -33,10 +33,10 @@ export async function POST(request: NextRequest) {
|
|||||||
if (lastReset.length > 0) {
|
if (lastReset.length > 0) {
|
||||||
const lastResetTime = new Date(lastReset[0].timestamp).getTime()
|
const lastResetTime = new Date(lastReset[0].timestamp).getTime()
|
||||||
const now = new Date().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) {
|
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[]
|
])) as any[]
|
||||||
const lockedCount = lockedUsers[0]?.count || 0
|
const lockedCount = lockedUsers[0]?.count || 0
|
||||||
|
|
||||||
|
console.log(`Department reset was called by: ${adminId}`)
|
||||||
|
|
||||||
// Log the action
|
// Log the action
|
||||||
await safeQuery(
|
await safeQuery(
|
||||||
'INSERT INTO admin_actions (admin_id, action_type, target_user_id) VALUES (?, "reset_field", NULL)',
|
'INSERT INTO admin_actions (admin_id, action_type, target_user_id) VALUES (?, "reset_field", NULL)',
|
||||||
|
|||||||
Reference in New Issue
Block a user