feat: implement partner licenses module with pagination and filtering capabilities

This commit is contained in:
2026-04-26 09:54:48 +03:30
parent b72e6c7194
commit 34793295c9
24 changed files with 459 additions and 76 deletions
@@ -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,
})
}