Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ 프로필 이미지 업로드 API #37

Merged
merged 2 commits into from
Dec 1, 2024
Merged

Conversation

waterfogSW
Copy link
Member

@waterfogSW waterfogSW commented Dec 1, 2024

Summary by CodeRabbit

  • 신규 기능
    • 프로필 이미지 업로드를 위한 URL 생성 엔드포인트 추가 (GET /users/my/profile-images/upload-url).
    • 프로필 이미지 업로드 완료 후 콜백 처리를 위한 엔드포인트 추가 (POST /users/my/profile-images/upload-complete).
  • 스키마 업데이트
    • 새로운 응답 스키마 GetProfileImageUploadUrlResponse 추가.
    • 새로운 요청 스키마 CompleteProfileImageUploadRequest 추가.
    • 이미지 형식 정의를 위한 스키마 ProfileImageExtension 추가.

Copy link

coderabbitai bot commented Dec 1, 2024

Walkthrough

이 PR은 3days API의 OpenAPI 사양을 수정하여 두 개의 새로운 엔드포인트를 추가합니다. /users/my/profile-images 경로 아래에 **GET /users/my/profile-images/upload-url**와 **POST /users/my/profile-images/upload-complete**가 포함되어 있습니다. 또한, 업로드 URL 생성 및 업로드 완료 콜백을 위한 새로운 스키마가 정의되었습니다. 기존 스키마도 업데이트되어 이미지 형식(PNG)에 대한 정의가 추가되었습니다.

Changes

파일 변경 요약
openapi.yaml - 새로운 엔드포인트 추가: GET /users/my/profile-images/upload-url
- 새로운 엔드포인트 추가: POST /users/my/profile-images/upload-complete
- 새로운 스키마 추가: GetProfileImageUploadUrlResponse
- 새로운 스키마 추가: CompleteProfileImageUploadRequest
- 새로운 스키마 추가: ProfileImageExtension

Possibly related PRs

Suggested reviewers

  • dojinyou
  • moondev03
  • jisu15-kim

🐇 새로운 이미지 업로드,
프로필을 더욱 빛내주네!
URL과 콜백,
이제는 간편하게,
내 모습을 담아,
함께 나누자,
행복한 순간들! 🖼️✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

@waterfogSW waterfogSW added the feat 기능 label Dec 1, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
openapi.yaml (1)

1057-1073: 스키마 정의의 개선이 필요합니다.

  1. PNG 외의 다른 이미지 포맷(예: JPEG, WEBP)도 고려해야 합니다.
  2. 이미지 메타데이터(width, height) 검증이 필요합니다.

다음과 같은 스키마 수정을 제안합니다:

    ProfileImageExtension:
      type: string
-     enum: [ PNG ]
+     enum: [ PNG, JPEG, WEBP ]
      description: 프로필 이미지 확장자

    CompleteProfileImageUploadRequest:
      type: object
      properties:
        imageId:
          type: string
          format: uuid
          description: 이미지 ID
        extension:
          $ref: '#/components/schemas/ProfileImageExtension'
+       width:
+         type: integer
+         minimum: 100
+         maximum: 4096
+         description: 이미지 너비 (픽셀)
+       height:
+         type: integer
+         minimum: 100
+         maximum: 4096
+         description: 이미지 높이 (픽셀)
      required:
        - imageId
+       - width
+       - height

Also applies to: 1138-1149, 1184-1187

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 59a761e and 18e55b7.

📒 Files selected for processing (1)
  • openapi.yaml (4 hunks)

openapi.yaml Show resolved Hide resolved
openapi.yaml Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
openapi.yaml (2)

1142-1153: 업로드 완료 요청 스키마에 추가 검증이 필요합니다.

이미지 업로드 완료 시 이미지의 무결성을 검증하기 위한 추가 필드를 고려해보세요:

  • 파일 크기 (contentLength)
  • 체크섬 (checksum)
      properties:
        imageId:
          type: string
          format: uuid
          description: 이미지 ID
        extension:
          $ref: '#/components/schemas/ProfileImageExtension'
+       contentLength:
+         type: integer
+         description: 업로드된 이미지의 크기 (바이트)
+       checksum:
+         type: string
+         description: 업로드된 이미지의 SHA-256 체크섬
      required:
          - imageId
+         - contentLength
+         - checksum

1188-1191: 추가 이미지 형식 지원을 고려해보세요.

현재는 PNG 형식만 지원하고 있습니다. 사용자 편의성을 위해 다음 형식들도 고려해보세요:

  • JPEG/JPG
  • WebP
    ProfileImageExtension:
      type: string
-     enum: [ PNG ]
+     enum: [ PNG, JPEG, WEBP ]
      description: 프로필 이미지 확장자
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 18e55b7 and 1d6f3dd.

📒 Files selected for processing (1)
  • openapi.yaml (4 hunks)
🔇 Additional comments (3)
openapi.yaml (3)

217-243: 업로드 완료 콜백 처리 로직 개선이 필요합니다.

이전 리뷰에서 지적된 사항이 아직 해결되지 않았습니다:

  1. 업로드 완료 제한 시간이 명시되어 있지 않습니다.
  2. 이미지 처리 실패 시의 오류 응답이 정의되어 있지 않습니다.

1057-1077: 응답 스키마가 잘 정의되어 있습니다.

필요한 모든 필드가 포함되어 있으며, 특히 uploadExpiresIn 필드를 통해 업로드 URL의 만료 시간을 명확히 전달할 수 있습니다.


185-216: 🛠️ Refactor suggestion

파일 크기 제한이 필요합니다.

업로드 URL을 생성하기 전에 파일 크기 제한을 검증해야 합니다. 다음 사항을 추가하는 것을 제안합니다:

  • 파일 크기 제한 쿼리 파라미터 추가
  • 최대 허용 크기 명시 (예: 5MB)
      parameters:
        - in: query
          name: extension
          required: true
          schema:
            $ref: '#/components/schemas/ProfileImageExtension'
          description: 이미지 확장자
+       - in: query
+         name: contentLength
+         required: true
+         schema:
+           type: integer
+           minimum: 1
+           maximum: 5242880  # 5MB
+         description: 업로드할 이미지의 크기 (바이트)

Likely invalid or redundant comment.

@waterfogSW waterfogSW merged commit 4768665 into main Dec 1, 2024
3 checks passed
@waterfogSW waterfogSW deleted the feat/profile-image-upload branch December 1, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant