Skip to content

feat: 약 사진 추가 기능 및 약 제거 기능 구현#159

Merged
Neibce merged 1 commit intomainfrom
fe/feat/pills-image-and-delete
Aug 21, 2025
Merged

feat: 약 사진 추가 기능 및 약 제거 기능 구현#159
Neibce merged 1 commit intomainfrom
fe/feat/pills-image-and-delete

Conversation

@Neibce
Copy link
Owner

@Neibce Neibce commented Aug 21, 2025

Summary by CodeRabbit

  • 신기능
    • 약 이미지 업로드 지원: 선택 시 즉시 업로드, 진행 중 로딩 스피너 표시, 업로드된 이미지를 카드에 표시(실패 시 기본 아이콘 대체).
    • 복약 카드별 삭제 기능: 우상단 삭제 아이콘과 확인 다이얼로그, 낙관적 UI 반영 및 실패 시 복구와 안내.
    • 복약 시간 버튼 개선: 복용 횟수에 따른 반응형 배치와 즉시 토글.
    • 제출/업로드 중 버튼 비활성화 및 로딩 표시.
    • 등록 성공 시 팝업 화면으로 이동, 닫기 버튼은 취소로 처리.
    • 오류 상황 스낵바 안내 강화.

@coderabbitai
Copy link

coderabbitai bot commented Aug 21, 2025

Walkthrough

이미지 업로드 기능이 추가되고 등록 흐름이 변경되었습니다. PillService에 사진 업로드(프리사인드 URL 획득·S3 업로드)와 삭제 API가 도입되었고, addPills 요청에 fileName이 포함됩니다. 히스토리 화면은 약 삭제(낙관적 업데이트), 이미지 표시, 시간 버튼 레이아웃이 개선되었습니다.

Changes

Cohort / File(s) Summary
이미지 업로드 통합 및 등록 흐름 변경
frontend/ongi/lib/screens/health/add_pill_screen.dart
이미지 선택 시 즉시 업로드(프리사인드 URL 획득→S3 업로드), 업로드 상태 UI 표시, 업로드 결과 fileName을 등록 API에 전달. 제출/취소 동작 변경(성공 시 pop(true) 후 팝업 이동, 취소는 pop(false)). 에러 스낵바 추가, 버튼 로딩/비활성화 처리.
히스토리 화면: 삭제/이미지/시간 버튼 UI 개선
frontend/ongi/lib/screens/health/pill_history_screen.dart
_deletePill 도입(확인 다이얼로그→낙관적 삭제→API 호출→성공/실패 처리). _recalculatePillCount 추가. 카드 상단 삭제 버튼, 원격 이미지 표시(에러 시 SVG 대체). 시간 버튼 폭/배치 동적 계산 및 토글 동작 개선.
서비스 계층 확장(업로드·삭제·등록 페이로드)
frontend/ongi/lib/services/pill_service.dart
getPillPhotoPresignedUrl 추가, uploadPillPhotoToS3 추가, deletePill 추가. addPills 시그니처에 optional fileName 추가 및 JSON 페이로드 구성 변경. 에러 처리 및 인증 토큰 사용 로직 포함.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as 사용자
  participant Add as AddPillScreen
  participant Prefs as PrefsManager
  participant Svc as PillService
  participant API as Backend API
  participant S3 as S3 (Presigned)

  User->>Add: 이미지 선택
  Add->>Svc: getPillPhotoPresignedUrl()
  Svc->>API: GET presigned URL
  API-->>Svc: { presignedUrl, fileName }
  Svc-->>Add: 전달
  Add->>Prefs: getUserUuid()
  Prefs-->>Add: uploaderUuid
  Add->>Svc: uploadPillPhotoToS3(presignedUrl, file, uploaderUuid)
  Svc->>S3: PUT file bytes (+headers)
  S3-->>Svc: 200/OK
  Svc-->>Add: 완료(fileName 유지)
  note over Add: _uploadedFileName 저장, UI 스피너 해제

  User->>Add: 등록 버튼 탭
  Add->>Svc: addPills(..., fileName)
  Svc->>API: POST /pills { ... , fileName }
  API-->>Svc: 201/OK
  Svc-->>Add: 결과
  Add-->>User: pop(true) 후 PillUpdatePopup로 네비게이션
Loading
sequenceDiagram
  autonumber
  actor User as 사용자
  participant Hist as PillHistoryScreen
  participant Svc as PillService
  participant API as Backend API

  User->>Hist: 카드 우상단 삭제 아이콘 탭
  Hist->>User: 확인 다이얼로그
  User-->>Hist: 확인
  rect rgba(200,230,255,0.25)
    note right of Hist: 낙관적 업데이트
    Hist->>Hist: 리스트에서 즉시 제거, 카운트 재계산
  end
  Hist->>Svc: deletePill(pillId)
  Svc->>API: DELETE /pills/{id}
  alt 성공
    API-->>Svc: 200/204
    Svc-->>Hist: OK
    Hist-->>User: "약이 삭제되었습니다." 스낵바
  else 실패
    API-->>Svc: 오류
    Svc-->>Hist: 예외
    Hist->>Svc: 오늘 스케줄 재조회
    Hist-->>User: 오류 스낵바
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

귀 끝세운 토끼가 탁탁 클릭해 보니,
약 사진은 휙—구름 타고 S3로 날아가니!
딸깍 삭제, 살짝 되돌림도 준비됐고,
시간 버튼 줄 맞춰 춤추듯 반짝이고.
푸른 필드에 흰 발자국—코드는 정갈,
오늘도 “약 완료!” 띠링-띠링, 행복 충전! 🐇💊

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

💡 Knowledge Base configuration:

  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 49eafa9 and 2989579.

⛔ Files ignored due to path filters (1)
  • frontend/ongi/assets/images/dropdown_icon.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • frontend/ongi/lib/screens/health/add_pill_screen.dart (10 hunks)
  • frontend/ongi/lib/screens/health/pill_history_screen.dart (4 hunks)
  • frontend/ongi/lib/services/pill_service.dart (4 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Neibce Neibce merged commit db5e9fd into main Aug 21, 2025
3 of 6 checks passed
@Neibce Neibce deleted the fe/feat/pills-image-and-delete branch August 21, 2025 09:26
Neibce added a commit to 2025-PNU-SW-Hackathon/PNUSW-2025-OnGi-10 that referenced this pull request Aug 25, 2025
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