UNPKG

@andreabiagini5/applicazioni-e-servizi-web-project

Version:
46 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteMatch = exports.updateMatch = exports.findMatchesByPlayer = exports.findMatch = exports.createMatch = void 0; const match_1 = require("./match"); const repo = new match_1.MatchRepository(); /** * Saves a given match in the database. * * @param match the match object to be saved. * @returns the ID of the saved match. */ const createMatch = async (match, matchId) => await repo.createMatch(match, matchId); exports.createMatch = createMatch; /** * Returns the match corresponding to the provided ID, if it exists. * * @param matchId the desired match ID. * @returns the match corresponding to the provided ID, or null if the ID does not exist. */ const findMatch = async (matchId) => await repo.findMatch(matchId); exports.findMatch = findMatch; /** * Returns a list of matches played by the provided player. * * @param player the player by which the matches are played. * @returns a list of matches played by the provided player. */ const findMatchesByPlayer = async (player) => await repo.findMatchesByPlayer(player); exports.findMatchesByPlayer = findMatchesByPlayer; /** * Updates the match corresponding to the provided ID. * * @param matchId the ID of the match to be updated. * @param newMatch the updated match object. */ const updateMatch = async (matchId, newMatch) => await repo.updateMatch(matchId, newMatch); exports.updateMatch = updateMatch; /** * Deletes the match corresponding to the provided ID. * * @param matchId the ID of the match to be deleted. * @returns true if the match has been deleted, false otherwise. */ const deleteMatch = async (matchId) => await repo.deleteMatch(matchId); exports.deleteMatch = deleteMatch; //# sourceMappingURL=endedMatch.js.map