fix(paginate) perbaikan function pagination endpoint
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
parent
23f5ed0946
commit
9445d561ac
|
@ -13,7 +13,7 @@ import { createPaginationResponse } from './utils/pagination-meta.helper';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TransformInterceptor implements NestInterceptor {
|
export class TransformInterceptor implements NestInterceptor {
|
||||||
constructor(protected readonly reflector: Reflector) {}
|
constructor(protected readonly reflector: Reflector) { }
|
||||||
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
||||||
const isPagination = this.reflector.getAllAndOverride<boolean>(
|
const isPagination = this.reflector.getAllAndOverride<boolean>(
|
||||||
PAGINATION_RESPONSE,
|
PAGINATION_RESPONSE,
|
||||||
|
@ -21,8 +21,8 @@ export class TransformInterceptor implements NestInterceptor {
|
||||||
);
|
);
|
||||||
|
|
||||||
const request = context.switchToHttp().getRequest<Request>();
|
const request = context.switchToHttp().getRequest<Request>();
|
||||||
const start = request.params.page ?? 1;
|
const start = request.query.page ?? 1;
|
||||||
const limit = request.params.limit ?? 10;
|
const limit = request.query.limit ?? 10;
|
||||||
|
|
||||||
return next.handle().pipe(
|
return next.handle().pipe(
|
||||||
map((data) => {
|
map((data) => {
|
||||||
|
|
Loading…
Reference in New Issue