Skip to content

Feature/policy api#44

Merged
haeni82 merged 2 commits into
developfrom
feature/policy-api
Mar 13, 2026
Merged

Feature/policy api#44
haeni82 merged 2 commits into
developfrom
feature/policy-api

Conversation

@haeni82
Copy link
Copy Markdown
Contributor

@haeni82 haeni82 commented Mar 13, 2026

이슈

  • closed #이슈번호

✔️ 체크리스트

  • : Merge할 브랜치를 확인해 주세요.

🔍 작업 내용

image image
  • 정책 페이지 권한 양도 컴포넌트 제외 api 연결

⚠️ 주의 사항 / 기타

Summary by CodeRabbit

릴리스 노트

신기능

  • 권한 관리 기능 추가 - 가족 구성원별 상세 정보 및 앱 사용 현황 열람 권한을 관리할 수 있습니다.
  • 임계값 관리 기능 추가 - 공유 풀 및 회선별 데이터 임계값을 설정하고 조정할 수 있습니다.
  • 무제한 데이터 표시 지원 - 데이터 제한이 없는 경우 "무제한"으로 표시됩니다.
  • 실시간 데이터 업데이트 - 주요 데이터가 자동으로 주기적으로 새로고침됩니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62dfb80a-e538-494f-8a97-5845ea2a9afd

📥 Commits

Reviewing files that changed from the base of the PR and between 6f17e9f and 89db0b8.

📒 Files selected for processing (11)
  • src/api/index.ts
  • src/api/services/permissionService.ts
  • src/api/services/thresholdService.ts
  • src/page/Main/MainPage.tsx
  • src/page/Main/components/DataBar.tsx
  • src/page/Policy/Policy.tsx
  • src/page/Policy/components/DataThresholdSlider.tsx
  • src/page/Policy/components/Permisssion.tsx
  • src/types/permission.ts
  • src/types/threshold.ts
  • src/utils/dataFormat.ts

📝 Walkthrough

Walkthrough

권한 및 임계값 관리 기능을 클라이언트 기반에서 서버 기반으로 전환하고, 폴링 동작과 무제한 값 지원(-1)을 추가하며, 새로운 API 서비스 및 타입 정의를 도입합니다.

Changes

코호트 / 파일 요약
API 서비스 및 타입 정의
src/api/index.ts, src/api/services/permissionService.ts, src/api/services/thresholdService.ts, src/types/permission.ts, src/types/threshold.ts
새로운 permissionService 및 thresholdService 모듈을 추가하고, 관련 타입(FamilyMember, MemberPermission, PatchPermissionRequest, SharedPoolThreshold, LineThreshold)을 정의하며, API 인덱스에서 thresholdService를 export합니다.
폴링 및 데이터 플레이스홀더
src/page/Main/MainPage.tsx
familyMembers, sharedPool, blockStatus 쿼리에 폴링(refetchInterval: 10000)과 placeholderData: keepPreviousData를 추가합니다.
무제한 값 처리
src/page/Main/components/DataBar.tsx, src/utils/dataFormat.ts
DataBar에서 -1을 무제한으로 취급하고 "무제한" 레이블 표시; formatData의 반환 타입을 string에서 number로 변경합니다.
임계값 관리 리팩토링
src/page/Policy/Policy.tsx, src/page/Policy/components/DataThresholdSlider.tsx
thresholdService로 데이터를 페칭하고, 개별 props 대신 임계값 객체를 전달하며, debounced 서버 동기화를 추가합니다. 로컬 상태에서 서버 상태 기반으로 전환합니다.
권한 관리 리팩토링
src/page/Policy/components/Permisssion.tsx
props 기반 아키텍처에서 내부 상태 기반으로 변경하고, useQuery/useMutation으로 데이터 페칭 및 패치를 수행하며, 변경 사항 추적 및 확인 모달을 추가합니다.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Client as 클라이언트<br/>(DataThresholdSlider)
    participant Server as 서버<br/>(API)
    participant DB as 데이터베이스

    User->>Client: 임계값 변경
    Client->>Client: 로컬 상태 업데이트
    Client->>Client: debounce 타이머 설정
    Note over Client: 1초 지연 후<br/>서버 요청
    Client->>Server: PATCH /shared-pools/limit<br/>또는 /lines/thresholds
    Server->>DB: 임계값 데이터 업데이트
    DB-->>Server: 업데이트 확인
    Server-->>Client: 200 OK
    Client->>Client: UI 갱신
Loading
sequenceDiagram
    participant User
    participant Client as 클라이언트<br/>(PermissionManager)
    participant Server as 서버<br/>(API)
    participant DB as 데이터베이스

    Client->>Server: GET /member-permissions/family
    Server->>DB: 권한 정보 조회
    DB-->>Server: 권한 데이터
    Server-->>Client: MemberPermissionsResponse
    Client->>Client: 초기 행 데이터 생성<br/>(useMemo)
    User->>Client: 권한 토글 변경
    Client->>Client: 행 상태 업데이트
    Client->>Client: 변경 사항 추적
    User->>Client: 확인 모달에서 적용 클릭
    Client->>Server: PATCH /member-permissions<br/>PatchPermissionRequest[]
    Server->>DB: 권한 데이터 업데이트
    DB-->>Server: 업데이트 확인
    Server-->>Client: 200 OK
    Client->>Client: 모달 닫기<br/>초기 상태 리셋
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • PR #40: API 인덱스 export 확장 — 주 PR과 동일하게 서비스를 공개 API 표면에 추가합니다(주 PR은 thresholdService 추가, 참조 PR은 userService 및 policyService 추가).
  • PR #36: 같은 정책/권한 코드 경로 수정 — DataThresholdSlider, PermissionManager, 임계값/권한 타입 및 서비스를 함께 수정하여 코드 수준에서 관련됩니다.
✨ 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 feature/policy-api
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@haeni82 haeni82 merged commit 6fe1729 into develop Mar 13, 2026
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 23, 2026
1 task
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.

1 participant