feat: implement partner licenses module with pagination and filtering capabilities
This commit is contained in:
@@ -60,19 +60,19 @@ export class consumerCustomersService {
|
||||
}
|
||||
}
|
||||
|
||||
async findAll(consumer_id: string, page = 1, pageSize = 10) {
|
||||
const [customers, count] = await this.prisma.$transaction(async tx => [
|
||||
async findAll(consumer_id: string, page = 1, perPage = 10) {
|
||||
const [customers, total] = await this.prisma.$transaction(async tx => [
|
||||
await tx.customer.findMany({
|
||||
where: this.defaultWhere(consumer_id),
|
||||
select: this.defaultSelect,
|
||||
skip: (page - 1) * pageSize,
|
||||
skip: (page - 1) * perPage,
|
||||
take: 10,
|
||||
}),
|
||||
await tx.customer.count({
|
||||
where: this.defaultWhere(consumer_id),
|
||||
}),
|
||||
])
|
||||
return ResponseMapper.paginate(customers, { count, page, pageSize })
|
||||
return ResponseMapper.paginate(customers, { total, page, perPage })
|
||||
}
|
||||
|
||||
async findOne(consumer_id: string, customer_id: string) {
|
||||
|
||||
Reference in New Issue
Block a user