Create function to retrive seasons
parent
e9bda3c807
commit
c046eeb6ac
|
@ -28,3 +28,16 @@ async function remove(id) {
|
|||
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;
|
||||
}
|
Reference in New Issue