You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
448 B
14 lines
448 B
import { Injectable, NestInterceptor, ExecutionContext } from '@nestjs/common';
|
|
import { Observable } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
import { classToPlain } from 'class-transformer';
|
|
|
|
@Injectable()
|
|
export class TransformInterceptor implements NestInterceptor<any, any> {
|
|
intercept(
|
|
context: ExecutionContext,
|
|
call$: Observable<any>,
|
|
): Observable<any> {
|
|
return call$.pipe(map(data => classToPlain(data)));
|
|
}
|
|
}
|