-
Notifications
You must be signed in to change notification settings - Fork 1
[fix] 유저 웨이블존 저장 및 조회 관련 API 수정 #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough사용자 장소 기능을 분리/확장: 기존 저장 API를 “리스트 생성”으로 전환하고, 리스트에 웨이블존 추가/삭제 엔드포인트를 도입. 서비스는 리스트 생성과 존 추가 로직을 분리 구현. 사용자 에러에 중복 제목 코드 추가. 인증 에러의 UNAUTHORIZED 코드 값을 변경. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant UC as UserPlaceController
participant US as UserPlaceService
participant UR as UserRepository
participant PR as UserPlaceRepository
C->>UC: POST /api/v1/users/places (title,color)
UC->>US: createPlaceList(userId, request)
US->>UR: findById(userId)
UR-->>US: User
US->>PR: existsByUserAndTitle(user,title)
PR-->>US: boolean
alt 제목 중복
US-->>UC: throw PLACE_TITLE_DUPLICATED (400)
UC-->>C: Error response
else 생성
US->>PR: save(new UserPlace(title,colorOrGRAY))
PR-->>US: saved Place (id)
US-->>UC: placeId
UC-->>C: 200 {placeId,title,color,message}
end
sequenceDiagram
autonumber
participant C as Client
participant UC as UserPlaceController
participant US as UserPlaceService
participant PR as UserPlaceRepository
participant ZR as WaybleZoneRepository
participant MR as UserPlaceWaybleZoneMappingRepository
C->>UC: POST /api/v1/users/places/zones (placeId, zoneIds[])
UC->>US: addZonesToPlace(userId, placeId, zoneIds)
US->>PR: findByIdAndUser(placeId,user)
PR-->>US: Place | null
alt place 없음
US-->>UC: throw PLACE_NOT_FOUND
UC-->>C: Error response
else 처리
US->>US: LinkedHashSet으로 zoneIds 중복 제거
loop 각 zoneId
US->>ZR: findById(zoneId)
ZR-->>US: Zone | null
alt zone 없음
US->>US: skip (WAYBLE_ZONE_NOT_FOUND throw 여부는 호출부 정의대로)
else 존재
US->>MR: existsByPlaceAndZone(place, zone)
MR-->>US: boolean
alt 미매핑
US->>MR: save(new Mapping(place, zone))
US->>US: place.savedCount++, zone.likes++
US->>ZR: save(zone)
else 이미 매핑
US->>US: skip
end
end
end
US->>PR: save(place) (필요 시)
US-->>UC: void
UC-->>C: 200 "리스트에 웨이블존이 추가되었습니다."
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (7)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
KiSeungMin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고 많으셨습니다!!
| import java.util.List; | ||
|
|
||
| public record UserPlaceAddZonesRequestDto( | ||
| @NotNull Long placeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하나의 플래이스 리스트에 동시에 여러 개의 웨이블존을 추가하는 경우는 없을 것 같습니다!
반대로 하나의 웨이블존을 동시에 여러 개의 플레이스 리스트에 넣는 기능은 현재 화면이 구현되어 있는 상태입니다!
따라서 placeId는 리스트로, waybleZoneId는 단일 Long 값으로 받는게 좋을 것 같다는 생각입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋㅋㅋ 반대로 했네요 ㅠ.ㅠ 수정했습니다
| return CommonResponse.success(summaries); | ||
| } | ||
|
|
||
| @DeleteMapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 엔드포인트에 /zones가 붙어야 할 것 같아요!
현재 상태면 아예 장소 리스트를 삭제하는 걸로 오해할 것 같습니다!
✔️ 연관 이슈
📝 작업 내용
1) 유저 장소 저장 API 이름, 역할 수정
POST => /api/v1/users/places
의미: 웨이블존을 저장할 리스트 생성
(기존) 웨이블존을 즉시 저장 -> (변경) 웨이블존을 저장하기 위한 리스트만 생성 (여기서 웨이블존 저장 X)
Request Body:
Response Body:
2) 리스트에 웨이블존 추가 API 구현
POST => /api/v1/users/places/zones
의미: 기존에 만든 리스트에 웨이블존을 추가 (여러개 가능)
Request Body:
Response Body:
3) 특정 장소 리스트에 대하여 페이징 조회 테스트
리스트에 웨이블존 여러개 저장하고 페이징 조회 해보면 각각 웨이블존에 대해서 여러개 조회 완료
🖼️스크린샷 (선택)
웨이블존 저장할 리스트 생성 성공
리스트에 웨이블존 추가 성공
특정 장소 리스트에 대하여 페이징 조회 성공
리스트에서 저장한 웨이블존 삭제 성공
Summary by CodeRabbit