Skip to content

Commit

Permalink
chore(profileImage): change profileImage objectKey format
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaerim1001 committed Aug 28, 2023
1 parent 92a8ccb commit 6377eb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class MemberImageServiceImpl implements MemberImageService {
@Value("${aws.s3.profileImageBucket}")
private String profileImageBucket;

private static final String HTTPS_ADDRESS = "https://";
private static final String AWS_S3_DOMAIN = ".s3.ap-northeast-2.amazonaws.com/";
private static final String VERSION_PREFIX = "v1/";
private static final String BASIC_PREFIX = "/basic/";
private static final String LOW_PREFIX = "/low/";
Expand All @@ -42,7 +44,9 @@ public void uploadProfileImage(Long memberId, MultipartFile file) {
VERSION_PREFIX + memberId + LOW_PREFIX + randomKey + FILE_EXTENSION;

s3Service.upload(file, basicObjectKey, profileImageBucket);

member.saveProfileImage(new ProfileImage(basicObjectKey, lowObjectKey));
System.out.println("basicObjectKey = " + basicObjectKey);
member.saveProfileImage(
new ProfileImage(HTTPS_ADDRESS + profileImageBucket + AWS_S3_DOMAIN + basicObjectKey,
HTTPS_ADDRESS + profileImageBucket + AWS_S3_DOMAIN + lowObjectKey));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ CREATE TABLE IF NOT EXISTS `member`
`mbti` tinyint NOT NULL,
`credit` smallint UNSIGNED NOT NULL,
`image_auth` tinyint DEFAULT 0,
`basic_url` varchar(60),
`low_url` varchar(60),
`basic_url` varchar(150),
`low_url` varchar(150),
`created_at` datetime(6),
`modified_at` datetime(6),
`deleted_at` datetime(6),
Expand Down

0 comments on commit 6377eb0

Please sign in to comment.