Skip to content

Conversation

@jeongkyueun
Copy link
Collaborator

@jeongkyueun jeongkyueun commented Nov 26, 2025

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

  • 8주차 미션 피드백 반영
  • 9주차 미션1: 사용자 정보 접근 시 하드코딩 제거 및 동적 조회 로직 구현
  • 9주차 미션2: 인증된 사용자 정보 갱신을 위한 PATCH /users/me API 구현
  • 9주차 미션3: JWT 인증 시스템을 주요 API에 적용하여 접근 보호 강화
  • 문서화: 영어 문서/설명 한글 번역 추가

🔍 작업 상세 (Implementation Details)

9주차 미션1

  • 사용자 정보 접근 시 하드코딩된 값을 제거하고 동적 조회 로직 적용
  • 데이터베이스에서 사용자 정보를 실시간으로 조회하도록 개선

9주차 미션2

  • PATCH /users/me API를 구현하여 인증된 사용자 정보 업데이트 기능 추가
  • 요청 본문 유효성 검증 로직 구현
  • 보안을 통한 민감 정보 보호

9주차 미션3

  • JWT 인증 미들웨어를 주요 API 엔드포인트에 적용
  • 인증되지 않은 사용자의 접근 차단
  • 토큰 검증 및 사용자 인증 프로세스 강화

문서화

  • Swagger API 문서 한글화
  • 오류 메시지 및 응답 포맷 일관성 유지
  • API 엔드포인트별 상세 설명 추가

인증된 사용자 정보 조회

GET /api/v1/users/me
Authorization: Bearer <jwt_token>

사용자 정보 수정

PATCH /api/v1/users/me
Authorization: Bearer <jwt_token>
{
  "name": "새로운 이름",
  "phoneNumber": "01012345678"
}

🖼️ 이미지 첨부 (Images)

image

📋 관련 자료 (Related Resources)

  • 기능 구현에 참고한 자료(링크, 문서 등)가 있다면 여기에 첨부해주세요.

📝 추가 정보 (Additional Information)

  • 모든 API는 인증이 필요합니다 (JWT 토큰 필요)
  • 토큰은 Authorization 헤더에 Bearer 스키마로 전송
  • API 문서는 /docs 경로에서 확인 가능

@jeongkyueun jeongkyueun self-assigned this Nov 26, 2025
@jeongkyueun jeongkyueun added the enhancement New feature or request label Nov 26, 2025
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.

관리자 권환 확인까지 추가한 게 좋은 것 같아요!

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.

구글 로그인 api 연동을 너무 잘해주셨습니다! 너무 수고 많으셨습니다:)

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

@suyeon0421 suyeon0421 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

@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.

API 적용 잘 해주신 것 같아요 수고 많으셨어요!!

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주차 미션까지 수행하느라 고생많으셨씁니다!!!! 이제 한주 남았으니까 한주동안 화이팅 해봅시다!! 배포 화이팅!!!!

}
}),
// 기존 선호 카테고리 삭제
prisma.userPreference.deleteMany({
Copy link
Contributor

Choose a reason for hiding this comment

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

prisma에 올바르게 접근하기 위해서는 prisma와 동일한 모델명을 작성해야 합니다! 근데 현재 내부 트랜잭션에서
prisma.userPreference.deleteMany()
prisma.userPreference.createMany()
이렇게 작성되고 있는데 전부 모델명이 잘못되어서 실행이 안됩니다! 모두 userPregerence -> userFavorCategory로 이름을 통일하는 형식으로 진행이 되어야 해요!

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.

prisma 스키마에서 제로가 정의한 gender는 enum이 아니라 string이에요! String이라 오류는 나지 않지만 서비스 로직 전체가 Male, Female, Other 형태로 가는데 Google 유저만 문자열 형태가 다릅니다! 이 경우에는 updateUser나 responseDTO에서 불일치 가능성이 높아요!
그리고 preferences도 하나도 안 만들어지고 잇어요!

1.Google 생성시 모든 기본 값을 회원가입과 동일한 형식으로 맞춰야하고
2. preferences =[] 초기화도 필요해요!
3. gender를 enum처럼 관리할거라면 변환도 필요하겠죠!


throw error;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

비상 !!!!!!! 아래에 있는 getUserByEmail과 authenticateUser 로 인해 로그인이 절대 성공할 수 없어요! getUserByEmail에서 이미 pw를 제거했기 때문에 user.password는 항상 undefined가 되고 그렇게 되면 비밀번호가 일치하지 않습니다가 항상 발생해요! 그렇다면 로그인은 절대 성공할 수 없겠죠!
const user = await getUserByEmail(email);
-> 여기 부분에서 pw가 제거되고
const isPasswordValid = await comparePasswords(password, user.password);
-> 여기에서 user.pw는 undefined가 되고 있쬬!!

Copy link
Contributor

Choose a reason for hiding this comment

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

만약에 해결하고 싶다면 excludeSensitiveData 호출을 제거하고
export const getUserByEmail = async (email) => {
const user = await prisma.user.findUnique({ where: { email } });
return user;
};
password 포함 그대로 반환을 하면 될겁니다! 그리고
return excludeSensitiveData(user);
authenticateUser의 마지막에서만 pw 제거하면 됩니다!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants