Add function to remove season

main
sudoer777 2021-11-20 21:55:31 -07:00
parent b533668445
commit e9bda3c807
1 changed files with 8 additions and 0 deletions

View File

@ -19,4 +19,12 @@ async function create(year) {
RETURNING season_id;`; RETURNING season_id;`;
const id = (await database.executeQuery(query, [year]))[0][0]; const id = (await database.executeQuery(query, [year]))[0][0];
return new Season(id, year); return new Season(id, year);
}
async function remove(id) {
const query = `DELETE FROM scores.seasons
WHERE season_id = $1
RETURNING school_year;`;
const year = (await database.executeQuery(query, [id]))[0][0];
return new Season(id, year);
} }