-
Notifications
You must be signed in to change notification settings - Fork 0
[REFACTOR/#118] AWS S3 SDK v2 마이그레이션 및 분리되어 있던 테이블 통합 #119
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
Conversation
There was a problem hiding this 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 migrates the application to AWS S3 SDK v2 and consolidates the spot application data management by integrating previously separated tables. The major changes include updating the S3 adapter for presigned URL generation with file validation, consolidating apply_spot data into the main spot table, and adding cascade delete functionality for member withdrawal.
- AWS S3 SDK v2 migration with enhanced file validation and presigned URL generation
- Table consolidation: moving apply_spot data directly into spot table with status tracking
- Member withdrawal cascade delete implementation for related entities
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| S3Adapter.java | Complete migration to AWS SDK v2 with file validation and move operations |
| SpotService.java | Refactored spot application logic to use main spot table instead of separate apply_spot table |
| SpotEntity.java | Added appliedMemberId and spotStatus fields to support consolidated data model |
| MemberService.java | Updated presigned URL generation with file extension validation and cascade delete logic |
| ImageType.java | Enhanced with file extension validation and content type mapping |
| SpotStatus.java | New enum to track spot application status |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| DISCARDED, | ||
| ; | ||
|
|
||
| private static final Map<String, SpotStatus> SPOT_STATUS_MAP = new HashMap<>(); |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using EnumMap instead of HashMap for better performance and type safety when mapping enum values.
| for (String imageUrl : request.imageList()) { | ||
| s3Adapter.validateImageExists(imageUrl); | ||
| } | ||
|
|
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validating images individually in a loop can be inefficient for large image lists. Consider batch validation or parallel processing for better performance.
| for (String imageUrl : request.imageList()) { | |
| s3Adapter.validateImageExists(imageUrl); | |
| } | |
| request.imageList().parallelStream().forEach(s3Adapter::validateImageExists); |
| for (String imageUrl : request.imageList()) { | ||
| String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1); | ||
| String destinationKey = String.format("spots/%d/spot/%s", spotId, fileName); | ||
|
|
||
| String newImageUrl = s3Adapter.moveFile(imageUrl, destinationKey); | ||
| movedImageList.add(newImageUrl); | ||
| } | ||
|
|
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving files sequentially in a loop can be slow for multiple images. Consider using parallel processing or batch operations for S3 file moves.
| for (String imageUrl : request.imageList()) { | |
| String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1); | |
| String destinationKey = String.format("spots/%d/spot/%s", spotId, fileName); | |
| String newImageUrl = s3Adapter.moveFile(imageUrl, destinationKey); | |
| movedImageList.add(newImageUrl); | |
| } | |
| movedImageList.addAll( | |
| request.imageList().parallelStream() | |
| .map(imageUrl -> { | |
| String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1); | |
| String destinationKey = String.format("spots/%d/spot/%s", spotId, fileName); | |
| return s3Adapter.moveFile(imageUrl, destinationKey); | |
| }) | |
| .collect(Collectors.toList()) | |
| ); |
|
|
||
| private final List<String> allowedExtensions; | ||
|
|
||
| private static final Map<String, ImageType> IMAGE_TYPE_MAP = new HashMap<>(); |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using EnumMap instead of HashMap for better performance and type safety when mapping enum values.
| preferenceRepository.deleteById(memberId); | ||
| guidedSpotRepository.deleteAllByMemberId(memberId); | ||
| savedSpotRepository.deleteAllByMemberId(memberId); | ||
| verifiedAreaRepository.deleteAllByMemberId(memberId); |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sequential deletion operations can be inefficient. Consider using @transactional with batch operations or database cascade delete constraints for better performance.
| preferenceRepository.deleteById(memberId); | |
| guidedSpotRepository.deleteAllByMemberId(memberId); | |
| savedSpotRepository.deleteAllByMemberId(memberId); | |
| verifiedAreaRepository.deleteAllByMemberId(memberId); | |
| // Related entities are deleted via cascade delete from MemberEntity. |
💡 Issue
📄 Description