mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 05:09:26 +00:00
add auth docs, add eslint import/order
This commit is contained in:
@@ -42,4 +42,5 @@ export class AppSettings {
|
||||
}
|
||||
const env = new EnvironmentSettings((process.env.NODE_ENV || 'DEVELOPMENT') as EnvironmentsTypes)
|
||||
const auth = new AuthSettings(process.env)
|
||||
|
||||
export const appSettings = new AppSettings(env, auth)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Global, Module } from '@nestjs/common'
|
||||
|
||||
import { appSettings, AppSettings } from './app-settings'
|
||||
|
||||
//главный config модуль для управления env переменными импортируется в app.module.ts глобально
|
||||
|
||||
@@ -7,6 +7,7 @@ export const validationErrorsMapper = {
|
||||
): ValidationPipeErrorType[] {
|
||||
return errors.flatMap(error => {
|
||||
const constraints = error.constraints ?? []
|
||||
|
||||
return Object.entries(constraints).map(([_, value]) => ({
|
||||
field: error.property,
|
||||
message: value,
|
||||
@@ -26,6 +27,7 @@ export function pipesSetup(app: INestApplication) {
|
||||
exceptionFactory: (errors: ValidationError[]) => {
|
||||
const err =
|
||||
validationErrorsMapper.mapValidationErrorArrayToValidationPipeErrorTypeArray(errors)
|
||||
|
||||
throw new BadRequestException(err)
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user