feat: add page size in all the rest API
This commit is contained in:
		| @@ -1,19 +1,7 @@ | ||||
| import { | ||||
|   forwardRef, | ||||
|   HttpException, | ||||
|   HttpStatus, | ||||
|   Inject, | ||||
|   Injectable, | ||||
| } from '@nestjs/common'; | ||||
| import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; | ||||
| import { CreateUserDto } from './dto/create-user.dto'; | ||||
| import { UpdateUserDto } from './dto/update-user.dto'; | ||||
| import { | ||||
|   Connection, | ||||
|   EntityNotFoundError, | ||||
|   Equal, | ||||
|   Not, | ||||
|   Repository, | ||||
| } from 'typeorm'; | ||||
| import { Connection, EntityNotFoundError, Not, Repository } from 'typeorm'; | ||||
| import { User } from './entities/user.entity'; | ||||
| import { InjectRepository } from '@nestjs/typeorm'; | ||||
| import { randomStringGenerator } from '@nestjs/common/utils/random-string-generator.util'; | ||||
| @@ -155,10 +143,10 @@ export class UsersService { | ||||
|     }; | ||||
|   } | ||||
|  | ||||
|   findByRoles(relationId: string, page: number) { | ||||
|   findByRoles(relationId: string, page: number, pageSize?: number) { | ||||
|     return this.usersRepository.findAndCount({ | ||||
|       skip: page * 10, | ||||
|       take: 10, | ||||
|       skip: page * (pageSize || 10), | ||||
|       take: pageSize || 10, | ||||
|       where: { | ||||
|         roles: relationId, | ||||
|       }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user