feat: bots (#9)

Co-authored-by: Lala, Shahd <Shahd.Lala@sybit.de>
Reviewed-on: #9
Co-authored-by: Leon Hermann <lq@blackhole.local>
Co-committed-by: Leon Hermann <lq@blackhole.local>
This commit was merged in pull request #9.
This commit is contained in:
2026-06-10 22:38:06 +02:00
committed by Shahd Lala
parent ae952d70b0
commit 48959daae3
4 changed files with 25 additions and 30 deletions
+5
View File
@@ -7,11 +7,16 @@ import { Bot, BotWithToken } from '../models/bot.models';
export class BotService {
private readonly http = inject(HttpClient);
private readonly base = '/api/account/bots';
private readonly officialBase = '/api/account/official-bots';
list(): Observable<Bot[]> {
return this.http.get<Bot[]>(this.base);
}
listOfficial(): Observable<Bot[]> {
return this.http.get<Bot[]>(this.officialBase);
}
create(name: string): Observable<BotWithToken> {
return this.http.post<BotWithToken>(this.base, { name });
}
+2 -4
View File
@@ -40,10 +40,8 @@ export class TournamentService {
return this.http.post<Tournament>(`${this.base}/${id}/start`, null);
}
joinWithBotToken(id: string, botToken: string): Observable<void> {
return this.http.post<void>(`${this.base}/${id}/join`, null, {
headers: new HttpHeaders({ Authorization: `Bearer ${botToken}` })
});
join(id: string, botId: string, botName: string): Observable<void> {
return this.http.post<void>(`${this.base}/${id}/join`, { botId, botName });
}
roundPairings(id: string, round: number): Observable<RoundPairings> {