bunch of shit from claude code
This commit is contained in:
18
backend/src/domain/interfaces/IGameService.ts
Normal file
18
backend/src/domain/interfaces/IGameService.ts
Normal 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;
|
||||
}
|
||||
0
backend/src/domain/interfaces/IMatchProtocol.ts
Normal file
0
backend/src/domain/interfaces/IMatchProtocol.ts
Normal file
12
backend/src/domain/interfaces/IMatchRepository.ts
Normal file
12
backend/src/domain/interfaces/IMatchRepository.ts
Normal 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[]>;
|
||||
}
|
||||
11
backend/src/domain/interfaces/INotificationService.ts
Normal file
11
backend/src/domain/interfaces/INotificationService.ts
Normal 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>;
|
||||
}
|
||||
10
backend/src/domain/interfaces/IPlayerRepository.ts
Normal file
10
backend/src/domain/interfaces/IPlayerRepository.ts
Normal 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[]>;
|
||||
}
|
||||
15
backend/src/domain/interfaces/IQueueRepository.ts
Normal file
15
backend/src/domain/interfaces/IQueueRepository.ts
Normal 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>;
|
||||
}
|
||||
9
backend/src/domain/interfaces/ITeamRepository.ts
Normal file
9
backend/src/domain/interfaces/ITeamRepository.ts
Normal 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[]>;
|
||||
}
|
||||
7
backend/src/domain/interfaces/index.ts
Normal file
7
backend/src/domain/interfaces/index.ts
Normal 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";
|
||||
Reference in New Issue
Block a user