refactor(nestjs): hook up auth endpoints

This commit is contained in:
Ahmed Bouhuolia
2025-05-08 18:10:02 +02:00
parent 401b3dc111
commit f78d6efe27
26 changed files with 304 additions and 111 deletions

View File

@@ -0,0 +1,24 @@
import {
CallHandler,
ExecutionContext,
Injectable,
NestInterceptor,
} from '@nestjs/common';
import { Observable, map } from 'rxjs';
import { mapValues, mapValuesDeep } from '@/utils/deepdash';
@Injectable()
export class ToJsonInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
return next.handle().pipe(
map((data) => {
return mapValuesDeep(data, (value) => {
if (value && typeof value.toJSON === 'function') {
return value.toJSON();
}
return value;
});
}),
);
}
}