mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 00:43:49 +01:00
[mastodon-client] Improve pagination helper function
This commit is contained in:
parent
557dd37fe8
commit
bbc0f0278a
@ -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…
Reference in New Issue
Block a user