[FEAT/#406] 지도/제휴 조회 API에 카테고리·학생회 필터링 추가 - #430
Open
BAEK0111 wants to merge 3 commits into
Open
Conversation
- StoreCategory enum 추가 및 Store 엔티티에 storeCategory 필드 추가 - findAllWithinViewportWithPartner 쿼리에 storeCategory nullable 필터 조건 추가 - getLocations API에 storeCategory, adminId optional RequestParam 추가 (STUDENT 전용) - getStores 서비스 로직에 adminId 기반 papersByStore 필터링 추가 - 람다 내부 변수명 adminId → paperAdminId로 변경 (메서드 파라미터 섀도잉 제거)
- UserPaperRepository 쿼리에 storeCategory nullable 필터 조건 추가 - getUsablePartnership, getStores 서비스 시그니처에 storeCategory 파라미터 추가 - StudentController getUsablePartnership API에 storeCategory optional RequestParam 추가 및 Swagger 설명 업데이트 - MapServiceImplTest에 getStores 테스트 4건 추가 - StudentServiceImplTest에 storeCategory 필터링 테스트 추가 및 mock 파라미터 수정
4 tasks
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 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 |
- findActivePartnershipsByStudentId에 adminId nullable 파라미터 추가 - getStores 서비스 레벨 adminId 필터링 블록 제거 (쿼리로 대체) - getUsablePartnership에 adminId optional RequestParam 추가 - 관련 테스트 수정 및 adminId 필터링 테스트 추가
eeeeeaaan
reviewed
Aug 21, 2026
| @RequestParam(name = "all", defaultValue = "false") boolean all | ||
| ) { | ||
| return BaseResponse.onSuccess(SuccessStatus._OK, studentService.getUsablePartnership(pd.getId(), all)); | ||
| @RequestParam(name = "all", defaultValue = "false") boolean all, |
Contributor
There was a problem hiding this comment.
p5
all 파라미터 이름이 약간 모호한 것 같아요
요약 조회 목적이라면 previewOnly / isSummary 등으로 필드명을 좀더 구체적으로 바꾸는 것도 좋아보입니다.
| .filter(p -> p.getAdmin().getId().equals(adminId)) | ||
| .filter(p -> p.getAdmin().getId().equals(paperAdminId)) | ||
| .findFirst() | ||
| .map(p -> p.getAdmin().getName()) |
Contributor
There was a problem hiding this comment.
외부에서 먼저 admin name 으로 map을 시킨 후에 안에서 필터링을 하는게 탐색 시간에 대해 좋아보여요!!
.filter(p -> p.getAdmin() != null)
.collect(Collectors.toMap(
p -> p.getAdmin().getId(),
p -> p.getAdmin().getName(),
(existing, replacement) -> existing // 중복 id 방어
));
String adminName = adminNameMap.get(paperAdminId);
이런식으로요!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
📝작업 내용
기존
/map/nearby,/students/usableAPI는 필터링 없이 전체 결과를 반환했습니다.프론트 요구사항에 따라 카테고리(
storeCategory)와 학생회(adminId) 기준 필터링을 추가하되, 파라미터를 넘기지 않으면 기존과 동일하게 동작하도록 nullable optional로 구현했습니다.🔎코드 설명(스크린샷(선택))
StoreCategory enum 추가 및 Store 엔티티 연결
store/entity/enums/StoreCategory.java신규 추가Store엔티티에storeCategory필드 추가 (@Enumerated(EnumType.STRING))카테고리/학생회 필터링 — 쿼리 레벨 통합 처리
findActivePartnershipsByStudentId에storeCategory,adminId파라미터 추가AND (:storeCategory IS NULL OR s.storeCategory = :storeCategory),AND (:adminId IS NULL OR a.id = :adminId)조건 추가 → null이면 전체 조회GET /map/nearby(STUDENT),GET /students/usable양쪽에 적용adminId필터링 블록 제거API 파라미터
GET /map/nearby:storeCategory,adminIdoptional RequestParam 추가 (STUDENT 전용)GET /students/usable:storeCategory,adminIdoptional RequestParam 추가테스트
MapServiceImplTest:getStores테스트 4건 추가 및 수정 (adminId 필터링이 레포 레벨임을 verify로 검증)StudentServiceImplTest:storeCategory,adminId필터링 테스트 각 1건 추가💬고민사항 및 리뷰 요구사항 (Optional)
storeCategory,adminId모두findActivePartnershipsByStudentId쿼리 한 곳에서 처리합니다. 필터 조건이 늘어날 경우 Querydsl 도입을 고려할 수 있습니다.Store.storeCategory컬럼이 새로 추가되어 마이그레이션 필요합니다. 기존 데이터의storeCategory는 null 상태로 유지됩니다.비고 (Optional)
storeCategory,adminId모두 미전송 시 기존 API와 동일하게 동작합니다.