feat: add page size in all the rest API

This commit is contained in:
caturbgs
2021-12-22 15:23:05 +07:00
parent cdd6d39c90
commit c3df45dc9a
14 changed files with 135 additions and 124 deletions

View File

@@ -38,6 +38,7 @@ export class ProductHistoryPriceService {
page: number,
productId: string,
supplierId: string,
pageSize?: number,
) {
try {
const query = this.productHistoryPriceService
@@ -54,8 +55,8 @@ export class ProductHistoryPriceService {
const data = await query
.orderBy('product_history_price.createdAt', 'DESC')
.skip(page * 10)
.take(10)
.skip(page * (pageSize || 10))
.take(pageSize || 10)
.getMany();
const totalData = await query.getCount();