Add in API endpoints
parent
34c298e51e
commit
b185152b69
|
@ -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(', ')}.`,
|
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,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default (client: Client) => {
|
||||||
const embed = new RichEmbed();
|
const embed = new RichEmbed();
|
||||||
embed.setAuthor(`${directorDiscord.username}#${directorDiscord.discriminator}, ${directorProfile.pn.join(', ')}`, directorDiscord.avatarURL);
|
embed.setAuthor(`${directorDiscord.username}#${directorDiscord.discriminator}, ${directorProfile.pn.join(', ')}`, directorDiscord.avatarURL);
|
||||||
embed.setTitle('Resolution');
|
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;
|
let colour;
|
||||||
if (yea.length > nay.length) colour = '#27b17a';
|
if (yea.length > nay.length) colour = '#27b17a';
|
||||||
else if (yea.length === nay.length) colour = '#ffb34d';
|
else if (yea.length === nay.length) colour = '#ffb34d';
|
||||||
|
|
Loading…
Reference in New Issue