diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java index d68900d07..17110e817 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java @@ -38,5 +38,4 @@ public interface QueryRecruitmentPort { List getRecent(); - boolean existsByCompanyId(Long companyId); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CheckRecruitmentExistsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CheckRecruitmentExistsUseCase.java index b40e4bb9c..bf279ac9a 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CheckRecruitmentExistsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CheckRecruitmentExistsUseCase.java @@ -10,7 +10,7 @@ public class CheckRecruitmentExistsUseCase { private final RecruitmentPort recruitmentPort; - public boolean execute(Long companyId) { - return recruitmentPort.existsByCompanyId(companyId); + public boolean execute(Long companyId, boolean winterIntern) { + return recruitmentPort.existsByCompanyIdAndWinterIntern(companyId, winterIntern); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java index 906e6760c..478d4eae6 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java @@ -364,7 +364,7 @@ public List getAllByIdInOrThrow(List recruitmentIds) { @Override public boolean existsByCompanyIdAndWinterIntern(Long companyId, boolean winterIntern) { - return recruitmentJpaRepository.existsByCompanyIdAndStatusNotAndWinterIntern(companyId, RecruitStatus.DONE, winterIntern); + return recruitmentJpaRepository.existsByCompanyIdAndWinterIntern(companyId, winterIntern); } @Override @@ -401,11 +401,6 @@ public List getRecent() { return recruitmentJpaRepository.findByCreationDateBetween(oneDayAgo, now); } - @Override - public boolean existsByCompanyId(Long companyId) { - return recruitmentJpaRepository.existsByCompanyId(companyId); - } - //===conditions===// private BooleanExpression eqYear(Integer year) { diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/RecruitmentJpaRepository.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/RecruitmentJpaRepository.java index 484ca16c5..95b23ee1b 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/RecruitmentJpaRepository.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/RecruitmentJpaRepository.java @@ -14,7 +14,7 @@ public interface RecruitmentJpaRepository extends JpaRepository findByIdIn(List recruitmentIds); - boolean existsByCompanyIdAndStatusNotAndWinterIntern(Long companyId, RecruitStatus status, boolean winterIntern); + boolean existsByCompanyIdAndWinterIntern(Long companyId, boolean winterIntern); @Query("SELECT r FROM RecruitmentEntity r WHERE r.createdAt BETWEEN :startDate AND :endDate") List findByCreationDateBetween(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java index b6efae05b..d350bcb3a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java @@ -253,8 +253,11 @@ public byte[] exportRecruitmentHistory(HttpServletResponse httpResponse) { } @GetMapping("/exists/{company-id}") - public boolean checkRecruitmentExists(@PathVariable("company-id") Long companyId) { - return checkRecruitmentExistsUseCase.execute(companyId); + public boolean checkRecruitmentExists( + @PathVariable("company-id") Long companyId, + @RequestParam(value = "winter_intern") Boolean winterIntern + ) { + return checkRecruitmentExistsUseCase.execute(companyId, winterIntern); } private List parseCodes(String jobCode, String techCodes) {