Skip to content

Feat/#113 등록된 맛집 검색 기능에서 캠퍼스 필터링 기능 추가#114

Merged
leeleeleeleejun merged 2 commits intodevelopfrom
feat/#113
Feb 20, 2026
Merged

Feat/#113 등록된 맛집 검색 기능에서 캠퍼스 필터링 기능 추가#114
leeleeleeleejun merged 2 commits intodevelopfrom
feat/#113

Conversation

@leeleeleeleejun
Copy link
Member

@leeleeleeleejun leeleeleeleejun commented Feb 20, 2026

#️⃣연관된 이슈

📝작업 내용

가게 이름 및 메뉴 검색 기능에 캠퍼스별 필터링을 추가하여, 사용자가 선택한 캠퍼스에 맞는 검색 결과만 표시되도록 개선했습니다.

1. 검색 API에 캠퍼스 파라미터 추가

커링 패턴을 사용하여 searchFunc에 캠퍼스 적용

  • SearchPage 컴포넌트가 요구하는 (query: string) => Promise<Result[]> 타입과 호환
  • 캠퍼스 값을 먼저 바인딩하고, 검색 쿼리만 받는 함수 반환
  • searchFunc: (campus) => async (query) => { ... } 형태로 구현

스크린샷 (선택)

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

Summary by CodeRabbit

  • 개선 사항
    • 장소 및 메뉴 검색이 캠퍼스별 필터링을 지원하도록 개선되었습니다. 사용자가 선택한 캠퍼스에 따라 관련 검색 결과만 표시됩니다.
    • 검색 페이지가 캠퍼스 변경에 반응하여 즉시 갱신되도록 동작이 개선되었습니다.

- getPlacesByNameSearch, getPlacesByMenuSearch API에 campus 파라미터 추가
- 검색 페이지에서 useCampusStore로 현재 캠퍼스를 가져와 검색에 적용
@leeleeleeleejun leeleeleeleejun self-assigned this Feb 20, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

캠퍼스 타입 파라미터를 장소 검색 API와 검색 페이지로 전달하도록 변경했습니다. getPlacesByNameSearchgetPlacesByMenuSearch 서명이 캠퍼스 인자를 받도록 업데이트되었고, 검색 페이지의 searchFunc는 캠퍼스를 인자로 받아 내부 API 호출에 전달하도록 고차 함수로 리팩토링되었습니다.

Changes

Cohort / File(s) Summary
API 서비스 레이어
apps/web/app/_apis/services/place.ts
getPlacesByNameSearch, getPlacesByMenuSearchcampus: CampusType 파라미터 추가 및 쿼리 파라미터로 포함
검색 페이지 컴포넌트
apps/web/app/places/search/page.tsx
useCampusStore로 캠퍼스 컨텍스트 도입; TypeConfig 타입 추가 및 searchFunc(campus) => (query) => Promise<...> 형태로 변경; SearchPage의 key와 호출에 캠퍼스 반영

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🐰✨ 캠퍼스 깃발 하나 들고,
검색 길에 토끼가 달려가네.
고차 함수로 손을 잡고,
캠퍼스를 따라 흩어진 길,
올바른 장소로 훌쩍 날아가네 🏫🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 기능을 명확하게 설명합니다. 캠퍼스 필터링 기능 추가라는 핵심 변경사항을 잘 반영하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#113

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/web/app/places/search/page.tsx (3)

26-46: ⚠️ Potential issue | 🟡 Minor

searchFunc 커링 함수들에 명시적 반환 타입이 없습니다.

코딩 가이드라인에서 "return types required on functions"를 요구하지만, 두 searchFunc 모두 외부 함수와 내부 async 함수에 반환 타입 어노테이션이 없습니다.

🔧 제안된 수정
-    searchFunc: (campus: CampusType) => async (query: string) => {
+    searchFunc: (campus: CampusType) => async (query: string): Promise<{ id: string; name: string; address: string }[]> => {
       const result = await getPlacesByNameSearch(query, campus)
       return result.map((place) => ({
         id: place.placeId,
         name: place.placeName,
         address: place.address,
       }))
     },
-    searchFunc: (campus: CampusType) => async (query: string) => {
+    searchFunc: (campus: CampusType) => async (query: string): Promise<{ id: string; name: string; address: string }[]> => {
       const result = await getPlacesByMenuSearch(query, campus)
       return result.map((place) => ({
         id: place.placeId,
         name: place.menuName,
         address: place.placeName,
       }))
     },

As per coding guidelines, **/*.{ts,tsx} 파일에서 함수에 반환 타입이 필요합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/app/places/search/page.tsx` around lines 26 - 46, The two curried
searchFunc definitions lack explicit return types; add explicit TypeScript
return annotations for both the outer function (searchFunc: (campus: CampusType)
=> ...) and the inner async function ((query: string) => Promise<...>) so they
satisfy the "return types required on functions" rule. For the inner async
function, annotate the return as Promise<Array<{id: string; name: string;
address: string}>> (or the appropriate place DTO type), and for the outer one
annotate it as (campus: CampusType) => (query: string) => Promise<...>; update
both the NAME variant (using getPlacesByNameSearch) and the MENU variant (using
getPlacesByMenuSearch) accordingly.

49-76: ⚠️ Potential issue | 🟡 Minor

Page 컴포넌트에 명시적 반환 타입이 없습니다.

const Page = () => { 선언에 반환 타입이 누락되었습니다.

🔧 제안된 수정
-const Page = () => {
+const Page = (): JSX.Element => {

As per coding guidelines, **/*.{ts,tsx} 파일에서 함수에 반환 타입이 필요합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/app/places/search/page.tsx` around lines 49 - 76, The Page component
lacks an explicit return type; update the Page declaration to include a React
return type (e.g., change `const Page = () => {` to `const Page = ():
JSX.Element => {` or `const Page = (): React.ReactElement => {`) so the function
in apps/web/app/places/search/page.tsx (symbol: Page) has an explicit typed
return value; no other logic changes needed—just add the return type to the Page
function signature and ensure React types are available in the file.

65-73: ⚠️ Potential issue | 🟡 Minor

캠퍼스 변경 시 SearchPage가 리마운트되지 않아 이전 캠퍼스의 검색 결과가 잔존할 수 있습니다.

key={searchType}는 검색 타입 변경 시에만 SearchPage를 리마운트합니다. 사용자가 캠퍼스를 변경하면 Page가 리렌더링되어 새 searchFunc 클로저가 props로 전달되지만, SearchPage의 내부 상태(기존 검색 결과 등)는 초기화되지 않습니다. 결과적으로 이전 캠퍼스의 검색 결과가 새 검색을 수행하기 전까지 그대로 표시됩니다.

keycampus를 포함하면 캠퍼스 변경 시에도 내부 상태가 리셋됩니다.

🐛 제안된 수정
-        key={searchType}
+        key={`${searchType}-${campus}`}

SearchPage 컴포넌트가 내부 상태로 검색 결과를 관리하는지 확인하려면 아래 스크립트를 실행하세요.

#!/bin/bash
# SearchPage 컴포넌트 내부 상태 및 searchFunc 의존성 확인
fd -e tsx -e ts SearchPage --exec cat {}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/app/places/search/page.tsx` around lines 65 - 73, The SearchPage
currently only remounts when searchType changes (key={searchType}), so when
campus changes its internal state (previous search results) persists; update the
SearchPage key to include the campus as well (combine searchType and campus) so
that when campus changes the component is remounted and its internal state
resets; modify the JSX where SearchPage is rendered (the element with props
useBackHandler, placeholder, searchFunc, onSelectPlace) to use a composite key
containing both searchType and campus (e.g., a concatenation or tuple) so
remounting occurs on either change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/web/app/places/search/page.tsx`:
- Around line 26-46: The two curried searchFunc definitions lack explicit return
types; add explicit TypeScript return annotations for both the outer function
(searchFunc: (campus: CampusType) => ...) and the inner async function ((query:
string) => Promise<...>) so they satisfy the "return types required on
functions" rule. For the inner async function, annotate the return as
Promise<Array<{id: string; name: string; address: string}>> (or the appropriate
place DTO type), and for the outer one annotate it as (campus: CampusType) =>
(query: string) => Promise<...>; update both the NAME variant (using
getPlacesByNameSearch) and the MENU variant (using getPlacesByMenuSearch)
accordingly.
- Around line 49-76: The Page component lacks an explicit return type; update
the Page declaration to include a React return type (e.g., change `const Page =
() => {` to `const Page = (): JSX.Element => {` or `const Page = ():
React.ReactElement => {`) so the function in apps/web/app/places/search/page.tsx
(symbol: Page) has an explicit typed return value; no other logic changes
needed—just add the return type to the Page function signature and ensure React
types are available in the file.
- Around line 65-73: The SearchPage currently only remounts when searchType
changes (key={searchType}), so when campus changes its internal state (previous
search results) persists; update the SearchPage key to include the campus as
well (combine searchType and campus) so that when campus changes the component
is remounted and its internal state resets; modify the JSX where SearchPage is
rendered (the element with props useBackHandler, placeholder, searchFunc,
onSelectPlace) to use a composite key containing both searchType and campus
(e.g., a concatenation or tuple) so remounting occurs on either change.

- TypeConfig 타입으로 TYPE_CONFIG 구조 명확화
- key에 campus 포함하여 캠퍼스 변경 시 컴포넌트 리마운트 보장
searchFunc: async (query: string) => {
const result = await getPlacesByNameSearch(query)
searchFunc: (campus: CampusType) => async (query: string) => {
const result = await getPlacesByNameSearch(query, campus)
Copy link
Member Author

Choose a reason for hiding this comment

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

커링 패턴을 사용하여 캠퍼스 값을 먼저 바인딩하고, 검색 쿼리만 받는 함수 반환
이 방식을 통해 SearchPage 컴포넌트를 전혀 수정하지 않고, 기존에 요구하던 (query: string) => Promise<Result[]> Props 타입을 그대로 호환할 수 있습니다.

@leeleeleeleejun leeleeleeleejun merged commit 828d491 into develop Feb 20, 2026
1 check passed
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.

[Feature] 등록된 맛집 검색 기능에서 캠퍼스 필터링 기능 추가

1 participant