feat(tournament): better frontend and database handling

This commit is contained in:
Maieul BOYER 2026-01-12 16:36:51 +01:00 committed by Maix0
parent ca618d64ca
commit 43e3b9af26
41 changed files with 2484 additions and 278 deletions

View file

@ -30,6 +30,9 @@ import type {
ChangePassword401Response,
ChangePassword500Response,
ChangePasswordRequest,
CreatePauseGame200Response,
CreatePauseGame404Response,
CreatePauseGameRequest,
DisableOtp200Response,
DisableOtp400Response,
DisableOtp500Response,
@ -55,14 +58,8 @@ import type {
LoginOtpRequest,
LoginRequest,
Logout200Response,
PongCreatePauseGame200Response,
PongCreatePauseGame404Response,
PongCreatePauseGameRequest,
PongHistory200Response,
PongHistory404Response,
PongstartPauseGame200Response,
PongstartPauseGame404Response,
PongstartPauseGameRequest,
ProviderList200Response,
Signin200Response,
Signin400Response,
@ -70,6 +67,10 @@ import type {
StatusOtp200Response,
StatusOtp401Response,
StatusOtp500Response,
TournamentData200Response,
TournamentData404Response,
TournamentList200Response,
TournamentList404Response,
TttHistory200Response,
TttHistory404Response,
} from '../models/index';
@ -104,6 +105,12 @@ import {
ChangePassword500ResponseToJSON,
ChangePasswordRequestFromJSON,
ChangePasswordRequestToJSON,
CreatePauseGame200ResponseFromJSON,
CreatePauseGame200ResponseToJSON,
CreatePauseGame404ResponseFromJSON,
CreatePauseGame404ResponseToJSON,
CreatePauseGameRequestFromJSON,
CreatePauseGameRequestToJSON,
DisableOtp200ResponseFromJSON,
DisableOtp200ResponseToJSON,
DisableOtp400ResponseFromJSON,
@ -154,22 +161,10 @@ import {
LoginRequestToJSON,
Logout200ResponseFromJSON,
Logout200ResponseToJSON,
PongCreatePauseGame200ResponseFromJSON,
PongCreatePauseGame200ResponseToJSON,
PongCreatePauseGame404ResponseFromJSON,
PongCreatePauseGame404ResponseToJSON,
PongCreatePauseGameRequestFromJSON,
PongCreatePauseGameRequestToJSON,
PongHistory200ResponseFromJSON,
PongHistory200ResponseToJSON,
PongHistory404ResponseFromJSON,
PongHistory404ResponseToJSON,
PongstartPauseGame200ResponseFromJSON,
PongstartPauseGame200ResponseToJSON,
PongstartPauseGame404ResponseFromJSON,
PongstartPauseGame404ResponseToJSON,
PongstartPauseGameRequestFromJSON,
PongstartPauseGameRequestToJSON,
ProviderList200ResponseFromJSON,
ProviderList200ResponseToJSON,
Signin200ResponseFromJSON,
@ -184,6 +179,14 @@ import {
StatusOtp401ResponseToJSON,
StatusOtp500ResponseFromJSON,
StatusOtp500ResponseToJSON,
TournamentData200ResponseFromJSON,
TournamentData200ResponseToJSON,
TournamentData404ResponseFromJSON,
TournamentData404ResponseToJSON,
TournamentList200ResponseFromJSON,
TournamentList200ResponseToJSON,
TournamentList404ResponseFromJSON,
TournamentList404ResponseToJSON,
TttHistory200ResponseFromJSON,
TttHistory200ResponseToJSON,
TttHistory404ResponseFromJSON,
@ -206,6 +209,10 @@ export interface ChangePasswordOperationRequest {
changePasswordRequest: ChangePasswordRequest;
}
export interface CreatePauseGameOperationRequest {
createPauseGameRequest: CreatePauseGameRequest;
}
export interface GetUserRequest {
user: GetUserUserParameter;
}
@ -222,22 +229,18 @@ export interface LoginOtpOperationRequest {
loginOtpRequest: LoginOtpRequest;
}
export interface PongCreatePauseGameOperationRequest {
pongCreatePauseGameRequest: PongCreatePauseGameRequest;
}
export interface PongHistoryRequest {
user: string;
}
export interface PongstartPauseGameOperationRequest {
pongstartPauseGameRequest: PongstartPauseGameRequest;
}
export interface SigninRequest {
loginRequest: LoginRequest;
}
export interface TournamentDataRequest {
id: string;
}
export interface TttHistoryRequest {
user: string;
}
@ -516,6 +519,58 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async createPauseGameRaw(requestParameters: CreatePauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreatePauseGame200Response | CreatePauseGame404Response>> {
if (requestParameters['createPauseGameRequest'] == null) {
throw new runtime.RequiredError(
'createPauseGameRequest',
'Required parameter "createPauseGameRequest" was null or undefined when calling createPauseGame().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
let urlPath = `/api/pong/createPausedGame`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreatePauseGameRequestToJSON(requestParameters['createPauseGameRequest']),
}, initOverrides);
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
// This allows typed access to error responses (4xx, 5xx) and other status codes.
// The code routes responses based on the actual HTTP status code and returns
// appropriately typed ApiResponse wrappers for each status code.
if (response.status === 200) {
// Object response for status 200
return new runtime.JSONApiResponse(response, (jsonValue) => CreatePauseGame200ResponseFromJSON(jsonValue));
}
if (response.status === 404) {
// Object response for status 404
return new runtime.JSONApiResponse(response, (jsonValue) => CreatePauseGame404ResponseFromJSON(jsonValue));
}
// CHANGED: Throw error if status code is not handled by any of the defined responses
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
// Only throw if responses were defined but none matched the actual status code
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 404`);
}
/**
*/
async createPauseGame(requestParameters: CreatePauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreatePauseGame200Response | CreatePauseGame404Response> {
const response = await this.createPauseGameRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async denyGuestMessageRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AllowGuestMessage200Response | StatusOtp401Response | AllowGuestMessage403Response>> {
@ -923,58 +978,6 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async pongCreatePauseGameRaw(requestParameters: PongCreatePauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PongCreatePauseGame200Response | PongCreatePauseGame404Response>> {
if (requestParameters['pongCreatePauseGameRequest'] == null) {
throw new runtime.RequiredError(
'pongCreatePauseGameRequest',
'Required parameter "pongCreatePauseGameRequest" was null or undefined when calling pongCreatePauseGame().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
let urlPath = `/createPausedGame`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: PongCreatePauseGameRequestToJSON(requestParameters['pongCreatePauseGameRequest']),
}, initOverrides);
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
// This allows typed access to error responses (4xx, 5xx) and other status codes.
// The code routes responses based on the actual HTTP status code and returns
// appropriately typed ApiResponse wrappers for each status code.
if (response.status === 200) {
// Object response for status 200
return new runtime.JSONApiResponse(response, (jsonValue) => PongCreatePauseGame200ResponseFromJSON(jsonValue));
}
if (response.status === 404) {
// Object response for status 404
return new runtime.JSONApiResponse(response, (jsonValue) => PongCreatePauseGame404ResponseFromJSON(jsonValue));
}
// CHANGED: Throw error if status code is not handled by any of the defined responses
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
// Only throw if responses were defined but none matched the actual status code
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 404`);
}
/**
*/
async pongCreatePauseGame(requestParameters: PongCreatePauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PongCreatePauseGame200Response | PongCreatePauseGame404Response> {
const response = await this.pongCreatePauseGameRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async pongHistoryRaw(requestParameters: PongHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PongHistory200Response | StatusOtp401Response | PongHistory404Response>> {
@ -1029,58 +1032,6 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async pongstartPauseGameRaw(requestParameters: PongstartPauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PongstartPauseGame200Response | PongstartPauseGame404Response>> {
if (requestParameters['pongstartPauseGameRequest'] == null) {
throw new runtime.RequiredError(
'pongstartPauseGameRequest',
'Required parameter "pongstartPauseGameRequest" was null or undefined when calling pongstartPauseGame().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
let urlPath = `/startPausedGame`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: PongstartPauseGameRequestToJSON(requestParameters['pongstartPauseGameRequest']),
}, initOverrides);
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
// This allows typed access to error responses (4xx, 5xx) and other status codes.
// The code routes responses based on the actual HTTP status code and returns
// appropriately typed ApiResponse wrappers for each status code.
if (response.status === 200) {
// Object response for status 200
return new runtime.JSONApiResponse(response, (jsonValue) => PongstartPauseGame200ResponseFromJSON(jsonValue));
}
if (response.status === 404) {
// Object response for status 404
return new runtime.JSONApiResponse(response, (jsonValue) => PongstartPauseGame404ResponseFromJSON(jsonValue));
}
// CHANGED: Throw error if status code is not handled by any of the defined responses
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
// Only throw if responses were defined but none matched the actual status code
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 404`);
}
/**
*/
async pongstartPauseGame(requestParameters: PongstartPauseGameOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PongstartPauseGame200Response | PongstartPauseGame404Response> {
const response = await this.pongstartPauseGameRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async providerListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProviderList200Response>> {
@ -1221,6 +1172,106 @@ export class OpenapiOtherApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async tournamentDataRaw(requestParameters: TournamentDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TournamentData200Response | StatusOtp401Response | TournamentData404Response>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling tournamentData().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
let urlPath = `/api/pong/tournament/{id}`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
// This allows typed access to error responses (4xx, 5xx) and other status codes.
// The code routes responses based on the actual HTTP status code and returns
// appropriately typed ApiResponse wrappers for each status code.
if (response.status === 200) {
// Object response for status 200
return new runtime.JSONApiResponse(response, (jsonValue) => TournamentData200ResponseFromJSON(jsonValue));
}
if (response.status === 401) {
// Object response for status 401
return new runtime.JSONApiResponse(response, (jsonValue) => StatusOtp401ResponseFromJSON(jsonValue));
}
if (response.status === 404) {
// Object response for status 404
return new runtime.JSONApiResponse(response, (jsonValue) => TournamentData404ResponseFromJSON(jsonValue));
}
// CHANGED: Throw error if status code is not handled by any of the defined responses
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
// Only throw if responses were defined but none matched the actual status code
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 401, 404`);
}
/**
*/
async tournamentData(requestParameters: TournamentDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TournamentData200Response | StatusOtp401Response | TournamentData404Response> {
const response = await this.tournamentDataRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async tournamentListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TournamentList200Response | StatusOtp401Response | TournamentList404Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
let urlPath = `/api/pong/tournament/`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
// CHANGED: Handle all status codes defined in the OpenAPI spec, not just 2xx responses
// This allows typed access to error responses (4xx, 5xx) and other status codes.
// The code routes responses based on the actual HTTP status code and returns
// appropriately typed ApiResponse wrappers for each status code.
if (response.status === 200) {
// Object response for status 200
return new runtime.JSONApiResponse(response, (jsonValue) => TournamentList200ResponseFromJSON(jsonValue));
}
if (response.status === 401) {
// Object response for status 401
return new runtime.JSONApiResponse(response, (jsonValue) => StatusOtp401ResponseFromJSON(jsonValue));
}
if (response.status === 404) {
// Object response for status 404
return new runtime.JSONApiResponse(response, (jsonValue) => TournamentList404ResponseFromJSON(jsonValue));
}
// CHANGED: Throw error if status code is not handled by any of the defined responses
// This ensures all code paths return a value and provides clear error messages for unexpected status codes
// Only throw if responses were defined but none matched the actual status code
throw new runtime.ResponseError(response, `Unexpected status code: ${response.status}. Expected one of: 200, 401, 404`);
}
/**
*/
async tournamentList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TournamentList200Response | StatusOtp401Response | TournamentList404Response> {
const response = await this.tournamentListRaw(initOverrides);
return await response.value();
}
/**
*/
async tttHistoryRaw(requestParameters: TttHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TttHistory200Response | StatusOtp401Response | TttHistory404Response>> {