diff --git a/database/scores/seasons.js b/database/scores/seasons.js index 55e9941..b8ff917 100644 --- a/database/scores/seasons.js +++ b/database/scores/seasons.js @@ -27,4 +27,17 @@ async function remove(id) { RETURNING school_year;`; const year = (await database.executeQuery(query, [id]))[0][0]; return new Season(id, year); +} + +async function retrieveAll() { + const query = `SELECT * + FROM scores.seasons + ORDER BY school_year;`; + const table = await database.executeQuery(query); + + const seasonsList = []; + table.forEach((row) => { + seasonsList.push(new Season(row[0], row[1])); + }); + return seasonsList; } \ No newline at end of file