create use cases for auth

This commit is contained in:
andres
2023-06-15 23:10:07 +02:00
parent 612b2326f9
commit 131fec67de
20 changed files with 315 additions and 239 deletions

View File

@@ -10,18 +10,19 @@ export class HttpExceptionFilter implements ExceptionFilter {
const status = exception.getStatus()
if (status === 400) {
const errorsResponse = {
errorsMessages: [],
errorMessages: [],
}
const responseBody: any = exception.getResponse()
if (typeof responseBody.message === 'object') {
responseBody.message.forEach(e => errorsResponse.errorsMessages.push(e))
responseBody.message.forEach(e => errorsResponse.errorMessages.push(e))
} else {
errorsResponse.errorsMessages.push(responseBody.message)
errorsResponse.errorMessages.push(responseBody.message)
}
response.status(status).json(errorsResponse)
} else {
response.status(status).json({
statusCode: status,
message: exception.message,
timestamp: new Date().toISOString(),
path: request.url,
})