[week09] 도얏 9주차 미션#38
Open
higashiaka wants to merge 10 commits into
Open
Conversation
si-zero
reviewed
Jun 2, 2026
Contributor
si-zero
left a comment
There was a problem hiding this comment.
소셜 로그인 기능이 만들다가 만 느낌으로 보이지 않습니다. 확인 부탁드려용
Contributor
There was a problem hiding this comment.
Prisma 스키마에서 ID 필드들이 BigInt로 설계되어 있습니다. 자바스크립트/타입스크립트 환경에서 BigInt를 다룰 때는 주의가 필요합니다.
일부 컨트롤러나 서비스 레이어에서 URL 파라미터를 받을 때 Number(memberId)와 같이 일반 숫자로 캐스팅하여 넘겨주는 부분이 존재합니다. 자바스크립트의 Number는 큰 대형 정수를 정확히 표현하지 못해 값이 왜곡될 수 있습니다
데이터베이스와 통신하는 모든 ID 값은 컨트롤러 진입 단계(DTO 혹은 라우터)에서부터 안정적으로 BigInt(memberId)를 사용하도록 통일하고, 문자열로 안전하게 변환하여 응답하도록 아키텍처 규칙을 일관되게 정립하는 것이 좋습니다.
Comment on lines
+15
to
+32
| export const signUp = async (data: MemberSignUpRequest) => { | ||
| // TSOA required 검증 이후에도 빈 문자열 입력은 서비스에서 한 번 더 방어합니다. | ||
| if (!data.name) { | ||
| throw new BaseError(ErrorCode.MEMBER_REQUIRED_FIELD) | ||
| } | ||
|
|
||
| const hashedPassword = data.password ? await bcrypt.hash(data.password, 10) : null | ||
|
|
||
| const memberData = bodyToMember(data) | ||
| const memberId = await addUser({ ...memberData, ...(hashedPassword ? { password: hashedPassword } : {}) }) | ||
|
|
||
| if (memberId === null) { | ||
| throw new BaseError(ErrorCode.DUPLICATE_EMAIL) | ||
| } | ||
|
|
||
| const member = await getUser(memberId) | ||
| return responseFromMember(member) | ||
| } |
Contributor
There was a problem hiding this comment.
회원가입 시 프로필을 동시에 생성하거나, 미션 도전을 시작할 때 관련된 로그를 남기는 등 동시에 2개 이상의 테이블에 값을 추가/수정하는 비즈니스 로직들이 존재합니다.
트랜잭션을 이용하여 롤백되도록 안전장치를 마련하는게 좋아보입니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.