Add in API endpoints

merge-requests/17/head
Hiroyuki 2021-02-09 22:37:52 -04:00
parent 34c298e51e
commit b185152b69
No known key found for this signature in database
GPG Key ID: C15AC26538975A24
2 changed files with 25 additions and 1 deletions

View File

@ -138,5 +138,29 @@ export default class Root extends Route {
message: `Created new Motion with ID ${motion.oID} by ${staffDiscord.username}#${staffDiscord.discriminator}, ${staffInformation.pn.join(', ')}.`,
});
});
this.router.get('/motions', async (_req, res) => {
const motions = await this.server.client.db.Motion.find().lean();
res.status(200).send({
motions,
});
});
this.router.get('/resolutions', async (_req, res) => {
const resolutions = await this.server.client.db.Resolution.find().lean();
res.status(200).send({
resolutions,
});
});
this.router.get('/executive-orders', async (_req, res) => {
const executiveOrders = await this.server.client.db.ExecutiveOrder.find().lean();
res.status(200).send({
executiveOrders,
});
});
}
}

View File

@ -47,7 +47,7 @@ export default (client: Client) => {
const embed = new RichEmbed();
embed.setAuthor(`${directorDiscord.username}#${directorDiscord.discriminator}, ${directorProfile.pn.join(', ')}`, directorDiscord.avatarURL);
embed.setTitle('Resolution');
embed.setFooter(`${directorProfile.position} | Library of Code sp-us | Board of Directors`, 'https://static.libraryofcode.org/loccommunityadmin.png');
embed.setFooter(`${directorProfile.title} | Library of Code sp-us | Board of Directors`, 'https://static.libraryofcode.org/loccommunityadmin.png');
let colour;
if (yea.length > nay.length) colour = '#27b17a';
else if (yea.length === nay.length) colour = '#ffb34d';