reduced cooldown to 30 seconds, added console logging for reset attempts.
This commit is contained in:
@@ -34,10 +34,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 = 90 * 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: "יש להמתין 90 שניות בין איפוסי מסגרת" }, { status: 429 })
|
return NextResponse.json({ error: "יש להמתין 30 שניות בין איפוסי מסגרת" }, { status: 429 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,8 @@ export async function POST(request: NextRequest) {
|
|||||||
[adminField, adminDepartment],
|
[adminField, adminDepartment],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
console.log(`Department reset was called by: ${adminId}`)
|
||||||
|
|
||||||
// Get count of locked users that were skipped
|
// Get count of locked users that were skipped
|
||||||
const lockedUsers = (await safeQuery(
|
const lockedUsers = (await safeQuery(
|
||||||
"SELECT COUNT(*) as count FROM users WHERE field = ? AND department = ? AND lock_status = TRUE",
|
"SELECT COUNT(*) as count FROM users WHERE field = ? AND department = ? AND lock_status = TRUE",
|
||||||
|
|||||||
Reference in New Issue
Block a user