Add function to get team name from an ID
parent
9b4575c666
commit
1abffb43bd
|
@ -51,6 +51,15 @@ async function retrieveBySport(sportID) {
|
||||||
return teamsList;
|
return teamsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getFromID(id) {
|
||||||
|
const query = `SELECT team_name
|
||||||
|
FROM scores.teams
|
||||||
|
WHERE team_id = $1;`;
|
||||||
|
const name = await database.executeQuery(query, [teamID])[0][0];
|
||||||
|
|
||||||
|
return new Team(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,4 +67,5 @@ async function retrieveBySport(sportID) {
|
||||||
exports.add = add;
|
exports.add = add;
|
||||||
exports.rename = rename;
|
exports.rename = rename;
|
||||||
exports.remove = remove;
|
exports.remove = remove;
|
||||||
exports.retrieveBySport = retrieveBySport;
|
exports.retrieveBySport = retrieveBySport;
|
||||||
|
exports.getFromID = getFromID;
|
Reference in New Issue