🚧 AuthController - add proper response schemas

This commit is contained in:
Philipp Dormann 2020-12-05 13:31:46 +01:00
parent e5f65d0b80
commit 0d21497c2f
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { Body, JsonController, Post } from 'routing-controllers';
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
import { InvalidCredentialsError, PasswordNeededError, UsernameOrEmailNeededError } from '../errors/AuthError';
import { IllegalJWTError, InvalidCredentialsError, JwtNotProvidedError, PasswordNeededError, RefreshTokenCountInvalidError, UsernameOrEmailNeededError } from '../errors/AuthError';
import { UserNotFoundError } from '../errors/UserErrors';
import { CreateAuth } from '../models/creation/CreateAuth';
import { RefreshAuth } from '../models/creation/RefreshAuth';
@ -29,8 +29,10 @@ export class AuthController {
}
@Post("/refresh")
@ResponseSchema(InvalidCredentialsError)
@ResponseSchema(JwtNotProvidedError)
@ResponseSchema(IllegalJWTError)
@ResponseSchema(UserNotFoundError)
@ResponseSchema(RefreshTokenCountInvalidError)
@OpenAPI({ description: 'refresh a access token' })
async refresh(@Body({ validate: true }) refreshAuth: RefreshAuth) {
let auth;