feat: Introduce TimerKey enum and refactor timer key usage across services with new tests.
Some checks failed
Deploy to Production / test (push) Failing after 27s

This commit is contained in:
syntaxbullet
2026-02-13 13:11:16 +01:00
parent 570cdc69c1
commit 2d35a5eabb
5 changed files with 57 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ import { eq, sql, and } from "drizzle-orm";
import { withTransaction } from "@/lib/db";
import { config } from "@shared/lib/config";
import type { Transaction } from "@shared/lib/types";
import { TimerType } from "@shared/lib/constants";
import { TimerKey, TimerType } from "@shared/lib/constants";
export const levelingService = {
// Calculate total XP required to REACH a specific level (Cumulative)
@@ -84,7 +84,7 @@ export const levelingService = {
where: and(
eq(userTimers.userId, BigInt(id)),
eq(userTimers.type, TimerType.COOLDOWN),
eq(userTimers.key, 'chat_xp')
eq(userTimers.key, TimerKey.CHAT_XP)
),
});
@@ -120,7 +120,7 @@ export const levelingService = {
.values({
userId: BigInt(id),
type: TimerType.COOLDOWN,
key: 'chat_xp',
key: TimerKey.CHAT_XP,
expiresAt: nextReadyAt,
})
.onConflictDoUpdate({