🚧AuthController - add all Error response schemas to post

ref #12
This commit is contained in:
Philipp Dormann 2020-12-05 11:22:45 +01:00
parent bd0c7ce042
commit 2a1b65f424
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import { Body, JsonController, Post } from 'routing-controllers';
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
import { InvalidCredentialsError } from '../errors/AuthError';
import { InvalidCredentialsError, PasswordNeededError, UsernameOrEmailNeededError } from '../errors/AuthError';
import { UserNotFoundError } from '../errors/UserErrors';
import { CreateAuth } from '../models/creation/CreateAuth';
@ -12,6 +12,9 @@ export class AuthController {
@Post("/login")
@ResponseSchema(InvalidCredentialsError)
@ResponseSchema(UserNotFoundError)
@ResponseSchema(UsernameOrEmailNeededError)
@ResponseSchema(PasswordNeededError)
@ResponseSchema(InvalidCredentialsError)
@OpenAPI({ description: 'Create a new access token object' })
async post(@Body({ validate: true }) createAuth: CreateAuth) {
let auth;