Files
EpicNext-Cms/src/lib/bans.ts
T
SimoandCursor 3bd712e744
CI / check (push) Failing after 9s
CI / release (push) Skipped
CI / deploy (push) Skipped
fix(admin): polish tickets, photos purge note, drizzle contracts
Add queue banners/counts on ticket detail pages, document local-only photo purge, and harden Drizzle Kit smoke contracts after Prisma removal.

Co-authored-by: Cursor <[email protected]>
2026-08-01 15:07:54 +02:00

23 lines
514 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;
}
/** Filter for currently active bans (incl. permanent). */
export function activeBanWhere(now: number = unixNow()) {
return {
OR: [{ banExpire: 0 }, { banExpire: { gt: now } }],
};
}