feat: implement partner licenses module with pagination and filtering capabilities
This commit is contained in:
@@ -37,12 +37,12 @@ export class PartnerConsumersService {
|
||||
partner_id,
|
||||
})
|
||||
|
||||
async findAll(partner_id: string, page = 1, pageSize = 10) {
|
||||
const [consumers, count] = await this.prisma.$transaction(async tx => [
|
||||
async findAll(partner_id: string, page = 1, perPage = 10) {
|
||||
const [consumers, total] = await this.prisma.$transaction(async tx => [
|
||||
await tx.consumer.findMany({
|
||||
where: this.defaultWhere(partner_id),
|
||||
select: this.defaultSelect,
|
||||
skip: (page - 1) * pageSize,
|
||||
skip: (page - 1) * perPage,
|
||||
take: 10,
|
||||
}),
|
||||
await tx.consumer.count({
|
||||
@@ -50,9 +50,9 @@ export class PartnerConsumersService {
|
||||
}),
|
||||
])
|
||||
return ResponseMapper.paginate(consumers.map(mapConsumerWithLicenseUtil), {
|
||||
count,
|
||||
total,
|
||||
page,
|
||||
pageSize,
|
||||
perPage,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user