Skip to content

Conversation

@frombunny
Copy link
Member

@frombunny frombunny commented May 20, 2025

🔍 관련 이슈


✅ 작업 분류

  • 버그 수정
  • 신규 기능
  • 프로젝트 구조 변경
  • 코드 리팩토링
  • 기능 수정

✨ 작업 내용

  1. 문서 작성 기능 개발
  2. 문서 필드 분석 연동 및 가공
  3. 문서 유형 감지 연동

✅ 체크리스트

  • 코드가 컴파일 및 빌드됨
  • 모든 테스트가 통과함
  • 관련 문서가 업데이트됨
  • 코드 리뷰가 수행됨
  • 커밋 메시지를 확인함

📸 스크린샷

image 스크린샷 2025-05-20 오후 4 08 03

Summary by CodeRabbit

  • 신규 기능

    • 문서 작성 API 엔드포인트가 추가되어 사용자가 폼 데이터를 기반으로 문서를 생성하고, 이미지 및 PDF 파일을 받을 수 있습니다.
    • 문서 작성 및 필드 추출을 위한 다양한 DTO(요청/응답)와 레코드가 도입되었습니다.
    • 필드명-한글 표시명 매핑 기능이 추가되어, 문서 유형별로 필드명이 자동으로 한글로 변환됩니다.
    • 이미지에 필드값을 삽입하고 PDF로 변환하는 기능이 추가되었습니다.
  • 버그 수정

    • 오타가 있던 에러 코드 문자열이 수정되었습니다.
  • API 변경

    • 문서 필드 분석 API 응답이 단일 객체에서 필드 리스트로 변경되었습니다.
    • 일부 서비스 인터페이스 및 구현체의 메소드가 추가/변경/삭제되었습니다.
  • 리팩터링 및 기타

    • Flask 관련 예외 및 에러 코드가 별도 패키지로 분리되었습니다.
    • S3 파일 업로드 및 다운로드 기능이 개선되었습니다.
    • 불필요한 import 및 디버그 로그가 정리되었습니다.
    • 필드 한글명 매핑을 위한 리소스 파일이 추가되었습니다.

@frombunny frombunny self-assigned this May 20, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 20, 2025

Walkthrough

이 변경 사항은 문서 작성 및 필드 라벨 매핑 기능을 대폭 확장합니다. 문서 작성 API, DTO, 서비스 계층이 추가 및 개선되었고, 필드 라벨의 한글 매핑이 코드 및 리소스 파일로 도입되었습니다. Flask 연동 예외 및 오류 코드가 별도 패키지로 분리되어 관리됩니다.

Changes

파일/경로 그룹 변경 요약
src/main/java/Sprout_Squad/EyeOn/domain/document/entity/Document.java toEntity 정적 팩토리 메서드 추가
src/main/java/Sprout_Squad/EyeOn/domain/document/entity/enums/DocumentType.java enum 상수 뒤 불필요한 공백 제거
src/main/java/Sprout_Squad/EyeOn/domain/document/exception/DocumentErrorCode.java 오타 수정: "DOCUMNET_NOT_FOUND_404" → "DOCUMENT_NOT_FOUND_404"
src/main/java/Sprout_Squad/EyeOn/domain/document/service/DocumentService.java
src/main/java/Sprout_Squad/EyeOn/domain/document/service/DocumentServiceImpl.java
문서 작성 메서드(writeDocument) 추가 및 관련 의존성/로직 추가
src/main/java/Sprout_Squad/EyeOn/domain/document/web/controller/DocumentController.java 문서 작성용 POST 엔드포인트 /api/document/{formId}/write 추가
src/main/java/Sprout_Squad/EyeOn/domain/document/web/dto/WriteDocsReq.java
WriteDocsReqWrapper.java
WriteDocsRes.java
문서 작성 요청/응답용 DTO(레코드) 3종 신규 추가
src/main/java/Sprout_Squad/EyeOn/domain/form/service/FormService.java
FormServiceImpl.java
필드 추출 로직 분리 및 메서드 시그니처 변경/추가(getResFromModel, getField)
src/main/java/Sprout_Squad/EyeOn/domain/form/web/controller/FormController.java /analyze/field 엔드포인트 응답을 필드 리스트로 변경, 내부 호출 로직 변경
src/main/java/Sprout_Squad/EyeOn/domain/form/web/dto/GetFieldRes.java
GetModelRes.java
폼 필드 추출/모델 결과용 DTO(레코드) 2종 신규 추가
src/main/java/Sprout_Squad/EyeOn/global/external/exception/ExternalErrorCode.java
GetLabelFailedException.java
TypeDetectedFiledException.java
Flask 관련 예외 및 오류 코드 삭제
src/main/java/Sprout_Squad/EyeOn/global/flask/exception/FlaskErrorCode.java
GetLabelFailedException.java
TypeDetectedFiledException.java
Flask 예외 및 오류 코드를 별도 패키지로 신규 생성 및 관리
src/main/java/Sprout_Squad/EyeOn/global/flask/mapper/FieldLabelMapper.java 문서 유형별 필드 라벨-한글명 매핑 컴포넌트 신규 추가
src/main/java/Sprout_Squad/EyeOn/global/flask/service/FlaskService.java 패키지 이동 및 디버그 로그 조정(핵심 로직 변경 없음)
src/main/java/Sprout_Squad/EyeOn/global/external/service/PdfService.java S3 이미지에 텍스트 삽입, 이미지→PDF 변환 등 신규 메서드 3개 추가
src/main/java/Sprout_Squad/EyeOn/global/external/service/S3Service.java S3 업로드/다운로드 개선, 파일명 생성 규칙 변경, PDF 파일명 생성 메서드 추가
src/main/resources/mappings/FieldDisplayNameMap.json 문서별 필드-한글명 매핑 JSON 리소스 신규 추가
src/main/java/Sprout_Squad/EyeOn/EyeOnApplication.java 불필요한 import 제거, main 메서드에 공백 한 줄 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DocumentController
    participant DocumentService
    participant UserRepository
    participant FormRepository
    participant PdfService
    participant S3Service
    participant DocumentRepository

    Client->>DocumentController: POST /api/document/{formId}/write
    DocumentController->>DocumentService: writeDocument(userPrincipal, formId, writeDocsReqList)
    DocumentService->>UserRepository: findById(userId)
    DocumentService->>FormRepository: findById(formId)
    DocumentService->>PdfService: fillImageFromS3(imageUrl, fields)
    PdfService->>S3Service: downloadFile(imageUrl)
    PdfService-->>DocumentService: imageUrl(작성된 이미지 S3 URL)
    DocumentService->>PdfService: convertImageToPdf(image)
    PdfService-->>DocumentService: pdfByteArray
    DocumentService->>S3Service: uploadFile(pdfFileName, pdfByteArray)
    S3Service-->>DocumentService: pdfUrl
    DocumentService->>DocumentRepository: save(Document)
    DocumentRepository-->>DocumentService: Document
    DocumentService-->>DocumentController: WriteDocsRes
    DocumentController-->>Client: SuccessResponse<WriteDocsRes>
Loading

Poem

🐇
문서에 이름을 새기고,
한글 라벨도 척척!
S3와 PDF,
토끼도 놀란 변화 속
필드마다 한글 꽃이 피네.
새 API, 새 DTO,
개발자 마음에도 봄이 오네!
📝🌸

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b25ef7 and 765ccba.

📒 Files selected for processing (26)
  • src/main/java/Sprout_Squad/EyeOn/EyeOnApplication.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/entity/Document.java (2 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/entity/enums/DocumentType.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/exception/DocumentErrorCode.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/service/DocumentService.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/service/DocumentServiceImpl.java (4 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/web/controller/DocumentController.java (2 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/web/dto/WriteDocsReq.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/web/dto/WriteDocsReqWrapper.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/web/dto/WriteDocsRes.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/service/FormService.java (2 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/service/FormServiceImpl.java (5 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/web/controller/FormController.java (3 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/web/dto/GetFieldRes.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/web/dto/GetModelRes.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/ExternalErrorCode.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/GetLabelFailedException.java (0 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/TypeDetectedFiledException.java (0 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/service/PdfService.java (4 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/service/S3Service.java (4 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/flask/exception/FlaskErrorCode.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/flask/exception/GetLabelFailedException.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/flask/exception/TypeDetectedFiledException.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/flask/mapper/FieldLabelMapper.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/flask/service/FlaskService.java (2 hunks)
  • src/main/resources/mappings/FieldDisplayNameMap.json (1 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/TypeDetectedFiledException.java
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/GetLabelFailedException.java

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@frombunny frombunny linked an issue May 20, 2025 that may be closed by this pull request
5 tasks
@frombunny frombunny merged commit f0639f9 into dev May 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 문서 작성 API 개발

2 participants