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

[MNG-21] hotfix : 미션 재인증(삭제) 시 500에러 해결 #284

Merged
merged 1 commit into from
May 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 @@ -12,6 +12,7 @@
import com.moing.backend.domain.missionArchive.domain.service.MissionArchiveQueryService;
import com.moing.backend.domain.missionArchive.domain.service.MissionArchiveSaveService;
import com.moing.backend.domain.missionArchive.exception.NoAccessMissionArchiveException;
import com.moing.backend.domain.missionComment.domain.service.MissionCommentDeleteService;
import com.moing.backend.domain.missionHeart.domain.service.MissionHeartQueryService;
import com.moing.backend.domain.team.domain.entity.Team;
import com.moing.backend.domain.teamScore.application.service.TeamScoreUpdateUseCase;
Expand All @@ -31,6 +32,7 @@ public class MissionArchiveDeleteUseCase {
private final MissionArchiveQueryService missionArchiveQueryService;
private final MissionArchiveDeleteService missionArchiveDeleteService;
private final MissionQueryService missionQueryService;
private final MissionCommentDeleteService missionCommentDeleteService;

private final MemberGetService memberGetService;
private final TeamScoreUpdateUseCase teamScoreUpdateUseCase;
Expand Down Expand Up @@ -61,6 +63,7 @@ public Long deleteArchive(String userSocialId, Long missionId,Long count) {
updateUtils.deleteImgUrl(archive);
}

missionCommentDeleteService.deleteAllCommentByMissionArchive(deleteArchive.getId());
missionArchiveDeleteService.deleteMissionArchive(deleteArchive);
teamScoreUpdateUseCase.gainScoreOfArchive(mission, ScoreStatus.MINUS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.moing.backend.domain.missionArchive.domain.entity.MissionArchive;
import com.moing.backend.domain.missionArchive.domain.repository.MissionArchiveRepository;
import com.moing.backend.domain.missionComment.domain.service.MissionCommentDeleteService;
import com.moing.backend.global.annotation.DomainService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import com.moing.backend.domain.missionComment.domain.entity.MissionComment;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface MissionCommentRepository extends JpaRepository<MissionComment, Long>, MissionCommentCustomRepository {

Optional<MissionComment> findMissionCommentByMissionCommentId(Long missionCommentId);

void deleteAllMissionCommentsByMissionArchiveId(Long missionArchiveId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ public class MissionCommentDeleteService implements CommentDeleteService<Mission
public void deleteComment(MissionComment comment) {
missionCommentRepository.delete(comment);
}

public void deleteAllCommentByMissionArchive(Long missionArchiveId) {
missionCommentRepository.deleteAllMissionCommentsByMissionArchiveId(missionArchiveId);
}
}
Loading