Skip to content

Conversation

@frombunny
Copy link
Member

@frombunny frombunny commented May 19, 2025

🔍 관련 이슈


✅ 작업 분류

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

✨ 작업 내용

  1. 양식 업로드시, pdf일 경우와 이미지일 경우 로직 분기
  2. S3 키 수정
  3. sql 로그 수정

✅ 체크리스트

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

Summary by CodeRabbit

  • 신규 기능
    • PDF 파일 업로드 시 첫 페이지를 이미지로 변환하여 저장하는 기능이 추가되었습니다.
    • 지원되지 않는 파일 유형 업로드 시 오류 메시지가 제공됩니다.
    • S3 URL이 올바르지 않을 경우 사용자에게 명확한 오류가 안내됩니다.
  • 버그 수정
    • S3 URL에서 파일 키 추출 시 오류 처리가 강화되었습니다.
  • 환경설정
    • 개발 환경에서 데이터베이스 스키마 자동 생성 옵션이 업데이트 방식으로 변경되었습니다.
    • SQL 포맷 및 출력 로그가 비활성화되었습니다.
    • JDBC 타임존이 UTC로 지정되었습니다.
    • 프로덕션 환경 설정 파일이 삭제되었습니다.

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

coderabbitai bot commented May 19, 2025

Walkthrough

이번 변경에서는 파일 업로드 서비스의 PDF 처리 기능이 추가되고, S3 URL 파싱의 견고성이 개선되었습니다. PDF 파일은 이미지로 변환 후 업로드되며, 지원하지 않는 파일 유형과 잘못된 S3 URL에 대한 예외가 새로 도입되었습니다. 개발 환경 설정과 에러 코드도 일부 변경되었습니다.

Changes

파일/경로 요약 변경 내용 요약
src/main/java/Sprout_Squad/EyeOn/domain/document/entity/enums/DocumentType.java enum 상수 뒤에 불필요한 공백 추가. 기능적 변화 없음.
src/main/java/Sprout_Squad/EyeOn/domain/form/service/FormServiceImpl.java uploadForm에서 파일 확장자에 따라 PDF는 이미지로 변환, 이미지 파일만 업로드, 기타는 예외 발생. 디버그 출력 및 예외 import 추가.
src/main/java/Sprout_Squad/EyeOn/global/external/exception/ExternalErrorCode.java 지원하지 않는 파일 타입(400), 잘못된 S3 URL(500) 에러 코드 추가.
src/main/java/Sprout_Squad/EyeOn/global/external/exception/S3UrlInvalidException.java
src/main/java/Sprout_Squad/EyeOn/global/external/exception/UnsupportedFileTypeException.java
S3 URL, 파일 타입 관련 커스텀 예외 클래스 2종 추가.
src/main/java/Sprout_Squad/EyeOn/global/external/service/FlaskService.java 메서드 Javadoc 위에 빈 주석 블록 추가. 기능 변화 없음.
src/main/java/Sprout_Squad/EyeOn/global/external/service/PdfService.java PDF를 이미지(JPEG)로 변환해 S3에 업로드하는 convertPdfToImage 메서드 및 파일명 생성 메서드 추가.
src/main/java/Sprout_Squad/EyeOn/global/external/service/S3Service.java 이미지 바이트 업로드용 uploadImageBytes 메서드 추가. S3 URL 키 추출 로직을 URI 파싱 및 예외 처리 방식으로 개선.
src/main/resources/application-dev.yml Hibernate DDL 모드 createupdate, SQL 포맷/로그 비활성화, JDBC 타임존(UTC) 추가.
src/main/resources/application-prod.yml 프로덕션 환경 설정 파일 삭제.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant FormServiceImpl
    participant PdfService
    participant S3Service

    Client->>FormServiceImpl: uploadForm(file)
    alt file is PDF
        FormServiceImpl->>PdfService: convertPdfToImage(pdfBytes)
        PdfService->>S3Service: uploadImageBytes(fileName, imageBytes)
        S3Service-->>PdfService: S3 image URL
        PdfService-->>FormServiceImpl: S3 image URL
        FormServiceImpl->>S3Service: extractKeyFromUrl(imageUrl)
        S3Service-->>FormServiceImpl: S3 key
    else file is jpg/png
        FormServiceImpl->>S3Service: upload(file)
        S3Service-->>FormServiceImpl: S3 image URL
    else unsupported file
        FormServiceImpl-->>Client: throw UnsupportedFileTypeException
    end
    FormServiceImpl-->>Client: return uploaded image URL
Loading

Poem

🐰
파일을 업로드, PDF도 척척
이미지는 변환해 S3로 쏙!
지원 않는 타입엔 예외로 똑똑
설정도 손보고, 에러 코드 추가
토끼는 오늘도 깔끔하게 hop hop!
🌱

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 546be29 and 6017ed1.

📒 Files selected for processing (10)
  • src/main/java/Sprout_Squad/EyeOn/domain/document/entity/enums/DocumentType.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/domain/form/service/FormServiceImpl.java (2 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/ExternalErrorCode.java (2 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/S3UrlInvalidException.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/exception/UnsupportedFileTypeException.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/service/FlaskService.java (1 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/service/PdfService.java (3 hunks)
  • src/main/java/Sprout_Squad/EyeOn/global/external/service/S3Service.java (4 hunks)
  • src/main/resources/application-dev.yml (1 hunks)
  • src/main/resources/application-prod.yml (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/resources/application-prod.yml

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 merged commit 9b25ef7 into dev May 19, 2025
2 checks passed
@frombunny frombunny linked an issue May 19, 2025 that may be closed by this pull request
5 tasks
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: 문서 업로드 시 PDF와 이미지 파일 분기 처리 로직 개발

2 participants