Skip to content

Conversation

@DandelionQZ
Copy link
Collaborator

@DandelionQZ DandelionQZ commented Jan 16, 2026

⚙️ Related ISSUE Number

#115



📄 Work Description

PR 작업 내용

1. 채팅 API 및 기능 구현

1.1 채팅 API 추가 (api/chatApi.ts, api/urls.ts)

// 그룹 채팅방 목록 조회
- 사용자가 참여 중인 모든 그룹 채팅방 리스트 반환
-  채팅방의 최신 메시지, 참여자 , 읽지 않은 메시지  포함

// 1:1 채팅방 목록 조회  
- 사용자의 모든 개인 채팅방 리스트 반환
- 상대방 정보, 최신 메시지, 읽지 않은 메시지  포함

// 채팅방 상세 정보 조회
- 특정 채팅방의 상세 정보  메시지 히스토리 반환
- 참여자 정보, 채팅방 설정, 메시지 페이지네이션 지원

1.2 채팅 탭 화면 개편 (app/chat.tsx)

작업 내용:
- 그룹 채팅과 1:1 채팅을 통합
- 채팅 타입별 필터링 기능 (전체/그룹/개인)
-  채팅방 항목에 다음 정보 표시:
  * 채팅방 이름 또는 상대방 닉네임
  * 최신 메시지 미리보기
  * 시간 정보
  * 읽지 않은 메시지 배지

1.3 채팅방 화면 리팩토링 (app/chat/[id].tsx)

작업 내용:
- 사용자 데이터 로딩 상태 추가
  * 사용자 정보를 불러오는 동안 로딩 인디케이터 표시
  * 로딩 완료 후에만 메시지 렌더링 시작

- 메시지 렌더링 로직 개선
  * 사용자 ID 기반으로  메시지와 상대방 메시지 구분
  * 프로필 이미지  닉네임 정확하게 표시
  * 시간 포맷팅 개선

2. 파티 관리 API 구현

2.1 파티 관리 API 추가 (api/partyApi.ts, api/urls.ts)

// 참가 요청 승인 API
approveJoinRequest(partyId: number, requestId: number)
- 파티장이 대기 중인 참가 요청을 승인

// 참가 요청 거절 API  
rejectJoinRequest(partyId: number, requestId: number)
- 파티장이 참가 요청을 거절

// 파티 완료 처리 API
markPartyComplete(partyId: number)
- 파티를 완료 상태로 변경

// 파티 정산 API
settleParty(partyId: number, settlementData: object)
- 파티 종료 

2.2 위치 기반 파티 조회 기능 (api/partyApi.ts)

// 기존 함수 시그니처 변경

// 내 파티 목록 조회
getMyPartyList(params?: { latitude?: number; longitude?: number })
- 위치 정보 제공 필수
- 거리순 정렬

// 전체 파티 목록 조회  
getAllPartyList(params?: { latitude?: number; longitude?: number })
- 설정된 유저 동네 기반 주변 파티 검색 지원

3. 인증 에러 처리 개선

3.1 Axios Interceptor 강화 (api/axios.ts)

// Response Interceptor 개선

1. 401 에러 처리
   - Access token 만료 감지
   - Refresh token으로 자동 갱신 시도
   - 갱신 성공  원래 요청 재시도
   - Refresh token도 만료된 경우 로그아웃 처리

2. 403 에러 처리  
   - 권한 없음 에러 감지
   - Refresh token 없는 경우 즉시 로그아웃
   - Refresh token 갱신 실패  로그아웃

3. Refresh 엔드포인트 무한 루프 방지
   - Refresh API 호출  재시도하지 않도록 예외 처리
   - Refresh 실패  즉시 에러 반환
   - 동시 다발적 refresh 요청 방지 (Queue 사용)

4. 로그아웃 처리 로직
   - AsyncStorage에서 토큰 삭제
   - 사용자 상태 초기화
   - 로그인 화면으로 리다이렉트
   - 진행 중이던 요청 모두 취소

코드 구조:
- 에러 응답 확인 (status 401/403)
- Refresh token 존재 여부 확인
- Refresh API 호출 여부 확인 (무한 루프 방지)
- Token 갱신 시도
- 갱신 성공: 원래 요청 재시도
- 갱신 실패: 로그아웃  에러 반환

4. UI/UX 개선

4.1 파티 생성/수정 네비게이션 수정 (app/party/create/[type].tsx)

작업 내용:
- 파티 생성 성공 
  * 뒤로가기 스택 정리

- 파티 수정 성공 
  * 파티 상세 화면으로 복귀
  * 수정된 데이터 즉시 반영

5. 프로젝트 구조 변경

5.1 라우팅 구조 개편

목적:
- 라우팅 구조 단순화
- 파일 경로 직관성 향상
- 불필요한 중첩 그룹 제거

5.2 버전 업데이트 (app.config.js)

// 새 버전: 0.9.0

변경 이유:
- 주요 기능 추가 (채팅, 파티 관리)
- API 인터페이스 변경
- accessToken 갱신 로직 오류 수정
- 화면 스택 정리
- UI 수정
- 반환 받은 데이터 제대로 연결

파일별 변경 요약

파일 경로 변경 유형 주요 내용
api/chatApi.ts 신규 추가 채팅 API 함수 구현
api/partyApi.ts 기능 추가 파티 관리 API, 위치 파라미터 추가
api/urls.ts 엔드포인트 추가 새로운 API URL 정의
api/axios.ts 로직 개선 인증 에러 처리 강화
app/chat.tsx 이동 + 개편 채팅 목록 통합 표시
app/chat/[id].tsx 이동 + 리팩토링 채팅방 렌더링 개선
app/party-detail/[id].tsx 이동 + 개선 로딩/에러 처리 강화
app/party/create/[type].tsx 이동 + 수정 네비게이션 버그 수정
app.config.js 버전 변경 0.9.0으로 업데이트

이 PR은 채팅 기능 전체 구현, 파티 관리 기능 강화, 안정성 개선을 포함하는 대규모 업데이트입니다.



📷 Screenshot



💬 To Reviewers



🔗 Reference

…lient into feat/115-일대일-채팅방-정보-조회-및-처리-로직
- 프로필 이미지 정렬 및 사용자 이름 최대 너비 조정
- 파티 수정 화면 및 사진 업로드/검증 로직 버그 수정
- 카카오 API 기반 장소 검색 컴포넌트 동작 오류 수정
- 파티 검색 무한 스크롤 및 최근 검색어 처리 개선
- (app) prefix 라우팅 누락 및 경로 오류 수정
- 로그인/회원가입 이동 및 뒤로가기 네비게이션 문제 수정
- 전반적인 네비게이션 및 상태 관리 로직 정리
…lient into feat/115-일대일-채팅방-정보-조회-및-처리-로직
@DandelionQZ DandelionQZ requested a review from donut74 January 16, 2026 04:46
@DandelionQZ DandelionQZ self-assigned this Jan 16, 2026
Copilot AI review requested due to automatic review settings January 16, 2026 04:46
@DandelionQZ DandelionQZ linked an issue Jan 16, 2026 that may be closed by this pull request
3 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements comprehensive chat room information retrieval and handling logic for both one-to-one and group chats. It introduces new type definitions, API endpoints, query hooks, and UI components to manage different chat room states and participant interactions.

Changes:

  • Added type definitions for chat room schemas (one-to-one and group chat details)
  • Implemented API endpoints and React Query hooks for chat room detail retrieval
  • Created ChatRoomStatusHandler component to conditionally render UI based on chat state
  • Refactored route paths to use (app) group structure for better organization
  • Updated store logic for party editing with improved state management pattern

Reviewed changes

Copilot reviewed 44 out of 54 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
types/chat.types.ts Added new type definitions for chat schemas, removed isMine field from messages
types/party.types.ts Changed distanceKm from number to string type
api/chatApi.ts Added endpoints for fetching one-to-one and group chat room details
api/partyApi.ts Added party approval/rejection/completion/settlement endpoints
api/urls.ts Added new endpoint definitions for chat and party operations
api/axios.ts Enhanced error handling in interceptors, removed withCredentials
hooks/queries/useChatRoom.ts Added query hooks for fetching chat room details
hooks/mutations/useChat.ts New file with mutations for party operations from chat context
hooks/mutations/useParty.ts Updated navigation path to use (app) group
stores/editPartyStore.ts Refactored with originalInfo pattern and improved location handling
stores/creatingPartyStore.ts Updated location handling to support null values
stores/authStore.ts Updated logout redirect path
components/chat/* Multiple chat components updated to support new chat detail schemas
app/(app)/* Route structure reorganized under (app) group
package.json Version bumped from 0.4.0 to 0.9.0
package-lock.json lockfileVersion changed from 4 to 9
Files not reviewed (1)
  • TinyBite/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return useMutation({
mutationFn: async () => {
if (!partyId || !participantId) {
throw new Error("필수 파라미터 누락: approve join party");
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The error message '필수 파라미터 누락: approve join party' is misleading in the useRejectJoinPartyMutation function. It should say 'reject join party' instead of 'approve join party' to accurately reflect the operation being performed.

Copilot uses AI. Check for mistakes.
return useMutation({
mutationFn: async () => {
if (!partyId) {
throw new Error("필수 파라미터 누락: approve join party");
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The error message '필수 파라미터 누락: approve join party' is misleading in the useCompletePartyMutation function. It should say 'complete party' instead of 'approve join party' to accurately reflect the operation being performed.

Copilot uses AI. Check for mistakes.
return useMutation({
mutationFn: async () => {
if (!partyId) {
throw new Error("필수 파라미터 누락: approve join party");
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The error message '필수 파라미터 누락: approve join party' is misleading in the useSettlePartyMutation function. It should say 'settle party' instead of 'approve join party' to accurately reflect the operation being performed.

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +29
// queryClient.invalidateQueries({
// queryKey: ["getOnetoOneRoomDetail", chatroomId],
// });
queryClient.invalidateQueries();
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The commented-out specific query invalidation suggests uncertainty about the correct approach. Using queryClient.invalidateQueries() without arguments invalidates all queries, which can cause unnecessary refetches and performance issues. Consider uncommenting the specific invalidation or removing the commented code if the broad invalidation is intentional.

Copilot uses AI. Check for mistakes.
}

// 예상치 못한 status
alert(`HOST에게 예상치 못한 status: ${participantStatus}`);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Using alert() for error handling in React Native is not recommended as it's a blocking operation. Consider using a Toast notification or a proper error modal component that's consistent with the app's design system.

Copilot uses AI. Check for mistakes.
}

// 예상치 못한 status
alert(`PARTICIPANT에게 예상치 못한 status: ${participantStatus}`);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Using alert() for error handling in React Native is not recommended as it's a blocking operation. Consider using a Toast notification or a proper error modal component that's consistent with the app's design system.

Copilot uses AI. Check for mistakes.
}

// 예상치 못한 status
alert(`HOST에게 예상치 못한 status: ${chatDetail.status}`);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Using alert() for error handling in React Native is not recommended as it's a blocking operation. Consider using a Toast notification or a proper error modal component that's consistent with the app's design system.

Copilot uses AI. Check for mistakes.
}

// 예상치 못한 participantType
alert(`예상치 못한 participantType: ${chatDetail.participantType}`);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Using alert() for error handling in React Native is not recommended as it's a blocking operation. Consider using a Toast notification or a proper error modal component that's consistent with the app's design system.

Copilot uses AI. Check for mistakes.
}

// 예상치 못한 participantType
alert(`예상치 못한 participantType: ${participantType}`);
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

Using alert() for error handling in React Native is not recommended as it's a blocking operation. Consider using a Toast notification or a proper error modal component that's consistent with the app's design system.

Copilot uses AI. Check for mistakes.
/**
* 채팅방 참여자 타입
*/
export type participantType = "HOST" | "PARTICIPANT";
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The type name 'participantType' does not follow TypeScript naming conventions. Type names should be PascalCase. Rename to 'ParticipantType' for consistency with other type definitions in this file.

Copilot uses AI. Check for mistakes.
@donut74 donut74 merged commit 3d83dbf into develop Jan 16, 2026
@donut74 donut74 deleted the feat/115-일대일-채팅방-정보-조회-및-처리-로직 branch January 16, 2026 14:41
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: 채팅방 정보 조회 및 처리 로직

3 participants