From e9bda3c807bcf18c7f5cec6c402ddab12a0ede51 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Sat, 20 Nov 2021 21:55:31 -0700 Subject: [PATCH] Add function to remove season --- database/scores/seasons.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/scores/seasons.js b/database/scores/seasons.js index de32b2b..55e9941 100644 --- a/database/scores/seasons.js +++ b/database/scores/seasons.js @@ -19,4 +19,12 @@ async function create(year) { RETURNING season_id;`; const id = (await database.executeQuery(query, [year]))[0][0]; 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); } \ No newline at end of file