Files
EpicNext-Cms/src/lib/bans.ts
T
SimoandCursor 75cdfdebe4
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m36s
fix(admin): P0 integrity — permanent bans, ACL sidebar, rank guards
Co-authored-by: Cursor <[email protected]>
2026-07-22 19:01:59 +02:00

23 lines
531 B
TypeScript

/**
* Emulator-compatible ban expiry helpers.
* `banExpire === 0` means permanent (Arcturus / Plus-style).
*/
export function unixNow(): number {
return Math.floor(Date.now() / 1000);
}
export function isBanActive(
banExpire: number,
now: number = unixNow(),
): boolean {
return banExpire === 0 || banExpire > now;
}
/** Prisma `where` fragment for currently active bans (incl. permanent). */
export function activeBanWhere(now: number = unixNow()) {
return {
OR: [{ banExpire: 0 }, { banExpire: { gt: now } }],
};
}