From 16c90cf8839d697f11b6c2a0c62cfd9e81fbe1e7 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Sat, 20 Nov 2021 21:39:30 -0700 Subject: [PATCH] Add function to remove teams --- database/scores/teams.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/scores/teams.js b/database/scores/teams.js index 53450fd..3e09496 100644 --- a/database/scores/teams.js +++ b/database/scores/teams.js @@ -27,4 +27,12 @@ async function rename(id, name) { WHERE team_id = $1;`; await database.executeQuery(query, [id, name]); return new Team(id, name); +} + +async function remove(id) { + query = `DELETE FROM scores.teams + WHERE team_id = $1 + RETURNING team_name;`; + name = (await database.executeQuery(query, [id]))[0][0]; + return new Team(id, name); } \ No newline at end of file