Skip to content

[FEAT/#406] 지도/제휴 조회 API에 카테고리·학생회 필터링 추가 - #430

Open
BAEK0111 wants to merge 3 commits into
developfrom
feat/#406-partnership-category
Open

[FEAT/#406] 지도/제휴 조회 API에 카테고리·학생회 필터링 추가#430
BAEK0111 wants to merge 3 commits into
developfrom
feat/#406-partnership-category

Conversation

@BAEK0111

@BAEK0111 BAEK0111 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

#️⃣연관된 이슈

close #406

📝작업 내용

기존 /map/nearby, /students/usable API는 필터링 없이 전체 결과를 반환했습니다.
프론트 요구사항에 따라 카테고리(storeCategory)와 학생회(adminId) 기준 필터링을 추가하되, 파라미터를 넘기지 않으면 기존과 동일하게 동작하도록 nullable optional로 구현했습니다.

🔎코드 설명(스크린샷(선택))

StoreCategory enum 추가 및 Store 엔티티 연결

  • store/entity/enums/StoreCategory.java 신규 추가
  • Store 엔티티에 storeCategory 필드 추가 (@Enumerated(EnumType.STRING))

카테고리/학생회 필터링 — 쿼리 레벨 통합 처리

  • findActivePartnershipsByStudentIdstoreCategory, 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, adminId optional RequestParam 추가 (STUDENT 전용)
  • GET /students/usable: storeCategory, adminId optional RequestParam 추가

테스트

  • MapServiceImplTest: getStores 테스트 4건 추가 및 수정 (adminId 필터링이 레포 레벨임을 verify로 검증)
  • StudentServiceImplTest: storeCategory, adminId 필터링 테스트 각 1건 추가

💬고민사항 및 리뷰 요구사항 (Optional)

  • storeCategory, adminId 모두 findActivePartnershipsByStudentId 쿼리 한 곳에서 처리합니다. 필터 조건이 늘어날 경우 Querydsl 도입을 고려할 수 있습니다.
  • Store.storeCategory 컬럼이 새로 추가되어 마이그레이션 필요합니다. 기존 데이터의 storeCategory는 null 상태로 유지됩니다.

비고 (Optional)

  • storeCategory, adminId 모두 미전송 시 기존 API와 동일하게 동작합니다.

- 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 파라미터 수정
@BAEK0111 BAEK0111 linked an issue Aug 20, 2026 that may be closed by this pull request
4 tasks
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4efde6be-52b3-4b18-884b-08982810291c


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- findActivePartnershipsByStudentId에 adminId nullable 파라미터 추가
- getStores 서비스 레벨 adminId 필터링 블록 제거 (쿼리로 대체)
- getUsablePartnership에 adminId optional RequestParam 추가
- 관련 테스트 수정 및 adminId 필터링 테스트 추가
@RequestParam(name = "all", defaultValue = "false") boolean all
) {
return BaseResponse.onSuccess(SuccessStatus._OK, studentService.getUsablePartnership(pd.getId(), all));
@RequestParam(name = "all", defaultValue = "false") boolean all,

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.

p5
all 파라미터 이름이 약간 모호한 것 같아요
요약 조회 목적이라면 previewOnly / isSummary 등으로 필드명을 좀더 구체적으로 바꾸는 것도 좋아보입니다.

.filter(p -> p.getAdmin().getId().equals(adminId))
.filter(p -> p.getAdmin().getId().equals(paperAdminId))
.findFirst()
.map(p -> p.getAdmin().getName())

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.

외부에서 먼저 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);

이런식으로요!!

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.

[FEAT/#406] 제휴에 카테고리 추가

2 participants