feat: implement partner licenses module with pagination and filtering capabilities
This commit is contained in:
@@ -7,16 +7,16 @@ import { CreateDeviceDto, UpdateDeviceDto } from './dto/device.dto'
|
||||
export class DevicesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async findAll(page = 1, pageSize = 10) {
|
||||
const [items, count] = await this.prisma.$transaction([
|
||||
async findAll(page = 1, perPage = 10) {
|
||||
const [items, total] = await this.prisma.$transaction([
|
||||
this.prisma.device.findMany({
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
skip: (page - 1) * perPage,
|
||||
take: perPage,
|
||||
include: { brand: true },
|
||||
}),
|
||||
this.prisma.device.count(),
|
||||
])
|
||||
return ResponseMapper.paginate(items, { count, page, pageSize })
|
||||
return ResponseMapper.paginate(items, { total, page, perPage })
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user