File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { CreateUserDto } from './dto/create-user.dto';
44import { UsersService } from './users.service' ;
55import { UserDto } from './dto/user.dto' ;
66import { ApiUseTags , ApiOkResponse } from '@nestjs/swagger' ;
7+ import { UserLoginResponseDto } from './dto/user-login-response.dto' ;
78
89@Controller ( 'users' )
910@ApiUseTags ( 'users' )
@@ -20,7 +21,7 @@ export class UsersController {
2021 @HttpCode ( 200 )
2122 async login (
2223 @Body ( ) userLoginRequestDto : UserLoginRequestDto ,
23- ) : Promise < string > {
24+ ) : Promise < UserLoginResponseDto > {
2425 return this . usersService . login ( userLoginRequestDto ) ;
2526 }
2627
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { UserDto } from './dto/user.dto';
55import { UserLoginRequestDto } from './dto/user-login-request.dto' ;
66import { CreateUserDto } from './dto/create-user.dto' ;
77import { AuthService } from './../shared/auth/auth.service' ;
8+ import { UserLoginResponseDto } from './dto/user-login-response.dto' ;
89
910@Injectable ( )
1011export class UsersService {
@@ -53,7 +54,9 @@ export class UsersService {
5354 }
5455 }
5556
56- async login ( userLoginRequestDto : UserLoginRequestDto ) : Promise < string > {
57+ async login (
58+ userLoginRequestDto : UserLoginRequestDto ,
59+ ) : Promise < UserLoginResponseDto > {
5760 const email = userLoginRequestDto . email ;
5861 const password = userLoginRequestDto . password ;
5962
@@ -73,6 +76,7 @@ export class UsersService {
7376 ) ;
7477 }
7578
76- return await this . authService . signToken ( user ) ;
79+ const token = await this . authService . signToken ( user ) ;
80+ return new UserLoginResponseDto ( user , token ) ;
7781 }
7882}
You can’t perform that action at this time.
0 commit comments