1- import { Controller , Get , Query , Req , Res , UseGuards } from '@nestjs/common' ;
1+ import {
2+ BadRequestException ,
3+ Controller ,
4+ Get ,
5+ Query ,
6+ Req ,
7+ Res ,
8+ UseGuards ,
9+ } from '@nestjs/common' ;
210import { UserService } from 'src/user/user.service' ;
311import {
412 GetJwtInfoSwagger ,
@@ -13,8 +21,6 @@ import { NaverAuthGuard } from './guards/naver.auth.guard';
1321import { AuthGuard } from './guards/jwt.auth.guard' ;
1422import { BaseResponse } from '../common/response/dto' ;
1523import { GetUserInfo } from 'src/user/dto/response/user.response' ;
16- import dayjs from 'dayjs' ;
17-
1824@Controller ( 'auth' )
1925@ApiTags ( '[서비스] Auth 관련' )
2026export class AuthController {
@@ -66,16 +72,12 @@ export class AuthController {
6672 @GetJwtInfoSwagger ( 'JWT 토큰 정보 조회 API' )
6773 @Get ( '/me' )
6874 async test ( @Req ( ) req : Request ) : Promise < BaseResponse < GetUserInfo > > {
69- const user = await this . userService . getUserById ( req . user ?. id ) ;
70- return new BaseResponse < GetUserInfo > ( true , 'SUCCESS' , {
71- id : user . id ,
72- email : user . email ,
73- nickname : user . nickname ,
74- profilePictureUrl : user . profilePictureUrl ,
75- name : user . name ,
76- phoneNumber : user . phoneNumber ,
77- birthDate : dayjs ( user . birthDate ) . format ( 'YYYY-MM-DD' ) ,
78- bio : user . bio ,
79- } ) ;
75+ console . log ( req . user ) ;
76+ const user = await this . userService . getUserWithTag ( req . user ?. id ) ;
77+ if ( ! user ) throw new BadRequestException ( 'User not found' ) ;
78+
79+ const userInfo = new GetUserInfo ( user ) ;
80+
81+ return new BaseResponse < GetUserInfo > ( true , 'SUCCESS' , userInfo ) ;
8082 }
8183}
0 commit comments