Skip to content

Commit

Permalink
fix: pagination not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger13579 committed Jun 13, 2024
1 parent 633e616 commit 86b19db
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/dto/comment/getCommentsDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class GetCommentsDTO {
get options() {
return {
sort: this._sort,
skip: (this._page - 1) * this._limit,
page: this._page,
limit: this._limit,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/dto/group/groupFilterDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class GroupFilterDto {

get options() {
return {
skip: (this._page - 1) * this._limit,
page: this._page,
limit: this._limit,
sort: this._sort,
};
Expand Down
4 changes: 2 additions & 2 deletions src/dto/order/orderFilterDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class OrderFilterDto {
path: 'user',
select: 'account name phone email',
},
skip: (this._page - 1) * this._limit,
...(this._limit && { limit: this._limit }),
page: this._page,
limit: this._limit,
sort: this._sort,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/dto/product/getProductDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export class GetProductDTO {
}
: { ...defaultProjection, recommendWeight: 0, isPublic: 0 };
return {
skip: (this._page - 1) * this._limit,
...(this._limit && { limit: this._limit }),
page: this._page,
limit: this._limit,
sort: this._sort,
projection,
};
Expand Down
4 changes: 2 additions & 2 deletions src/dto/ticket/getTicketsDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export class GetTicketsDto {
};
return {
productSelect,
skip: (this._page - 1) * this._limit,
...(this._limit && { limit: this._limit }),
page: this._page,
limit: this._limit,
sort: this._sort,
ticketSelect,
};
Expand Down
2 changes: 1 addition & 1 deletion src/vo/cart/getCartVo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class GetCartVO {
public readonly createdAt: Date;
public readonly updatedAt: Date;

constructor(cart: ICartPagination | ICart, page: number, limit: number) {
constructor(cart: ICartPagination | ICart, limit: number, page: number) {
this.createdAt = cart.createdAt;
this.updatedAt = cart.updatedAt;
this._id = cart._id;
Expand Down

0 comments on commit 86b19db

Please sign in to comment.