Fix before and after queries doing gt and lt comparisions incorrectly

This commit is contained in:
Madeline 2022-08-02 19:25:56 +10:00
parent 268699823d
commit 8ec17b74cb

View File

@ -109,11 +109,11 @@ router.get("/", async (req: Request, res: Response) => {
};
if (after) {
if (after > Snowflake.generate()) return res.status(422);
if (BigInt(after) > BigInt(Snowflake.generate())) return res.status(422);
query.where.id = MoreThan(after);
}
else if (before) {
if (before < req.params.channel_id) return res.status(422);
if (BigInt(before) < BigInt(req.params.channel_id)) return res.status(422);
query.where.id = LessThan(before);
}
else if (around) {