-
Notifications
You must be signed in to change notification settings - Fork 22
[김재욱] Sprint 10 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[김재욱] Sprint 10 #39
The head ref may contain hidden characters: "express-\uAE40\uC7AC\uC6B1"
Conversation
reach0908
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생많으셨습니다.
코드들이 전반적으로 깔끔하고 가독성이 좋은 것 같습니다!
크리티컬한 부분은 없으나 미리 습관을 들여두면 좋은 부분들 위주로 개선사항을 적어보았습니다.
| const accessToken = generateAccessToken(newUserInfo.id); | ||
| const refreshToken = generateRefreshToken(newUserInfo.id); | ||
| await authService.saveRefreshToken(newUserInfo.id, refreshToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1]
토큰 모듈 같은 것들을 통해 전체 토큰을 발급하고 저장하는 것을 관리하는 서비스 로직으로 합치면 좋을 것 같습니다.
| let articleId = null; | ||
| let productId = null; | ||
|
|
||
| if (itemType === 'articles') { | ||
| articleId = itemId; | ||
| } else if (itemType === 'products') { | ||
| productId = itemId; | ||
| } else { | ||
| return res.status(400).json({ message: '잘못된 itemType입니다.' }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2]
이런 검증 및 파라미터의 변환은 미들웨어를 통해 해주는 것도 좋습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 변수들을 확인하고 넣어주는 과정에서 아래 진행되는 parseInt 작업도 이 단계에서도 해줘도 괜찮을 것 같습니다.
| const existingUserByEmail = await userRepository.findUserByEmail(email); | ||
| if (existingUserByEmail) { | ||
| const error = new Error('이미 존재하는 이메일입니다.'); | ||
| error.code = 409; | ||
| throw error; | ||
| } | ||
|
|
||
| const existingUserBynickname = await userRepository.findUserBynickname(nickname); | ||
| if (existingUserBynickname) { | ||
| const error = new Error('이미 존재하는 닉네임입니다.'); | ||
| error.code = 409; | ||
| throw error; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1]
실행 순서는 관계없는 부분인 것 같으니 병렬적으로 처리해보면 어떨까요?
| console.log("articleId:", articleId) | ||
| console.log("productId:",productId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0]
항상 디버깅용 console.log는 삭제하고 리모트에 푸쉬하는 습관을 길러주세요!
3f81c54
into
codeit-sprint-fullstack:express-김재욱
요구사항
기본
공통
상품 등록
상품 상세
좋아요 기능
에러 처리
라우트 중복 제거
인증
상품 기능 인가
게시글 기능 인가
댓글 기능 인가
심화
상태코드 (웹 API 관련)
인증
적용)
OAuth를 활용한 인증
프로젝트 구조 변경
(생략 가능) 자유게시판 게시물 등록
는 최대 3개까지만 등록 가능하도록 구현해 주세요.
주요 변경사항
멘토에게