Create function to remove games from database
parent
acb987ffd4
commit
9ca8641f20
|
@ -24,3 +24,11 @@ async function add(divisionID, seasonID, date, team1ID, team2ID, team1Score, tea
|
|||
const id = (await database.executeQuery(query, [divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score]))[0][0];
|
||||
return new Game(id, date, team1ID, team2ID, team1Score, team2Score);
|
||||
}
|
||||
|
||||
async function remove(id) {
|
||||
const query = `DELETE FROM scores.games
|
||||
WHERE game_id = $1
|
||||
RETURNING * ;`;
|
||||
const row = (await database.executeQuery(query, [id]))[0];
|
||||
return new Game(id, row[3], row[4], row[5], row[6], row[7]);
|
||||
}
|
Reference in New Issue