Skip to content

[Fix] memo/usageStorageInfo 필드 분리 — 사용자 메모와 복용·보관법 자동생성 정보 구분 - #58

Merged
kangcheolung merged 5 commits into
developfrom
fix/57
Jul 9, 2026
Merged

kangcheolung merged 5 commits into
developfrom
fix/57

Conversation

@kangcheolung

@kangcheolung kangcheolung commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

🔍️ 작업 내용

  • Closes #

✨ 상세 설명

문제

  • 기존엔 프론트가 useMethodQesitm + depositMethodQesitm을 합쳐서 memo에 그대로 담아 전송
  • 사용자가 자유롭게 쓰라고 만든 memo 공간이 시스템 자동생성 텍스트로 오염됨

해결

  • memo — 항상 빈 값으로 시작, 사용자 전용 자유 입력 공간으로 유지
  • usageStorageInfo — 신규 필드, 복용법/보관법 정보를 담당
    • DrugInfo 연결된 직접 등록 시에만 백엔드가 useMethodQesitm + depositMethodQesitm 조합으로 자동 생성
    • OCR 등록 시에는 null (노출 안 함)

변경 사항

  • Medication 엔티티에 usageStorageInfo 필드 추가 + DB 컬럼 추가
  • MedicationCommandService — DrugInfo 연결 시에만 usageStorageInfo 자동 생성 로직 추가
  • MedicationGroupItemResponse에 usageStorageInfo 필드 추가
  • MedicationCreateRequest — memo는 사용자 입력값 그대로 저장, 프론트에서 보내던 자동합성 로직 제거

🛠️ 추후 리팩토링 및 고도화 계획

  • OCR 등록 약에도 drug_info_id 자동 매핑이 붙으면 usageStorageInfo 자동생성 확대 검토

📸 스크린샷 (선택)

💬 리뷰 요구사항

  • memo와 usageStorageInfo 필드 분리 방향이 기획 의도(PM 협의 내용)와 맞는지 확인 부탁
  • DrugInfo 미연결(OCR) 케이스에서 usageStorageInfo null 처리가 프론트 쪽 렌더링과 잘 맞는지 확인 필요

Summary by CodeRabbit

  • 신규 기능
    • 약 정보에 사용/보관 관련 안내가 추가되어, 등록 및 조회 시 더 자세한 저장·복용 정보를 확인할 수 있습니다.
  • 변경 사항
    • 약 등록 시 사용/보관 정보가 함께 저장되도록 확장되었습니다.
    • 약 목록/상세 응답에 사용/보관 정보 항목이 포함됩니다.
    • 메모 항목 설명이 사용자 자유 입력 중심으로 정리되었습니다.
  • 버그 수정
    • 기존에 응답에 누락되던 사용/보관 정보가 표시되도록 개선되었습니다.

kangcheolung and others added 5 commits July 9, 2026 17:52
memo와 분리 — 복용법+보관법 자동 생성 전용 필드

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
복용법+보관법 자동 생성 제거, 사용자 자유 입력 전용으로 변경

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
useMethodQesitm + depositMethodQesitm 조합, OCR 등록 시 null

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Medication 엔티티에 usageStorageInfo(TEXT) 컬럼과 생성자 파라미터가 추가되었습니다. 등록 서비스에서 DrugInfo의 사용법/보관법 정보를 조합해 저장하며, 응답 DTO와 컨버터에 새 필드가 노출됩니다. memo 필드의 Swagger 설명 문구도 변경되었습니다.

Changes

Medication usageStorageInfo 필드 도입

Layer / File(s) Summary
엔티티 스키마 확장
src/main/java/com/piuda/callcare/domain/medication/entity/Medication.java
usageStorageInfo(TEXT) 컬럼 필드와 생성자(빌더) 파라미터가 추가되고, 생성자 내부에서 값이 할당됨. memo 주석 설명도 변경됨.
등록 서비스 로직 확장
src/main/java/com/piuda/callcare/domain/medication/service/command/MedicationCommandService.java
doRegister가 Medication 빌더에 usageStorageInfo(buildUsageStorageInfo(drugInfo))를 설정하며, useMethodQesitm과 depositMethodQesitm 존재 여부에 따라 null/단일값/결합값을 반환하는 buildUsageStorageInfo 메서드가 추가됨.
응답 DTO 및 컨버터 반영
.../dto/response/MedicationGroupItemResponse.java, .../converter/MedicationConverter.java, .../dto/request/MedicationCreateRequest.java
MedicationGroupItemResponse에 usageStorageInfo 레코드 컴포넌트와 Swagger 설명이 추가되고, MedicationConverter가 해당 값을 응답 생성자에 전달함. memo 필드의 Swagger 설명 문구가 양쪽 DTO에서 변경됨.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MedicationCommandService
  participant DrugInfo
  participant Medication
  participant MedicationConverter
  participant MedicationGroupItemResponse

  MedicationCommandService->>DrugInfo: useMethodQesitm, depositMethodQesitm 조회
  MedicationCommandService->>MedicationCommandService: buildUsageStorageInfo(drugInfo) 실행
  MedicationCommandService->>Medication: builder().usageStorageInfo(값) 설정 및 저장
  MedicationConverter->>Medication: getUsageStorageInfo() 호출
  MedicationConverter->>MedicationGroupItemResponse: usageStorageInfo 포함 생성
Loading

Possibly related issues

Possibly related PRs

  • PIUDAProject/Backend#51: Medication 생성자 시그니처 및 매핑 로직이 동일 파일/라인에서 겹침.
  • PIUDAProject/Backend#54: doRegister에서 Medication 필드 매핑 및 MedicationConverter 확장 흐름이 유사함.

Suggested labels: 🐞 Fix

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed memo와 usageStorageInfo를 분리해 사용자 메모와 자동 생성된 복용·보관 정보 구분이라는 변경점을 정확히 요약합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/57

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/com/piuda/callcare/domain/medication/service/command/MedicationCommandService.java (1)

109-118: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

buildUsageStorageInfo를 static으로 전환을 제안합니다.

이 메서드는 인스턴스 상태를 전혀 사용하지 않는 순수 함수입니다. static으로 선언하면 의존성이 없음을 명시적으로 표현할 수 있습니다.

♻️ 제안: static 메서드 전환
-    private String buildUsageStorageInfo(DrugInfo drugInfo) {
+    private static String buildUsageStorageInfo(DrugInfo drugInfo) {
         if (drugInfo == null) return null;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/piuda/callcare/domain/medication/service/command/MedicationCommandService.java`
around lines 109 - 118, Make buildUsageStorageInfo in MedicationCommandService
static because it only derives a value from the DrugInfo argument and does not
use any instance state. Update the method declaration to static and ensure any
call sites within MedicationCommandService still compile by invoking it in a
static-compatible way.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/main/java/com/piuda/callcare/domain/medication/service/command/MedicationCommandService.java`:
- Around line 109-118: Make buildUsageStorageInfo in MedicationCommandService
static because it only derives a value from the DrugInfo argument and does not
use any instance state. Update the method declaration to static and ensure any
call sites within MedicationCommandService still compile by invoking it in a
static-compatible way.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 83e45488-445f-4c08-b08b-33f9d430d44d

📥 Commits

Reviewing files that changed from the base of the PR and between bc012a0 and 5adffd1.

📒 Files selected for processing (5)
  • src/main/java/com/piuda/callcare/domain/medication/converter/MedicationConverter.java
  • src/main/java/com/piuda/callcare/domain/medication/dto/request/MedicationCreateRequest.java
  • src/main/java/com/piuda/callcare/domain/medication/dto/response/MedicationGroupItemResponse.java
  • src/main/java/com/piuda/callcare/domain/medication/entity/Medication.java
  • src/main/java/com/piuda/callcare/domain/medication/service/command/MedicationCommandService.java

@kangcheolung
kangcheolung merged commit 3251ecb into develop Jul 9, 2026
1 check passed
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