11package com .mycodingtest .application .collector ;
22
33import com .mycodingtest .application .collector .dto .CreateProblemAndJudgmentCommand ;
4- import com .mycodingtest .application .judgment .query .JudgmentQueryService ;
5- import com .mycodingtest .domain .common .Platform ;
6- import com .mycodingtest .domain .problem .Problem ;
7- import com .mycodingtest .application .judgment .command .JudgmentCommandService ;
84import com .mycodingtest .application .judgment .command .CreateBojJudgmentCommand ;
9- import com .mycodingtest .application .problem .ProblemService ;
10- import com .mycodingtest .application .problem .dto .CreateProblemCommand ;
5+ import com .mycodingtest .application .judgment .command .JudgmentCommandService ;
6+ import com .mycodingtest .application .judgment .query .JudgmentQueryService ;
7+ import com .mycodingtest .application .problem .command .ProblemCommandService ;
8+ import com .mycodingtest .application .problem .command .SyncProblemCommand ;
119import com .mycodingtest .application .review .ReviewService ;
1210import com .mycodingtest .application .review .dto .CreateReviewCommand ;
11+ import com .mycodingtest .domain .common .Platform ;
1312import lombok .RequiredArgsConstructor ;
1413import org .springframework .stereotype .Service ;
1514import org .springframework .transaction .annotation .Transactional ;
@@ -26,7 +25,7 @@ public class BojIngestionService {
2625
2726 private final JudgmentCommandService judgmentCommandService ;
2827 private final JudgmentQueryService judgmentQueryService ;
29- private final ProblemService problemService ;
28+ private final ProblemCommandService problemCommandService ;
3029 private final ReviewService reviewService ;
3130
3231 /**
@@ -40,11 +39,11 @@ public class BojIngestionService {
4039 @ Transactional
4140 public void ingest (CreateProblemAndJudgmentCommand command ) {
4241 // 1. 문제 엔티티 확보
43- Problem problem = problemService . getOrCreateProblem ( CreateProblemCommand .from (command , Platform .BOJ ));
42+ Long syncedProblemId = problemCommandService . syncProblem ( SyncProblemCommand .from (command , Platform .BOJ ));
4443 // 2. 채점 상세 기록 저장
45- judgmentCommandService .createJudgmentFromBoj (CreateBojJudgmentCommand .from (command , problem . getId () ));
44+ judgmentCommandService .createJudgmentFromBoj (CreateBojJudgmentCommand .from (command , syncedProblemId ));
4645 // 3. 리뷰 오답 노트 생성
47- reviewService .createReview (CreateReviewCommand .from (command , problem . getId () ));
46+ reviewService .createReview (CreateReviewCommand .from (command , syncedProblemId ));
4847 }
4948
5049 /**
0 commit comments