Skip to content

Commit

Permalink
Merge pull request #156 from Modagbul/feat/mission
Browse files Browse the repository at this point in the history
fix : 다시 인증하기 로직에 s3 삭제 로직 추가
  • Loading branch information
seungueonn authored Dec 17, 2023
2 parents 40b83f3 + 172bbae commit 7fb90e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.moing.backend.domain.missionState.domain.service.MissionStateQueryService;
import com.moing.backend.domain.missionState.domain.service.MissionStateSaveService;
import com.moing.backend.domain.team.domain.entity.Team;
import com.moing.backend.global.utils.UpdateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -43,13 +44,12 @@ public class MissionArchiveDeleteUseCase {

private final MemberGetService memberGetService;

private final IssuePresignedUrlUseCase getPresignedUrlUseCase;

private final MissionStateSaveService missionStateSaveService;
private final MissionStateUseCase missionStateUseCase;
private final MissionStateDeleteService missionStateDeleteService;
private final MissionStateQueryService missionStateQueryService;

private final UpdateUtils updateUtils;



public Long deleteArchive(String userSocialId, Long missionId,Long count) {

Expand All @@ -69,6 +69,11 @@ public Long deleteArchive(String userSocialId, Long missionId,Long count) {
throw new NoAccessMissionArchiveException();
}

if (mission.getWay().equals(MissionWay.PHOTO)) {
String archive = deleteArchive.getArchive();
updateUtils.deleteImgUrl(archive);
}

missionArchiveDeleteService.deleteMissionArchive(deleteArchive);
missionStateDeleteService.deleteMissionState(missionState);

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/moing/backend/global/utils/UpdateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ public void deleteOldImgUrl(String currentImageUrl, String oldImageUrl) {
s3Service.deleteImage(oldImageUrl);
}
}

public void deleteImgUrl(String imageUrl) {
if (imageUrl != null) {
s3Service.deleteImage(imageUrl);
}
}
}

0 comments on commit 7fb90e1

Please sign in to comment.