From b185152b69b6dafe2570dee05b7cd70767e47c44 Mon Sep 17 00:00:00 2001 From: Hiroyuki Date: Tue, 9 Feb 2021 22:37:52 -0400 Subject: [PATCH] Add in API endpoints --- src/api/board.ins/routes/root.ts | 24 ++++++++++++++++++++++++ src/intervals/motions.ts | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/api/board.ins/routes/root.ts b/src/api/board.ins/routes/root.ts index 2199adb..93b1cbe 100644 --- a/src/api/board.ins/routes/root.ts +++ b/src/api/board.ins/routes/root.ts @@ -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, + }); + }); } } diff --git a/src/intervals/motions.ts b/src/intervals/motions.ts index 9accc59..4c9d74a 100644 --- a/src/intervals/motions.ts +++ b/src/intervals/motions.ts @@ -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';