Skip to content

[✨Feature/158] 체험 예약 내역 승인, 거절 api 연결#214

Merged
heyudin merged 6 commits into
mainfrom
feature/158/reservation-manage
Jan 17, 2026
Merged

[✨Feature/158] 체험 예약 내역 승인, 거절 api 연결#214
heyudin merged 6 commits into
mainfrom
feature/158/reservation-manage

Conversation

@heyudin
Copy link
Copy Markdown
Contributor

@heyudin heyudin commented Jan 17, 2026

✅ PR 체크리스트

  • 기능 정상 동작
  • 콘솔 에러 없음
  • UI 동작 및 반응형 레이아웃 확인

🔗 이슈 번호

✨ 작업한 내용

  • 승인, 거절 api 연결했습니다.

💁 리뷰 요청 / 코멘트

💡 참고사항

  • 간헐적으로 승인, 거절 후 화면이 올바르지 않은 데이터를 보여주고 새로고침 또는 다른 시간대를 누른뒤 돌아와야 정상 데이터가 보이는 현상이 있습니다. 추후 리팩토링 필요한 부분입니다.

@heyudin heyudin added this to the ✨ 페이지 기능 구현 milestone Jan 17, 2026
@heyudin heyudin self-assigned this Jan 17, 2026
@heyudin heyudin added the ✨ Feature 새로운 기능 구현 label Jan 17, 2026
@heyudin heyudin linked an issue Jan 17, 2026 that may be closed by this pull request
1 task
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @yujin-fe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 체험 예약 관리 시스템에 중요한 기능을 추가합니다. 사용자가 자신의 활동에 대한 예약 요청을 승인하거나 거절할 수 있도록 백엔드 API와 프론트엔드 UI를 연결하는 데 중점을 둡니다. 이를 통해 예약 관리 프로세스의 효율성을 높이고, 호스트가 예약 상태를 직접 제어할 수 있는 기능을 제공합니다.

Highlights

  • 예약 승인/거절 API 연결: 체험 예약 내역의 승인 및 거절을 처리하는 새로운 API 엔드포인트가 추가되고 연결되었습니다.
  • 일일 예약 현황 컴포넌트 기능 확장: 일일 예약 현황을 보여주는 컴포넌트에서 예약 상태를 업데이트하는 기능이 통합되어, 사용자가 직접 예약 승인/거절을 할 수 있게 되었습니다.
  • 예약 목록 컴포넌트 리팩토링: 예약 목록을 표시하는 컴포넌트가 외부에서 예약 데이터를 받아 처리하고, 예약 상태 변경 액션을 상위 컴포넌트로 위임하도록 리팩토링되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

체험 예약 승인 및 거절 API 연동 작업을 해주셨네요. 전반적으로 ReservationListByStatus 컴포넌트를 상태를 갖지 않는 순수 UI 컴포넌트로 리팩터링하여 부모 컴포넌트에서 데이터 흐름을 관리하도록 변경한 점이 인상적입니다. 코드 구조가 더 명확해진 것 같습니다.

몇 가지 개선점을 제안드립니다. PR 설명에 언급해주신 데이터 불일치 문제를 해결하기 위해 react-queryinvalidateQueries를 사용하는 방안을 제안했습니다. 또한, 사용자 경험을 위해 alert 대신 토스트 알림과 같은 전역 에러 핸들링을 적용하고, 코드에 남아있는 console.log를 제거하는 것이 좋겠습니다. 자세한 내용은 각 파일에 남긴 코멘트를 확인해주세요.

Comment on lines +115 to +120
try {
await updateReservationApproval(activityId, reservationId, req);
await Promise.all([dailyReservationRefetch(), reservationListRefetch()]);
} catch (error) {
alert(error);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

PR 설명에 언급된 간헐적인 데이터 불일치 문제를 해결하고 코드를 개선하기 위해, refetch를 직접 호출하는 대신 queryClient.invalidateQueries를 사용하는 것을 권장합니다. invalidateQueries는 특정 쿼리 키와 일치하는 쿼리를 무효화하여 react-query가 데이터를 다시 가져오게 하는, 더 안정적이고 선언적인 방법입니다. useQueryClient가 이미 선언되어 있으니 바로 활용할 수 있습니다.

또한, catch 블록에서 alert()로 에러를 표시하는 것은 사용자 경험에 좋지 않습니다. 일반적인 API 오류는 토스트 알림과 같은 전역 메커니즘으로 처리하는 것이 좋습니다. (Rule: Handle generic, non-field-specific API errors with a global mechanism like a toast notification, rather than assigning the error to an arbitrary input field.) 토스트 메시지 등 더 나은 방식의 피드백을 제공하는 것을 고려해보세요.

    try {
      await updateReservationApproval(activityId, reservationId, req);
      queryClient.invalidateQueries({ queryKey: ['DailyReservationStatus', activityId, formatDate] });
      queryClient.invalidateQueries({ queryKey: ['ReservationListByStatus'] });
    } catch (error) {
      console.error('예약 상태 업데이트 실패:', error);
      // TODO: 사용자에게 토스트 메시지 등으로 에러 알림
    }
References
  1. Handle generic, non-field-specific API errors with a global mechanism like a toast notification, rather than assigning the error to an arbitrary input field.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

/gemini
이것도 해봤는데 안되던데 결국 데이터 다시 불러오는건 똑같잖아

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

yujin-fe님, 좋은 질문입니다. invalidateQueriesrefetch 모두 최종적으로는 데이터를 다시 불러오는 결과를 가져오는 것은 맞습니다. 하지만 react-query의 핵심 개념과 더 나은 데이터 관리 측면에서 invalidateQueries를 사용하는 것이 권장됩니다.

주요 차이점은 다음과 같습니다:

  • queryClient.invalidateQueries (권장): 이는 선언적인 방식입니다. 특정 queryKey에 해당하는 모든 쿼리를 '오래된(stale)' 상태로 표시하라고 react-query에게 지시합니다. react-query는 이 지시를 받고 해당 쿼리를 구독하고 있는 모든 컴포넌트에서 데이터를 자동으로 다시 가져오도록 관리합니다. 이는 여러 컴포넌트가 동일한 데이터를 사용하고 있을 때 데이터 일관성을 유지하는 데 매우 효과적입니다. 캐시 관리와 최적화는 react-query가 담당하게 됩니다.
  • refetch: 이는 특정 useQuery 훅 인스턴스에 대해 데이터를 즉시 다시 가져오도록 강제하는 명령적인 방식입니다. 해당 refetch를 호출한 특정 쿼리 인스턴스만 영향을 받으며, 다른 곳에서 동일한 queryKey를 사용하는 쿼리들은 자동으로 업데이트되지 않을 수 있습니다.

만약 invalidateQueries가 작동하지 않는다고 느끼셨다면, queryKey가 정확히 일치하는지 확인해 볼 필요가 있습니다. react-queryqueryKey를 기반으로 쿼리를 식별하므로, invalidateQueries에 전달하는 queryKeyuseQuery에서 사용된 queryKey와 정확히 일치해야 합니다.

데이터 일관성 문제를 해결하고 react-query의 이점을 최대한 활용하기 위해 invalidateQueries 방식을 다시 고려해 보시는 것을 추천합니다.

또한, catch 블록에서 alert() 대신 토스트 알림과 같은 사용자 친화적인 방식으로 에러를 처리하는 것도 사용자 경험을 위해 중요합니다. 이 부분도 함께 개선하는 것을 권장합니다.

    try {
      await updateReservationApproval(activityId, reservationId, req);
      queryClient.invalidateQueries({ queryKey: ['DailyReservationStatus', activityId, formatDate] });
      queryClient.invalidateQueries({ queryKey: ['ReservationListByStatus'] });
    } catch (error) {
      console.error('예약 상태 업데이트 실패:', error);
      // TODO: 사용자에게 토스트 메시지 등으로 에러 알림
    }
Suggested change
try {
await updateReservationApproval(activityId, reservationId, req);
await Promise.all([dailyReservationRefetch(), reservationListRefetch()]);
} catch (error) {
alert(error);
}
try {
await updateReservationApproval(activityId, reservationId, req);
queryClient.invalidateQueries({ queryKey: ['DailyReservationStatus', activityId, formatDate] });
queryClient.invalidateQueries({ queryKey: ['ReservationListByStatus'] });
} catch (error) {
console.error('예약 상태 업데이트 실패:', error);
// TODO: 사용자에게 토스트 메시지 등으로 에러 알림
}

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@sylee86 sylee86 left a comment

Choose a reason for hiding this comment

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

승인하겠습니다 수고하셨습니다.

@heyudin heyudin merged commit e53e70c into main Jan 17, 2026
1 check passed
@heyudin heyudin deleted the feature/158/reservation-manage branch January 17, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 새로운 기능 구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[✨ Feature] 승인/ 거절 api 연결 [✨ Feature] 체험 예약 현황 페이지

2 participants