From 54ab285bcd0f5ef81991a3c0d32a4de1e3f8933d Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 28 Oct 2024 16:06:29 -0400 Subject: [PATCH] Add endpoint that allows getting a class's expected size. --- src/server.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/server.ts b/src/server.ts index 90e62f7..0073fd3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -582,6 +582,22 @@ export function createApp(db: Sequelize): Express { }); }); + app.get("/classes/expected-size/:classID", async (req, res) => { + const classID = Number(req.params.classID); + const cls = await findClassById(classID); + if (cls === null) { + res.status(404).json({ + message: `Class ${classID} not found`, + }); + return; + } + const size = cls.expected_size; + res.json({ + class_id: classID, + expected_size: size, + }); + }); + app.get("/classes/roster/:classID", async (req, res) => { const classID = Number(req.params.classID); const cls = await findClassById(classID);