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

Feat/#8 #9

Merged
merged 2 commits into from
Aug 15, 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 @@ -30,8 +30,8 @@
@RequiredArgsConstructor
public class AuthServiceImpl implements AuthService {

@Value("${aws-property.s3-default-image-url}")
private String GHOST_IMAGE_S3;
// @Value("${aws-property.s3-default-image-url}")
// private String GHOST_IMAGE_S3;
private final static String DEFAULT_NICKNAME="";

private final JwtTokenProvider jwtTokenProvider;
Expand All @@ -57,7 +57,7 @@ public AuthResponseDto socialLogin(String socialAccessToken, AuthRequestDto auth
.nickname(DEFAULT_NICKNAME)//.nickname(socialData.getNickname())
.socialPlatform(socialPlatform)
.socialId(socialData.getId())
.profileUrl(GHOST_IMAGE_S3)
.profileUrl("")
.memberEmail(socialData.getEmail())
.socialNickname(socialData.getNickname())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record ProfilePatchRequestDto (
Boolean isPushAlarmAllowed,
String fcmToken,
String memberFanTeam,
Integer memberLckYears
Integer memberLckYears,
String memberDefaultProfileImage
){
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public class MemberCommandService {
private final CommentLikedRepository commentLikedRepository;
private final ContentLikedRepository contentLikedRepository;
private final S3Service s3Service;
private final static String GHOST_IMAGE = "https://github.com/TeamDon-tBe/SERVER/assets/97835512/fb3ea04c-661e-4221-a837-854d66cdb77e";

@Value("${aws-property.s3-default-image-url}")
private String GHOST_IMAGE_S3;
@Value("${aws-property.s3-system-image-url}")
private String SYSTEM_IMAGE_S3;

@Value("${aws-property.s3-domain}")
private String S3_URL;
Expand All @@ -53,7 +52,7 @@ public void withdrawalMember(Long memberId, MemberWithdrawalPatchRequestDto memb
List<Ghost> ghosts = ghostRepository.findByGhostTargetMember(member);

member.updateNickname("탈퇴한 회원");
member.updateProfileUrl(GHOST_IMAGE_S3);
member.updateProfileUrl(SYSTEM_IMAGE_S3);
member.updateDeletedReason(memberWithdrawalPatchRequestDto.deleted_reason());

// notificationRepository.deleteBynotificationTargetMember(member);
Expand Down Expand Up @@ -163,10 +162,9 @@ public void updateMemberProfile2(Long memberId, MultipartFile multipartFile, Pro
try {
String s3ImageUrl = s3Service.uploadImage(memberId.toString(), multipartFile);

if(!existedImage.equals(GHOST_IMAGE)&&!existedImage.equals(GHOST_IMAGE_S3)) {
String existedKey = removeBaseUrl(existedImage, S3_URL);
s3Service.deleteImage(existedKey);
}
String existedKey = removeBaseUrl(existedImage, S3_URL);

s3Service.deleteImage(existedKey);

existingMember.updateProfileUrl(s3ImageUrl);
} catch (IOException e) {
Expand All @@ -188,6 +186,9 @@ public void updateMemberProfile2(Long memberId, MultipartFile multipartFile, Pro
if (profilePatchRequestDto.memberLckYears() != null) {
existingMember.updateMemberLckYears(profilePatchRequestDto.memberLckYears());
}
if (profilePatchRequestDto.memberDefaultProfileImage() != null) {
existingMember.updateProfileUrl(profilePatchRequestDto.memberDefaultProfileImage());
}
memberRepository.save(existingMember);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class NotificationQueryService {

@Value("${aws-property.s3-system-image-url}")
private String SYSTEM_IMAGE_S3;

@Value("${aws-property.s3-popular-image-url}")
private String POPULAR_IMAGE_S3;
private final int NOTIFICATION_DEFAULT_PAGE_SIZE = 15;

public NotificaitonCountResponseDto countUnreadNotification(Long memberId) {
Expand Down Expand Up @@ -127,6 +130,9 @@ private String profileUrl(Long notificationId, String triggerType){
Notification notification = notificationRepository.findNotificationById(notificationId);
Member triggerMember = memberRepository.findMemberByIdOrThrow(notification.getNotificationTriggerMemberId());
return triggerMember.getProfileUrl();
}
if(triggerType.equals("popularWriter")||triggerType.equals("popularContent")) {
return POPULAR_IMAGE_S3;
}else{
return SYSTEM_IMAGE_S3;
}
Expand Down
Loading