summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 18:07:18 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 18:07:18 +0200
commitfbeb7ce8f83624a4f2edfe2eb1a6bf76e593fc7d (patch)
treee69a1e756efb4956d0f7e62adc2c8b7ef3337e6c /src
parent:art: Convert id bigint to string (diff)
downloadserver-fbeb7ce8f83624a4f2edfe2eb1a6bf76e593fc7d.tar.xz
:bug: fix bigint id in message route
Diffstat (limited to 'src')
-rw-r--r--src/routes/channels/#channel_id/messages/index.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts

index 0b91a977..4b9d96a1 100644 --- a/src/routes/channels/#channel_id/messages/index.ts +++ b/src/routes/channels/#channel_id/messages/index.ts
@@ -60,7 +60,11 @@ router.get("/", async (req, res) => { var query: any; if (after) query = MessageModel.find({ channel_id, id: { $gt: after } }); else if (before) query = MessageModel.find({ channel_id, id: { $lt: before } }); - else if (around) query = MessageModel.find({ channel_id, id: { $gt: around - halfLimit, $lt: around + halfLimit } }); + else if (around) + query = MessageModel.find({ + channel_id, + id: { $gt: (BigInt(around) - BigInt(halfLimit)).toString(), $lt: (BigInt(around) + BigInt(halfLimit)).toString() }, + }); else { query = MessageModel.find({ channel_id }).sort({ id: -1 }); }