From 2a1b65f4249defb535f8464cf5ec3a63e4dd44bb Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sat, 5 Dec 2020 11:22:45 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7AuthController=20-=20add=20all=20Er?= =?UTF-8?q?ror=20response=20schemas=20to=20post?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #12 --- src/controllers/AuthController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controllers/AuthController.ts b/src/controllers/AuthController.ts index 8a39093..afa677b 100644 --- a/src/controllers/AuthController.ts +++ b/src/controllers/AuthController.ts @@ -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;