bunch of shit from claude code

This commit is contained in:
2026-01-31 03:06:22 +01:00
parent 748ee830f7
commit 034f9df139
105 changed files with 6167 additions and 40 deletions

View File

@@ -0,0 +1,18 @@
import type { Match } from "../models/Match";
import type { Player } from "../models/Player";
import type { Score } from "../models/Score";
export interface IGameService {
createLobby(match: Match): Promise<string>;
closeLobby(lobbyId: string): Promise<void>;
invitePlayer(player: Player, lobbyId: string): Promise<void>;
sendMessage(lobbyId: string, message: string): Promise<void>;
setMap(lobbyId: string, mapId: number): Promise<void>;
startMatch(lobbyId: string): Promise<void>;
onPlayerJoin(callback: (osuId: number, lobbyId: string) => void): void;
onPlayerLeave(callback: (osuId: number, lobbyId: string) => void): void;
onMatchStart(callback: (lobbyId: string) => void): void;
onMatchFinish(callback: (lobbyId: string, scores: Score[]) => void): void;
onRoll(callback: (osuId: number, lobbyId: string, roll: number) => void): void;
}

View File

@@ -0,0 +1,12 @@
import type { Match } from "../models/Match";
import type { MatchState } from "../models/MatchState";
export interface IMatchRepository {
findById(id: string): Promise<Match | null>;
findActive(): Promise<Match[]>;
findByPlayer(playerId: string, limit?: number): Promise<Match[]>;
findByLobbyId(lobbyId: string): Promise<Match | null>;
save(match: Match): Promise<void>;
updateState(matchId: string, state: MatchState): Promise<void>;
findAll(): Promise<Match[]>;
}

View File

@@ -0,0 +1,11 @@
import type { Match } from "../models/Match";
import type { Team } from "../models/Team";
import type { MatchScore } from "../models/Score";
export interface INotificationService {
announceMatch(match: Match): Promise<void>;
announceMatchResult(match: Match, winner: Team): Promise<void>;
notifyPlayer(playerId: string, message: string): Promise<void>;
notifyTeam(teamId: string, message: string): Promise<void>;
announceMapResult(match: Match, scores: MatchScore): Promise<void>;
}

View File

@@ -0,0 +1,10 @@
import type { Player } from "../models/Player";
export interface IPlayerRepository {
findById(id: string): Promise<Player | null>;
findByOsuId(osuId: number): Promise<Player | null>;
findByDiscordId(discordId: string): Promise<Player | null>;
save(player: Player): Promise<void>;
updateRating(playerId: string, newRating: number): Promise<void>;
findAll(): Promise<Player[]>;
}

View File

@@ -0,0 +1,15 @@
import type { QueueEntry } from "../models/QueueEntry";
export interface IQueueRepository {
add(entry: QueueEntry): Promise<void>;
remove(teamId: string): Promise<void>;
findByTeamId(teamId: string): Promise<QueueEntry | null>;
findByType(queueType: string): Promise<QueueEntry[]>;
findClosestByRating(
rating: number,
queueType: string,
exclude?: string[]
): Promise<QueueEntry | null>;
findAll(): Promise<QueueEntry[]>;
clear(): Promise<void>;
}

View File

@@ -0,0 +1,9 @@
import type { Team } from "../models/Team";
export interface ITeamRepository {
findById(id: string): Promise<Team | null>;
findByPlayer(playerId: string): Promise<Team[]>;
save(team: Team): Promise<void>;
delete(teamId: string): Promise<void>;
findAll(): Promise<Team[]>;
}

View File

@@ -0,0 +1,7 @@
export * from "./IPlayerRepository";
export * from "./ITeamRepository";
export * from "./IMatchRepository";
export * from "./IQueueRepository";
export * from "./IGameService";
export * from "./INotificationService";
export * from "./IMatchProtocol";