Skip to content

[feat] 이미지 업로드 API 엔드포인트 분리#97

Merged
LEEDONGH00N merged 2 commits intodevelopfrom
feat/issue-#61
Aug 1, 2025
Merged

[feat] 이미지 업로드 API 엔드포인트 분리#97
LEEDONGH00N merged 2 commits intodevelopfrom
feat/issue-#61

Conversation

@LEEDONGH00N
Copy link
Copy Markdown
Contributor

이슈

구현 기능

  • 여러 이미지 업로드 가능하도록 로직 수정
  • 이미지 타입을 enum으로 선언
  • api 분리

@LEEDONGH00N LEEDONGH00N requested a review from Copilot August 1, 2025 12:54
@LEEDONGH00N LEEDONGH00N self-assigned this Aug 1, 2025
@LEEDONGH00N LEEDONGH00N added the ✨feat 새로운 기능입니다 label Aug 1, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements image upload API endpoint separation with support for multiple image uploads. The changes introduce an enum-based image type system and separate API endpoints for different image upload scenarios.

  • Refactored S3 service to handle multiple file uploads instead of single files
  • Added ImageType enum to categorize images (ACCOMPANY, COMMUNITY, MEMBER_PROFILE)
  • Created separate image upload endpoints with proper documentation and validation

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
S3Service.java Refactored from single file to multiple file upload support with better validation
ImageController.java Updated API endpoint to handle multiple files with Swagger documentation
Image.java Added ImageType enum field and factory methods for different image contexts
AccompanyPostRequest.java Added images field to support image uploads in accompany posts
MemberProfileService.java Added profile image upload functionality
Various DTOs New request/response DTOs for image handling

Comment on lines +54 to +55
public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestBody ImageRequest request){
memberProfileService.uploadMemberProfileImage(user, request.getImageName(), request.getImageUrl());
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

The endpoint accepts ImageRequest with imageName and imageUrl via @RequestBody, but this assumes images are already uploaded elsewhere. This is inconsistent with the main image upload endpoint which handles MultipartFile uploads. Consider using the existing /api/v1/images/upload endpoint instead or clarify the intended workflow.

Suggested change
public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestBody ImageRequest request){
memberProfileService.uploadMemberProfileImage(user, request.getImageName(), request.getImageUrl());
public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestParam("file") MultipartFile file){
memberProfileService.uploadMemberProfileImage(user, file);

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +75
public static Image fromCommunity(String imageName, String imageUrl, Community community) {
return new Image(imageName, imageUrl, community, ImageType.COMMUNITY);
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

The fromCommunity factory method hardcodes ImageType.COMMUNITY instead of accepting it as a parameter like the other factory methods. This is inconsistent with fromAccompany and fromMember methods which accept ImageType as a parameter.

Suggested change
public static Image fromCommunity(String imageName, String imageUrl, Community community) {
return new Image(imageName, imageUrl, community, ImageType.COMMUNITY);
public static Image fromCommunity(String imageName, String imageUrl, Community community, ImageType imageType) {
return new Image(imageName, imageUrl, community, imageType);

Copilot uses AI. Check for mistakes.
.anyMatch(apply -> apply.getAccompany().equals(accompany));
if (alreadyApplied) {
throw BaseException.from(ErrorCode.TMP_ERROR);
throw BaseException.from(ErrorCode.ACCOMPANY_ALREADY_APPLIED);
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

The error code ACCOMPANY_ALREADY_APPLIED is used but this error code is not defined in the ErrorCode enum. This will cause a compilation error or runtime exception.

Copilot uses AI. Check for mistakes.
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

[nitpick] The annotation changed from @service to @component. Since this class provides business logic for S3 operations, @service would be more semantically appropriate as it clearly indicates this is a service layer component.

Suggested change
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

Copilot uses AI. Check for mistakes.
@LEEDONGH00N LEEDONGH00N merged commit 2e8310c into develop Aug 1, 2025
6 checks passed
@LEEDONGH00N LEEDONGH00N deleted the feat/issue-#61 branch August 1, 2025 13:02
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.

2 participants