refactor: centralize domain values and enforce numeric lint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { applyDecorators } from '@nestjs/common';
|
||||
import { HttpStatus, applyDecorators } from '@nestjs/common';
|
||||
import {
|
||||
ApiExtraModels,
|
||||
ApiProperty,
|
||||
@@ -35,10 +35,13 @@ function problemResponse(status: number, description: string) {
|
||||
export function ApiProblemResponses(): MethodDecorator & ClassDecorator {
|
||||
return applyDecorators(
|
||||
ApiExtraModels(ProblemDetailsDto),
|
||||
problemResponse(400, 'Invalid request'),
|
||||
problemResponse(401, 'Authentication required'),
|
||||
problemResponse(404, 'Resource not found'),
|
||||
problemResponse(503, 'Upstream service unavailable'),
|
||||
problemResponse(500, 'Internal server error'),
|
||||
problemResponse(HttpStatus.BAD_REQUEST, 'Invalid request'),
|
||||
problemResponse(HttpStatus.UNAUTHORIZED, 'Authentication required'),
|
||||
problemResponse(HttpStatus.NOT_FOUND, 'Resource not found'),
|
||||
problemResponse(
|
||||
HttpStatus.SERVICE_UNAVAILABLE,
|
||||
'Upstream service unavailable',
|
||||
),
|
||||
problemResponse(HttpStatus.INTERNAL_SERVER_ERROR, 'Internal server error'),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user