diff --git a/database/scores/teams.js b/database/scores/teams.js new file mode 100644 index 0000000..8d9858b --- /dev/null +++ b/database/scores/teams.js @@ -0,0 +1,22 @@ +const database = require('./../database'); + + + + + +class Team { + constructor(id, name) { + this.id = id; + this.name = name; + } +} + + + +async function create(name, sportID) { + query = `INSERT INTO scores.teams(team_name, sport_id) + VALUES($1, $2) + RETURNING team_id;`; + const id = (await database.executeQuery(query, [name, sportID]))[0][0]; + return new Team(id, name); +} \ No newline at end of file