You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BOB_PARTY/bob_party/src/services/matchServices/saverMatchApi.ts

32 lines
1.0 KiB

import { Game } from "../../core/game";
import { Match } from "../../core/Match/match";
import { User } from "../../core/User/user";
import ISaverMatch from "./ISaverMatch";
import { GameSolo } from "../../core/gameSolo";
import { GameMulti } from "../../core/gameMulti";
import MatchSolo from "../../core/Match/matchSolo";
import MatchMulti from "../../core/Match/matchMulti";
import MatchCasino from "../../core/Match/matchCasino";
export default class SaverMatchApi implements ISaverMatch{
async saveMatch(u:User, g:Game): Promise<Match> {
//match = mettre dans bdd
if (g instanceof GameSolo){
return new MatchSolo(12, false, [u], g);
}
else if(g instanceof GameMulti){
return new MatchMulti(12, false, [u], g);
}
return new MatchCasino(12, false, [u], g);
}
async deleteMatch(m: Match): Promise<void> {
throw new Error("Method not implemented.");
}
async updateMatch(m: Match): Promise<void> {
throw new Error("Method not implemented.");
}
}