-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#31 제휴게시글 관련 기능 구현 #46
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. WalkthroughPostRequest의 place를 문자열에서 SavedPlaceInfo DTO로 변경하고 StudentCouncilPost.place를 Place 엔티티로 마이그레이션했으며, Partnership 도메인(엔티티/서비스/컨트롤러/DTO), 지오코더 통합(GeoCoderClient/AddressResponse/예외), 지도 기반 검색 및 관련 저장소 쿼리, Kakao OAuth 코드 기반 로그인 변경 등을 추가/확장했습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PostController as StudentCouncilPostController
participant PostService as StudentCouncilPostService
participant PlaceService
participant PostMapper as StudentCouncilPostMapper
participant PostRepo as StudentCouncilPostRepository
participant PartnershipService
Client->>PostController: POST /api/council-post (PostRequest with SavedPlaceInfo)
PostController->>PostService: create(councilId, dto, ...)
PostService->>PlaceService: findOrCreatePlace(dto)
PlaceService-->>PostService: Place
PostService->>PostMapper: createStudentCouncilPost(writer, place, dto, ...)
PostMapper-->>PostService: StudentCouncilPost
PostService->>PostRepo: save(post)
PostRepo-->>PostService: saved post
PostService->>PartnershipService: create(post, place)
PartnershipService-->>PostService: Partnership
PostService-->>PostController: GetPostResponse
PostController-->>Client: CommonResponse<GetPostResponse>
sequenceDiagram
participant Client
participant PlaceController
participant GeoCoderClient as GeoCoderClient (VWorld)
participant PlaceService
participant NaverAPI as Naver Map API
participant PlaceMapper
Client->>PlaceController: GET /places (lat,lng)
PlaceController->>GeoCoderClient: getAddress(lat,lng)
GeoCoderClient-->>PlaceController: AddressResponse
PlaceController->>PlaceService: search(lat,lng,keyword)
PlaceService->>NaverAPI: search(composedAddress + keyword)
NaverAPI-->>PlaceService: place results
PlaceService->>PlaceMapper: toSavedPlaceInfo(...)
PlaceMapper-->>PlaceService: SavedPlaceInfo list
PlaceService-->>PlaceController: List<SavedPlaceInfo>
PlaceController-->>Client: ResponseEntity<List<SavedPlaceInfo>>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 분 Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (39)
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. Comment |
1winhyun
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.
수고하셨습니다!!
| PostCategory category, | ||
| String title, | ||
| String place, | ||
| 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.
해당 response의 경우 필요한 부분은 placeId가 아닌 placeName입니다. 프론트에 보내줘야할 응답값은 해당 장소가 어디인지가 아닌 해당 장소의 이름이기 때문입니다!!
| post.getTitle(), | ||
| post.getPlace(), | ||
| post.isEvent() ? post.getStartDateTime() : post.getEndDateTime(), | ||
| post.getPlace().getPlaceId(), |
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.
따라서 해당 부분 또한 getPlaceName()이 되어야합니다.
| // | ||
| // public StudentCouncilPost createStudentCouncilPost(StudentCouncil writer, PostRequest dto, | ||
| // LocalDateTime startDateTime, LocalDateTime endDateTime, Place place) { |
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.
해당 주석은 삭제해도 될 것 같아요!!
| //제휴 엔티티 생성 | ||
| partnershipService.create(post, place); |
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.
이 부분은 삭제해주시면 될 것 같아요!!
| private boolean isLiked(Place place, User user) { | ||
| return likedPlacesRepository.existsByUserAndPlace(user, place); | ||
| } | ||
|
|
||
| private List<String> getImgUrls(StudentCouncilPost post) { | ||
| return postImageRepository.findImageUrlsByPost(post); | ||
| } |
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.
해당 메서드는 private 메서드이기에 가장 하단 부분에 위치한다면 전체적인 코드의 가독성이 높아질 수 있을 것 같아요!!
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.
해당 dto는 사용되지 않는 것 같은데 확인 후 삭제 부탁드려요!
| private String resolveTag(StudentCouncilPost post, User user) { | ||
| CouncilType councilType = post.getWriter().getCouncilType(); | ||
| return switch (councilType) { | ||
| case SCHOOL_COUNCIL -> "총학생회"; |
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.
'총학생회'와 같이 이름을 하드코딩하지 말고 다음과 같이 user에서 가져오는 형식으로 부탁드려요!!
case SCHOOL_COUNCIL -> user.getSchool().getSchoolName();
| public String toStringAddress(AddressResponse nowAddress) { | ||
| return nowAddress.getResponse().getResult().stream() | ||
| .filter(r -> "road".equalsIgnoreCase(r.getType()) || "parcel".equalsIgnoreCase(r.getType())) | ||
| .findFirst() | ||
| .map(AddressResponse.Result::getText) | ||
| .orElse(null); | ||
| } |
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.
해당 로직은 PlaceService 내 private 메서드로 구현 부탁드려요!!
| //이미 Place 존재하는지 확인 | ||
| Optional<Place> existing = placeRepository.findByPlaceKey(placeKey); | ||
| if (existing.isPresent()) { | ||
| return existing.get(); | ||
| } | ||
|
|
||
| //저장되어 있지 않는 Place의 경우, 객체 생성 후 저장 | ||
| return placeRepository.save(placeMapper.createPlace(place)); |
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 existing.orElseGet(() -> placeRepository.save(placeMapper.createPlace(place))); 이런식으로 단일식으로 간소화되어 표현할 수 있을 것 같아요!!
| AddressResponse response = webClient.get() | ||
| .uri(uriBuilder -> uriBuilder | ||
| .path("/req/address") | ||
| .queryParam("service", "address") | ||
| .queryParam("request", "getAddress") | ||
| .queryParam("key", apiKey) | ||
| .queryParam("point", lng + "," + lat) | ||
| .queryParam("crs", "epsg:4326") | ||
| .queryParam("type", "both") | ||
| .queryParam("format", "json") | ||
| .build()) | ||
| .retrieve() | ||
| .onStatus( | ||
| status -> status.isError(), | ||
| res -> Mono.error(new GeoCoderException()) | ||
| ) | ||
| .bodyToMono(AddressResponse.class).block(); | ||
|
|
||
| return response; |
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 webClient.get()
.uri(uriBuilder -> uriBuilder
.path("/req/address")
.queryParam("service", "address")
.queryParam("request", "getAddress")
.queryParam("key", apiKey)
.queryParam("point", lng + "," + lat)
.queryParam("crs", "epsg:4326")
.queryParam("type", "both")
.queryParam("format", "json")
.build())
.retrieve()
.onStatus(
HttpStatusCode::isError,
res -> Mono.error(new GeoCoderException())
)
.bodyToMono(AddressResponse.class).block();
🔀 변경 내용
✅ 작업 항목
📸 스크린샷 (선택)
📎 참고 이슈
관련 이슈 번호 #31
Summary by CodeRabbit
새로운 기능
개선 사항
문서
✏️ Tip: You can customize this high-level summary in your review settings.