feat: centralized constants and enums for project-wide use
This commit is contained in:
@@ -3,6 +3,7 @@ import { eq, sql, and } from "drizzle-orm";
|
||||
import { withTransaction } from "@/lib/db";
|
||||
import { config } from "@/lib/config";
|
||||
import type { Transaction } from "@/lib/types";
|
||||
import { TimerType } from "@/lib/constants";
|
||||
|
||||
export const levelingService = {
|
||||
// Calculate total XP required to REACH a specific level (Cumulative)
|
||||
@@ -78,7 +79,7 @@ export const levelingService = {
|
||||
const cooldown = await txFn.query.userTimers.findFirst({
|
||||
where: and(
|
||||
eq(userTimers.userId, BigInt(id)),
|
||||
eq(userTimers.type, 'COOLDOWN'),
|
||||
eq(userTimers.type, TimerType.COOLDOWN),
|
||||
eq(userTimers.key, 'chat_xp')
|
||||
),
|
||||
});
|
||||
@@ -95,7 +96,7 @@ export const levelingService = {
|
||||
const xpBoost = await txFn.query.userTimers.findFirst({
|
||||
where: and(
|
||||
eq(userTimers.userId, BigInt(id)),
|
||||
eq(userTimers.type, 'EFFECT'),
|
||||
eq(userTimers.type, TimerType.EFFECT),
|
||||
eq(userTimers.key, 'xp_boost')
|
||||
)
|
||||
});
|
||||
@@ -114,7 +115,7 @@ export const levelingService = {
|
||||
await txFn.insert(userTimers)
|
||||
.values({
|
||||
userId: BigInt(id),
|
||||
type: 'COOLDOWN',
|
||||
type: TimerType.COOLDOWN,
|
||||
key: 'chat_xp',
|
||||
expiresAt: nextReadyAt,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user