adds skip to fetchMessages

This commit is contained in:
Pedro Howat 2024-08-20 12:24:15 -03:00
parent 8f60b802ad
commit 76d4cc27b2
2 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ export class MessageQuery {
where: MessageRaw; where: MessageRaw;
limit?: number; limit?: number;
sort?: { [key: string]: SortOrder }; sort?: { [key: string]: SortOrder };
skip?: number;
} }
export class MessageRepository extends Repository { export class MessageRepository extends Repository {
@ -126,6 +127,7 @@ export class MessageRepository extends Repository {
.find({ ...query.where }) .find({ ...query.where })
.select(query.select || {}) .select(query.select || {})
.sort(query?.sort ?? { messageTimestamp: -1 }) .sort(query?.sort ?? { messageTimestamp: -1 })
.skip(query?.skip ?? 0)
.limit(query?.limit ?? 0); .limit(query?.limit ?? 0);
} }

View File

@ -1256,6 +1256,7 @@ export class ChannelStartupService {
owner: this.instance.name, owner: this.instance.name,
}, },
limit: query?.limit, limit: query?.limit,
skip: query?.skip,
}; };
} }
return await this.repository.message.find(query); return await this.repository.message.find(query);