Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AuthService } from './auth.service';
import { User } from '../types/User';
import { Response } from 'express';
import { VerifyAdminRoleGuard, VerifyUserGuard } from "../guards/auth.guard";
import { RegisterBody } from './types/auth.types';
import { LoginBody, RegisterBody } from './types/auth.types';
import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';

@Controller('auth')
Expand Down Expand Up @@ -43,14 +43,14 @@ export class AuthController {
status : 201,
description : "User registered successfully"
})
@ApiResponse({
status : 400,
description : "{Error encountered}"}
)
@ApiResponse({
status: 500,
description : "Internal Server Error"
})
@ApiResponse({
status : 400,
description : "{Error encountered}"}
)
@ApiResponse({
status: 409,
description : "{Error encountered}"
Expand All @@ -65,8 +65,7 @@ export class AuthController {
@Post('login')
async login(
@Res({ passthrough: true }) response: Response,
@Body('username') username: string,
@Body('password') password: string,
@Body() body:LoginBody
): Promise<{
user: User;
session?: string;
Expand All @@ -75,7 +74,7 @@ export class AuthController {
username?: string;
position?: string;
}> {
const result = await this.authService.login(username, password);
const result = await this.authService.login(body.username, body.password);

// Set cookie with access token
if (result.access_token) {
Expand Down