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
Some checks failed
Deploy to Production / test (push) Failing after 27s
This commit is contained in:
@@ -4,7 +4,7 @@ import { config } from "@shared/lib/config";
|
||||
import { withTransaction } from "@/lib/db";
|
||||
import type { Transaction } from "@shared/lib/types";
|
||||
import { UserError } from "@shared/lib/errors";
|
||||
import { TimerType, TransactionType } from "@shared/lib/constants";
|
||||
import { TimerKey, TimerType, TransactionType } from "@shared/lib/constants";
|
||||
|
||||
export const economyService = {
|
||||
transfer: async (fromUserId: string, toUserId: string, amount: bigint, tx?: Transaction) => {
|
||||
@@ -82,7 +82,7 @@ export const economyService = {
|
||||
where: and(
|
||||
eq(userTimers.userId, BigInt(userId)),
|
||||
eq(userTimers.type, TimerType.COOLDOWN),
|
||||
eq(userTimers.key, 'daily')
|
||||
eq(userTimers.key, TimerKey.DAILY)
|
||||
),
|
||||
});
|
||||
|
||||
@@ -141,7 +141,7 @@ export const economyService = {
|
||||
.values({
|
||||
userId: BigInt(userId),
|
||||
type: TimerType.COOLDOWN,
|
||||
key: 'daily',
|
||||
key: TimerKey.DAILY,
|
||||
expiresAt: nextReadyAt,
|
||||
})
|
||||
.onConflictDoUpdate({
|
||||
|
||||
Reference in New Issue
Block a user