diff --git a/database/scores/sports.js b/database/scores/sports.js index bd719fc..38f35cf 100644 --- a/database/scores/sports.js +++ b/database/scores/sports.js @@ -35,10 +35,24 @@ async function remove(id) { return new Sport(id, name); } +async function retrieveAll() { + query = `SELECT * + FROM scores.sports + ORDER BY sport_name;`; + const table = await database.executeQuery(query); + + const sportsList = []; + table.forEach((row) => { + sportsList.push(new Sport(row[0], row[1])); + }); + return sportsList; +} + exports.create = create; exports.rename = rename; -exports.remove = remove; \ No newline at end of file +exports.remove = remove; +exports.retrieveAll = retrieveAll; \ No newline at end of file