Skip to content

Commit

Permalink
Merge pull request #155 from Carifio24/expected-size-endpoint
Browse files Browse the repository at this point in the history
Add endpoint that allows getting a class's expected size
  • Loading branch information
Carifio24 authored Oct 28, 2024
2 parents fcf319d + 54ab285 commit d98439b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d98439b

Please sign in to comment.