Skip to content

Commit

Permalink
[feat]: 해당 기수에 맞는 지원서가 없는 경우 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
LJH098 committed Sep 16, 2024
1 parent 97cfd2b commit 1bffd86
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswer;
import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswerRepository;
import java.util.List;

import com.econovation.recruitdomain.domains.applicant.exception.ApplicantNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -48,7 +50,11 @@ public List<MongoAnswer> findByYear(Integer year) {
Query query =
new Query()
.addCriteria(Criteria.where("year").is(year));
return mongoTemplate.find(query, MongoAnswer.class);
List<MongoAnswer> result = mongoTemplate.find(query, MongoAnswer.class);
if(result.isEmpty()) {
throw ApplicantNotFoundException.EXCEPTION;
}
return result;
}

public long getTotalCountByYear(Integer year) {
Expand Down

0 comments on commit 1bffd86

Please sign in to comment.