Skip to content

Conversation

@suyeon0421
Copy link
Collaborator

@suyeon0421 suyeon0421 commented Nov 27, 2025

🚀 작업한 기능 설명 (Feature Description)

  • 새로운 API를 만들어서 자기 자신의 정보를 수정하는 API 작성
  • 인증 시스템(JWT) 을 그동안 만들었던 기존 API들에 적용

🔍 작업 상세 (Implementation Details)

  • 작업한 주요 사항이나 세부 내용을 설명해주세요.

🖼️ 이미지 첨부 (Images)

📋 관련 자료 (Related Resources)

  • 워크북 참고했습니다.

📝 추가 정보 (Additional Information)

  • 에러 처리와 스웨거 에러 부분 작성 등 못한 부분은 이번 주말 안으로 끝내겠습니다......................

Copy link
Collaborator

@KateteDeveloper KateteDeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWT 구현을 잘 해주셨습니다! 수고 많으셨습니다:)

Copy link
Collaborator

@soyun0318 soyun0318 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLogin 미들웨어들 적절한 곳에 잘 적용한 것 같아요!

Copy link
Collaborator

@ywkim1m ywkim1m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구글 로그인 구현 깔끔하게 잘해주신 것 같습니다! 수고하셨습니다!!

Copy link
Collaborator

@jeongkyueun jeongkyueun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth.config.js 기존 API에 JWT 잘 적용하신 거 같아요!! 오류도 잘 해결되시길 바랄게요 수고 많으셨습니다!!

Copy link
Collaborator

@hyeeon hyeeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소셜로그인과 JWT 모두 구현 잘 해주신 것 같아요! 수고 많으셨습니다!

Copy link
Contributor

@Hminkyung Hminkyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9주차 미션 수행하느라 너무 고생 많으셨어요!!! 전체적으로 미션 수행을 잘해주셨고 깔끔합니다!! 이제 스터디 한주 남았으니까 마지막까지 화이팅이에요!! 고생하셨습니다아~~~

await setPreference(joinUserId, preference);
}

const user = await getUser(joinUserId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에 있는
for (const preference of data.preferences) {
await setPreference(joinUserId, preference);
}

이 부분에서 setPreference(userId, foodCategoryId)가 중복 insert를 막고 있지 않아요! Prisma 스키마에도 @@unique([userId, foodCategoryId]) 같은 unique 제약이 없기 때문에 회원가입 한번 할 때 같은 카테고리를 여러번 넣으면 DB에 중복 행이 들어가는 이슈가 발생해요!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prisma 모델에 UNIQUE 제약 조건 추가 또는 setPreference 내부에서 존재 여부를 먼저 검사하는 방식이 좋아보입니다!
const exists = await prisma.userFavorCategory.findFirst({
where: { userId, foodCategoryId }
});
if (!exists) {
await prisma.userFavorCategory.create({ data: { userId, foodCategoryId }});
}


return responseFromUser({ user, preferences });
const accessToken = jwt.sign(
{ id: user.id, email: user.email }, // Payload: 사용자 ID와 이메일
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

회원가입 DTO에는 preferences가 필수로 들어있는데 Swagger에서는 명시가 되어있지 않아요! Swagger에서 preferences를 필수 항목으로 명시하거나 DTO에서 preferences 필수 여부를 선택으로 하는게 좋아보입니다!

data: {
email,
name: profile.displayName,
gender: "추후 수정",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후 수정이라는 값이 DB에 남는 것보다는 빈 문자열 혹은 각각에 어떤 식으로 들어갈 지 고려해서 넣는것도 좋을 것 같아요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants