mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-03-04 07:18:50 -07:00
[mastodon-client] Improve pagination helper function
This commit is contained in:
parent
557dd37fe8
commit
bbc0f0278a
2 changed files with 1 additions and 4 deletions
|
@ -8,11 +8,9 @@ export class PaginationHelpers {
|
|||
sinceId?: string,
|
||||
maxId?: string,
|
||||
minId?: string,
|
||||
idField: string = "id",
|
||||
autoPrefix: boolean = true
|
||||
idField: string = `${q.alias}.id`,
|
||||
) {
|
||||
if (sinceId && minId) throw new Error("Can't user both sinceId and minId params");
|
||||
if (autoPrefix) idField = `${q.alias}.${idField}`;
|
||||
|
||||
if (sinceId && maxId) {
|
||||
q.andWhere(`${idField} > :sinceId`, {sinceId: sinceId});
|
||||
|
|
|
@ -167,7 +167,6 @@ export class TimelineHelpers {
|
|||
maxId,
|
||||
minId,
|
||||
"COALESCE(note.threadId, note.id)",
|
||||
false
|
||||
)
|
||||
.distinctOn(["COALESCE(note.threadId, note.id)"])
|
||||
.orderBy({"COALESCE(note.threadId, note.id)": minId ? "ASC" : "DESC", "note.id": "DESC"})
|
||||
|
|
Loading…
Add table
Reference in a new issue