Skip to content

Commit

Permalink
⚙️ :: (807) 모집의뢰서 상태 변경 스케줄러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Nov 21, 2024
1 parent d15d2de commit ae22fe6
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import team.retum.jobis.common.annotation.UseCase;
import team.retum.jobis.common.spi.PublishEventPort;
import team.retum.jobis.domain.recruitment.event.RecruitmentStatusChangedEvent;
import team.retum.jobis.domain.intern.event.WinterInternRegisteredEvent;
import team.retum.jobis.domain.recruitment.model.Recruitment;
import team.retum.jobis.domain.recruitment.spi.RecruitmentPort;

Expand All @@ -20,18 +19,11 @@ public class ChangeRecruitmentStatusSchedulerUseCase {
public void execute() {
List<Recruitment> recruitments = recruitmentPort.getAll();

List<Recruitment> updatedRecruitments = recruitments.stream()
.map(Recruitment::updateRecruitmentStatus)
.toList();

List<Recruitment> winterInternRecruitments = updatedRecruitments.stream()
.filter(Recruitment::isWinterIntern)
.toList();

publishEventPort.publishEvent(new RecruitmentStatusChangedEvent(updatedRecruitments));

if (!winterInternRecruitments.isEmpty()) {
publishEventPort.publishEvent(new WinterInternRegisteredEvent(winterInternRecruitments));
}
recruitmentPort.saveAll(
recruitments.stream()
.map(Recruitment::updateRecruitmentStatus)
.toList()
);
publishEventPort.publishEvent(new RecruitmentStatusChangedEvent(recruitments));
}
}

0 comments on commit ae22fe6

Please sign in to comment.