Feature/mission 09/조우#70
Hidden character warning
Conversation
KateteDeveloper
left a comment
There was a problem hiding this comment.
JWT 구현을 잘 해주셨습니다! 수고 많으셨습니다:)
soyun0318
left a comment
There was a problem hiding this comment.
isLogin 미들웨어들 적절한 곳에 잘 적용한 것 같아요!
ywkim1m
left a comment
There was a problem hiding this comment.
구글 로그인 구현 깔끔하게 잘해주신 것 같습니다! 수고하셨습니다!!
jeongkyueun
left a comment
There was a problem hiding this comment.
auth.config.js 기존 API에 JWT 잘 적용하신 거 같아요!! 오류도 잘 해결되시길 바랄게요 수고 많으셨습니다!!
hyeeon
left a comment
There was a problem hiding this comment.
소셜로그인과 JWT 모두 구현 잘 해주신 것 같아요! 수고 많으셨습니다!
Hminkyung
left a comment
There was a problem hiding this comment.
9주차 미션 수행하느라 너무 고생 많으셨어요!!! 전체적으로 미션 수행을 잘해주셨고 깔끔합니다!! 이제 스터디 한주 남았으니까 마지막까지 화이팅이에요!! 고생하셨습니다아~~~
| @@ -36,5 +40,28 @@ export const userSignUp = async (data) => { | |||
| const user = await getUser(joinUserId); | |||
There was a problem hiding this comment.
위에 있는
for (const preference of data.preferences) {
await setPreference(joinUserId, preference);
}
이 부분에서 setPreference(userId, foodCategoryId)가 중복 insert를 막고 있지 않아요! Prisma 스키마에도 @@unique([userId, foodCategoryId]) 같은 unique 제약이 없기 때문에 회원가입 한번 할 때 같은 카테고리를 여러번 넣으면 DB에 중복 행이 들어가는 이슈가 발생해요!
There was a problem hiding this comment.
prisma 모델에 UNIQUE 제약 조건 추가 또는 setPreference 내부에서 존재 여부를 먼저 검사하는 방식이 좋아보입니다!
const exists = await prisma.userFavorCategory.findFirst({
where: { userId, foodCategoryId }
});
if (!exists) {
await prisma.userFavorCategory.create({ data: { userId, foodCategoryId }});
}
src/services/user.service.js
Outdated
|
|
||
| return responseFromUser({ user, preferences }); | ||
| const accessToken = jwt.sign( | ||
| { id: user.id, email: user.email }, // Payload: 사용자 ID와 이메일 |
There was a problem hiding this comment.
JWT payload에는 id와 email만 넣는데 필수 사용자 옵션은 성별, 생일, 주소 라서 이런 경우에는 추후 업데이트 플로우가 꼬일 수 있어요! 예를 들어서 특정 API들이 user의 전화번호/닉네임 등의 유효성 상태를 체크한다고 하면 이때는 JWT 정보 부족 문제가 발생할 수 있어요!
| import { userSignUp } from "../services/user.service.js"; | ||
| import { userSignUp, userUpdateInfo } from "../services/user.service.js"; | ||
|
|
||
| export const handleUserSignUp = async (req, res, next) => { |
There was a problem hiding this comment.
회원가입 DTO에는 preferences가 필수로 들어있는데 Swagger에서는 명시가 되어있지 않아요! Swagger에서 preferences를 필수 항목으로 명시하거나 DTO에서 preferences 필수 여부를 선택으로 하는게 좋아보입니다!
| data: { | ||
| email, | ||
| name: profile.displayName, | ||
| gender: "추후 수정", |
There was a problem hiding this comment.
추후 수정이라는 값이 DB에 남는 것보다는 빈 문자열 혹은 각각에 어떤 식으로 들어갈 지 고려해서 넣는것도 좋을 것 같아요!
🚀 작업한 기능 설명 (Feature Description)
🔍 작업 상세 (Implementation Details)
🖼️ 이미지 첨부 (Images)
📋 관련 자료 (Related Resources)
📝 추가 정보 (Additional Information)