fix: build errors

This commit is contained in:
Lala, Shahd
2026-06-10 17:16:49 +00:00
parent 2f79fb3e02
commit 55b9bdf68c
3 changed files with 32 additions and 25 deletions
+21 -21
View File
@@ -1,48 +1,48 @@
export interface BotRef {
id: string;
name: string;
}
export interface Clock {
export interface TournamentClock {
limit: number;
increment: number;
}
export interface Variant {
export interface TournamentVariant {
key: string;
name: string;
}
export interface ResultDto {
export interface TournamentBotRef {
id: string;
name: string;
}
export interface TournamentResult {
rank: number;
points: number;
tieBreak: number;
bot: BotRef;
bot: TournamentBotRef;
nbGames: number;
wins: number;
draws: number;
losses: number;
}
export interface Standing {
export interface TournamentStanding {
page: number;
players: ResultDto[];
players: TournamentResult[];
}
export interface Tournament {
id: string;
fullName: string;
clock: Clock;
variant: Variant;
clock: TournamentClock;
variant: TournamentVariant;
rated: boolean;
nbPlayers: number;
nbRounds: number;
createdBy: string;
startsAt: string | null;
status: string;
status: 'created' | 'started' | 'finished';
round: number;
standing: Standing;
winner: BotRef | null;
standing: TournamentStanding;
winner: TournamentBotRef | null;
}
export interface TournamentList {
@@ -51,16 +51,16 @@ export interface TournamentList {
finished: Tournament[];
}
export interface Pairing {
export interface TournamentPairing {
id: string;
round: number;
white: BotRef | null;
black: BotRef;
white: TournamentBotRef | null;
black: TournamentBotRef;
gameId: string | null;
winner: string | null;
winner: 'white' | 'black' | 'draw' | null;
}
export interface RoundPairings {
round: number;
pairings: Pairing[];
pairings: TournamentPairing[];
}
+7 -2
View File
@@ -1,12 +1,12 @@
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Observable, map } from 'rxjs';
import { Bot, BotWithToken } from '../models/bot.models';
@Injectable({ providedIn: 'root' })
export class BotService {
private readonly http = inject(HttpClient);
private readonly base = '/api/account/official-bots';
private readonly base = '/api/account/bots';
list(): Observable<Bot[]> {
return this.http.get<Bot[]>(this.base);
@@ -16,6 +16,11 @@ export class BotService {
return this.http.post<BotWithToken>(this.base, { name });
}
rotateToken(botId: string): Observable<string> {
return this.http.post<{ token: string }>(`${this.base}/${botId}/rotate-token`, null)
.pipe(map(r => r.token));
}
delete(botId: string): Observable<void> {
return this.http.delete<void>(`${this.base}/${botId}`);
}
+4 -2
View File
@@ -40,8 +40,10 @@ export class TournamentService {
return this.http.post<Tournament>(`${this.base}/${id}/start`, null);
}
join(id: string, botId: string, botName: string): Observable<void> {
return this.http.post<void>(`${this.base}/${id}/join`, { botId, botName });
joinWithBotToken(id: string, botToken: string): Observable<void> {
return this.http.post<void>(`${this.base}/${id}/join`, null, {
headers: new HttpHeaders({ Authorization: `Bearer ${botToken}` })
});
}
roundPairings(id: string, round: number): Observable<RoundPairings> {