feat: 알림(Notification) API 연동 - #37
Open
chiyyy wants to merge 4 commits into
Open
Conversation
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.
요약
GET /api/notification), 읽음 처리(PATCH /api/notification/{notificationId}/read) API 연동 — 기존MOCK_NOTIFICATIONS목데이터 제거상세 변경
features/notification/api/notificationApi.ts(신규):getNotificationsApi,markNotificationReadApifeatures/notification/model/useNotificationStore.ts(신규): 알림 목록 상태 관리 zustand 스토어fetchNotifications에 in-flight 가드 추가 — 화면 재포커스마다 호출돼도 중복 요청이 안 나가도록 (useWardLocationStore와 동일 패턴)markAsRead는 낙관적 업데이트(탭 즉시 읽음 표시 → PATCH 실패 시 롤백) +pendingReadIds로 그 사이 들어오는 목록 재조회 응답이 낙관적 읽음 상태를 덮어쓰지 않도록 보호features/notification/model/types.ts:AppNotification(mock용) → 실 응답 스키마인NotificationItem(notificationId,title,content,createdAt,isRead)으로 교체features/notification/model/mockNotifications.ts삭제 — 가이드 투어가 알림 화면/벨을 하이라이트하지 않아 mock 폴백 불필요함을 확인함features/notification/ui/NotificationCard.tsx: 새 타입 반영, 안 읽은 알림에 표시 점 추가,onPress로 탭 시 읽음 처리features/notification/utils/index.ts:createdAt(ISO) →YYYY.MM.DD HH:mm포맷터 추가screens/guardian/Notification/NotificationScreen.tsx: mock 배열 대신 스토어 연결,useFocusEffect로 재방문 시 재조회, 로딩/빈 목록 상태 UI 추가, 설정 아이콘 탭 시Settings화면으로 이동참고
read/isRead가 함께 노출돼 있는데, 기존PillSchedule(active/isActive) 사례와 동일하게 백엔드 boolean getter 중복 노출로 보고isRead하나만 사용함.env등 민감 파일 변경 없음테스트
tsc --noEmit통과