Add function to rename teams

main
sudoer777 2021-11-20 21:38:08 -07:00
parent 9c55999ad8
commit 7e07236779
1 changed files with 8 additions and 0 deletions

View File

@ -20,3 +20,11 @@ async function create(name, sportID) {
const id = (await database.executeQuery(query, [name, sportID]))[0][0]; const id = (await database.executeQuery(query, [name, sportID]))[0][0];
return new Team(id, name); return new Team(id, name);
} }
async function rename(id, name) {
query = `UPDATE scores.teams
SET team_name = $2
WHERE team_id = $1;`;
await database.executeQuery(query, [id, name]);
return new Team(id, name);
}