api login
This commit is contained in:
parent
bd0daf5858
commit
1a7473362b
8 changed files with 613 additions and 60 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Body, Post, Route, Tags, SuccessResponse, Response, Example } from 'tsoa';
|
||||
import { Body, Post, Route, Tags, SuccessResponse, Response, Example, Controller } from 'tsoa';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import {
|
||||
LoginRequest,
|
||||
|
|
@ -18,7 +18,7 @@ export class AuthController {
|
|||
|
||||
/**
|
||||
* User login
|
||||
* @summary Login with username and password
|
||||
* @summary Login with email and password
|
||||
* @param body Login credentials
|
||||
* @returns JWT token and user information
|
||||
*/
|
||||
|
|
@ -52,7 +52,8 @@ export class AuthController {
|
|||
})
|
||||
public async login(@Body() body: LoginRequest): Promise<LoginResponse> {
|
||||
// Validate input
|
||||
const { error } = loginSchema.validate(body);
|
||||
const { error, value } = loginSchema.validate(body);
|
||||
|
||||
if (error) {
|
||||
throw new ValidationError(error.details[0].message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue