feat: 토너먼트 관련 기능 추가 및 베팅 처리 로직 구현

This commit is contained in:
2026-01-23 16:58:59 +00:00
parent b6164868b7
commit 293a5035c6
9 changed files with 314 additions and 15 deletions
+9 -1
View File
@@ -1,5 +1,5 @@
import type { TournamentKeys } from './keys.js';
import type { TournamentMatchEntry, TournamentParticipantEntry, TournamentState } from './types.js';
import type { TournamentBetEntry, TournamentMatchEntry, TournamentParticipantEntry, TournamentState } from './types.js';
interface RedisClientLike {
get(key: string): Promise<string | null>;
@@ -43,4 +43,12 @@ export class TournamentStore {
async setMatches(matches: TournamentMatchEntry[]): Promise<void> {
await this.redis.set(this.keys.matchesKey, JSON.stringify(matches));
}
async getBettingEntries(): Promise<TournamentBetEntry[]> {
return safeJsonParse<TournamentBetEntry[]>(await this.redis.get(this.keys.bettingKey)) ?? [];
}
async setBettingEntries(entries: TournamentBetEntry[]): Promise<void> {
await this.redis.set(this.keys.bettingKey, JSON.stringify(entries));
}
}