import { CallHandler, ExecutionContext, HttpStatus, Injectable, NestInterceptor, } from '@nestjs/common'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @Injectable() export class ResponseInterceptor implements NestInterceptor { intercept(context: ExecutionContext, next: CallHandler): Observable { return next.handle().pipe( map((data) => { return { data: data !== undefined ? data : true, code: HttpStatus.OK, message: 'Success', }; }), ); } }