Skip to content

Commit

Permalink
fix: AI 생성 문제 기반의 CategorizedProblem 삭제 버그 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
yujamint committed Jul 10, 2024
1 parent f56090f commit 291c73c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
import com.app.domain.category.service.CategoryService;
import com.app.domain.member.entity.Member;
import com.app.domain.member.service.MemberService;
import com.app.domain.problem.aigeneratedproblem.service.AiGeneratedProblemService;
import com.app.domain.problem.entity.Problem;
import com.app.domain.problem.membersavedproblem.dto.MemberSavedProblemDto;
import com.app.domain.problem.membersavedproblem.mapper.MemberSavedProblemMapper;
import com.app.domain.problem.membersavedproblem.service.MemberSavedProblemService;
import com.app.domain.problem.service.ProblemService;
import com.app.domain.summary.membersavedsummary.dto.MemberSavedSummaryDto;
import com.app.global.config.ENUM.ProblemType;
Expand Down Expand Up @@ -40,8 +38,6 @@
public class CategorizedProblemService {
private final CategoryService categoryService;

private final MemberSavedProblemService memberSavedProblemService;

private final MemberService memberService;

private final MemberSavedProblemMapper memberSavedProblemMapper;
Expand Down Expand Up @@ -259,7 +255,7 @@ public void deleteCategorizedProblem(Long categorizedProblemID){
Problem problem = categorizedProblem.getProblem();
Long problemId = problem.getProblemId();
if (problem.isMemberSavedProblem() && !isProblemUsedInOtherCategorizedProblems(problemId)) {
memberSavedProblemService.deleteProblem(problemId);
problemService.deleteProblem(problemId);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.app.domain.problem.service;

import com.app.domain.problem.entity.Problem;
import com.app.domain.problem.membersavedproblem.entity.MemberSavedProblem;
import com.app.domain.problem.repository.ProblemRepository;
import com.app.global.error.ErrorCode;
import com.app.global.error.exception.EntityNotFoundException;
Expand Down Expand Up @@ -38,4 +39,10 @@ public Problem findVerifiedProblemByProblemId(Long problemId) {
.orElseThrow(() -> new EntityNotFoundException(ErrorCode.PROBLEM_NOT_EXISTS));
}

public void deleteProblem(Long problemId){
Problem problem = findVerifiedProblemByProblemId(problemId);

problemRepository.deleteById(problemId);
}

}

0 comments on commit 291c73c

Please sign in to comment.