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

[OING-191] hotfix: 회원가입 시에 프로필 이미지 키 추출하는 로직 수정 #149

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ private String generateUniqueImageName(String imageName) {

@Override
public String extractImageKey(String imageUrl) {
if (imageUrl == null) {
return null;
}
Pattern pattern1 = Pattern.compile("https://.+?/" + Pattern.quote(bucket) + "/(.+)");
Pattern pattern2 = Pattern.compile("https://" + Pattern.quote(bucket) + ".+?/" + "(.+)");

Expand Down
8 changes: 2 additions & 6 deletions member/src/main/java/com/oing/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
public class MemberService {
private final MemberRepository memberRepository;
private final SocialMemberRepository socialMemberRepository;

private final IdentityGenerator identityGenerator;
private final PreSignedUrlGenerator preSignedUrlGenerator;
private final IdentityGenerator identityGenerator;

public Member findMemberById(String memberId) {
return memberRepository
Expand Down Expand Up @@ -62,6 +61,7 @@ public Member createNewMember(CreateNewUserDTO createNewUserDTO) {
.id(identityGenerator.generateIdentity())
.dayOfBirth(createNewUserDTO.dayOfBirth())
.profileImgUrl(createNewUserDTO.profileImgUrl())
.profileImgKey(preSignedUrlGenerator.extractImageKey(createNewUserDTO.profileImgUrl()))
.name(createNewUserDTO.memberName())
.build();
memberRepository.save(member);
Expand All @@ -73,10 +73,6 @@ public Member createNewMember(CreateNewUserDTO createNewUserDTO) {
member);
socialMemberRepository.save(socialMember);

if (createNewUserDTO.profileImgUrl() != null) {
member.setProfileImgKey(preSignedUrlGenerator.extractImageKey(createNewUserDTO.profileImgUrl()));
}

return member;
}

Expand Down
Loading