Skip to content

9주차미션_unyeon#39

Open
gkdmsgus wants to merge 1 commit into
mainfrom
week09_unyeon
Open

9주차미션_unyeon#39
gkdmsgus wants to merge 1 commit into
mainfrom
week09_unyeon

Conversation

@gkdmsgus
Copy link
Copy Markdown
Member

Summary

  • JWT 인증 미들웨어 (isLogin) 추가
  • 로그인 API 추가 (POST /api/v1/members/login) - JWT 발급
  • 회원 정보 수정 API 추가 (PATCH /api/v1/members/:memberId)
  • 하드코딩된 memberId = 1 제거 → JWT에서 추출
  • 리뷰 작성, 미션 추가/도전 등 로그인 필요 API에 인증 미들웨어 적용

Test plan

  • 회원가입 후 로그인 → accessToken 발급 확인
  • 토큰 없이 보호된 API 접근 시 401 응답 확인
  • 토큰 포함 후 리뷰 작성, 미션 도전 정상 동작 확인
  • 회원 정보 수정 API 동작 확인

Copy link
Copy Markdown
Contributor

@si-zero si-zero left a comment

Choose a reason for hiding this comment

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

현재 소셜 로그인 관련 코드가 보이지 않습니다. 해당 부분 확인 부탁드립니다!

}
*/
try {
const storeId = Number(req.params.storeId)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

현재 컨트롤러에서는 storeId 를 Number 로 변환하고, 레포지토리에서는 BigInt로 변환하고 있습니다.
해당 부분 통일하고, 변환 하는 로직을 하나의 파일에 몰아서 같이 처리하면 좋을 것 같습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

현재 mission.dto, store.dto 둘 다 응답 변환 로직을 보면 Prisma가 반환하는 객체의 필드명과 DTO가 기대하는 필드명이 매칭되지 않아 undefined가 내려갈 위험이 있습니다.

schema.prisma에서 member 테이블의 필드는 @Map("social_type") 형식을 사용하여 Prisma Client 스크립트 상에서는 camelCase(socialType)로 바뀝니다.

하지만 store.dto.js를 보면 store.region_id, store.food_category_id, store.created_at 등 snake_case로 접근하고 있습니다. 이로 인해 실제 API 응답 시 해당 값들이 모두 null이나 undefined로 반환될 수 있습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

특정 사용자의 정보를 조회하거나 수정할 때 isLogin 미들웨어만 통과하면 다른 사람의 memberId를 경로에 넣어도 요청이 처리되는 인가(Authorization) 결함이 존재합니다.

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.

2 participants