restructure directories

* set log level based on env
This commit is contained in:
Philipinho
2024-06-09 15:57:52 +01:00
parent 2e61fb7c11
commit d4eefa48a8
49 changed files with 124 additions and 82 deletions

View File

@ -0,0 +1,27 @@
import {
CallHandler,
ExecutionContext,
Injectable,
NestInterceptor,
} from '@nestjs/common';
import { map, Observable } from 'rxjs';
export interface Response<T> {
data: T;
}
@Injectable()
export class TransformHttpResponseInterceptor<T>
implements NestInterceptor<T, Response<T>>
{
intercept(
context: ExecutionContext,
next: CallHandler<T>,
): Observable<Response<T>> {
return next.handle().pipe(
map((data) => {
const status = context.switchToHttp().getResponse().statusCode;
return { data, success: true, status };
}),
);
}
}