ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 221228수_공부일지
    > Backend/NestJS 2022. 12. 29. 02:06

    1)  금일 진행 내용

       1.이메일 인증

    // Description:: 이메일 인증
    // CMD:: curl -X POST  http://localhost:3000/users/email-verify -H "Content-Type: application/json" -d '{"name": "name_example", "email":"email@example.com","password":"1234"}'
    @Post('/email-verify')
    async verifyEmail(@Query() dto: VerifyEmailDto): Promise<string>{
      const { signupVerifyToken } = dto;
      console.log('dto check:: ', JSON.stringify(dto))
      return await this.usersService.verifyEmail(signupVerifyToken);
    }
    async verifyEmail(signupVerifyToken: string): Promise<string>{
      // TODO
      // 1, DB에서 회원가입 처리중인 유저가 있는지 조회 및 처리
      // 2. 바로 로그인 상태가 되도록 JWT 발급
      throw new Error('Method not implemented.')
    }

       

     

       2. 로그인

    // Description:: 로그인
    // CMD:: curl -X POST  http://localhost:3000/users/login -H "Content-Type: application/json" -d '{"name": "name_example", "email":"email@example.com","password":"1234"}
    @Post('/login')
    async login(@Body() dto: UserLoginDto): Promise<string> {
      const { email, password } = dto;
      return await this.usersService.login(email, password)
    }

     

     

    async login(email: string, password: string): Promise<string>{
      // TODO
      // 1, DB에서 email과 password를 가진 유저가 있는지 확인하고, 없다면 에러 처리
      // 2.  JWT 발급
      // return '';
      throw new Error('Method not implemented.')
    }

     

       3. 유저 정보 조회 

     

    / Description:: 유저 정보 조회
    // CMD:: curl -X POST  http://localhost:3000/users/3 -H
    @Get('/:id')
    async getUserInfo(@Param('id') userId: string): Promise<UserInfo> {
      console.log('getUserInfo::: ', userId)
      return await this.usersService.getUserInfo(userId)
    }
    async getUserInfo(userId: string): Promise<UserInfo>{
      // TODO
      // 1, DB에서 userId 가진 유저가 있는지 확인하고, 없다면 에러 처리
      // 2. UserInfo 타입으로 응답
      // return '';
      throw new Error('Method not implemented.')
    }

     

       4. 공부 내용

    • singleton
    • inject
    • scope

    '> Backend > NestJS' 카테고리의 다른 글

    230102월_공부일지  (0) 2023.01.02
    20221229목_공부일지  (0) 2022.12.30
    20221227화_공부 일지  (0) 2022.12.28
    20221222Thu_공부 일지  (0) 2022.12.23
    20221221Wed_공부 일지  (0) 2022.12.22

    댓글

Designed by Tistory.