diff --git a/database/scores/sports.js b/database/scores/sports.js new file mode 100644 index 0000000..abdea6b --- /dev/null +++ b/database/scores/sports.js @@ -0,0 +1,26 @@ +const database = require('./database'); + + + +class Sport { + constructor(id) { + this.id = id; + } +} + +async function createSport(name) { + query = `INSERT INTO scores.sports(sport_name) + VALUES($1);`; + await database.executeQuery(query, [name]); + + query = `SELECT sport_id FROM scores.sports + WHERE sport_name = $1` + const sportId = await database.executeQuery(query, [name]); + console.log(sportId); + + return new Sport(sportId[0][0]); +} + + + +exports.createSport = createSport; \ No newline at end of file