Skip to content

Commit

Permalink
[OING-191] hotfix: 회원가입 시에 프로필 이미지 키 추출하는 로직 수정 (#149)
Browse files Browse the repository at this point in the history
* fix: move setProfileImgKey logic to AuthController

* style: uncomment class file

* fix: fix profileImgKey logic in createNewMember
  • Loading branch information
Ji-soo708 authored Feb 7, 2024
1 parent 10b9c8f commit 408e7c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
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

0 comments on commit 408e7c9

Please sign in to comment.