chore: synchronize pending app/backend updates and repository hygiene
Includes current frontend and backend work in progress and removes generated artifacts from tracking to keep the repository clean for дальнейшая разработка. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bdb9b72fac
commit
5f31bb47fb
81 files changed
+11976
-1239
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import type { ApiAlertRule } from "../alerts-service.js"
|
||||
|
||||
const COOLDOWN_MS: Record<ApiAlertRule["cooldown"], number> = {
|
||||
"1м": 60_000,
|
||||
"5м": 5 * 60_000,
|
||||
"15м": 15 * 60_000,
|
||||
"1ч": 60 * 60_000,
|
||||
"4ч": 4 * 60 * 60_000,
|
||||
"24ч": 24 * 60 * 60_000,
|
||||
}
|
||||
|
||||
export function cooldownToMs(cd: ApiAlertRule["cooldown"]): number {
|
||||
return COOLDOWN_MS[cd] ?? COOLDOWN_MS["5м"]
|
||||
}
|
||||
|
||||
/** Можно ли отправить снова после lastIso (ISO) */
|
||||
export function isCooldownElapsed(lastFiredIso: string | null | undefined, cooldown: ApiAlertRule["cooldown"]): boolean {
|
||||
if (!lastFiredIso?.trim()) return true
|
||||
const t = Date.parse(lastFiredIso)
|
||||
if (!Number.isFinite(t)) return true
|
||||
return Date.now() - t >= cooldownToMs(cooldown)
|
||||
}
|
||||
Reference in new issue
Block a user