mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Add pagination to !cases -mod
This commit is contained in:
parent
0c6ec9cef0
commit
5056b4376a
5 changed files with 87 additions and 31 deletions
|
@ -82,7 +82,17 @@ export class GuildCases extends BaseGuildRepository {
|
|||
});
|
||||
}
|
||||
|
||||
async getRecentByModId(modId: string, count: number): Promise<Case[]> {
|
||||
async getTotalCasesByModId(modId: string): Promise<number> {
|
||||
return this.cases.count({
|
||||
where: {
|
||||
guild_id: this.guildId,
|
||||
mod_id: modId,
|
||||
is_hidden: 0,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async getRecentByModId(modId: string, count: number, skip = 0): Promise<Case[]> {
|
||||
return this.cases.find({
|
||||
relations: this.getRelations(),
|
||||
where: {
|
||||
|
@ -90,6 +100,7 @@ export class GuildCases extends BaseGuildRepository {
|
|||
mod_id: modId,
|
||||
is_hidden: 0,
|
||||
},
|
||||
skip,
|
||||
take: count,
|
||||
order: {
|
||||
case_number: "DESC",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue