From 1bffd86b12f55ed4a13726fd7f5034c2836ca795 Mon Sep 17 00:00:00 2001 From: Jin Hyuk Date: Mon, 16 Sep 2024 14:36:52 +0900 Subject: [PATCH] =?UTF-8?q?[feat]:=20=ED=95=B4=EB=8B=B9=20=EA=B8=B0?= =?UTF-8?q?=EC=88=98=EC=97=90=20=EB=A7=9E=EB=8A=94=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=EC=84=9C=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domains/applicant/adaptor/AnswerAdaptor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/adaptor/AnswerAdaptor.java b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/adaptor/AnswerAdaptor.java index 31ddedc3..e0ef4eb1 100644 --- a/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/adaptor/AnswerAdaptor.java +++ b/server/Recruit-Domain/src/main/java/com/econovation/recruitdomain/domains/applicant/adaptor/AnswerAdaptor.java @@ -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; @@ -48,7 +50,11 @@ public List findByYear(Integer year) { Query query = new Query() .addCriteria(Criteria.where("year").is(year)); - return mongoTemplate.find(query, MongoAnswer.class); + List result = mongoTemplate.find(query, MongoAnswer.class); + if(result.isEmpty()) { + throw ApplicantNotFoundException.EXCEPTION; + } + return result; } public long getTotalCountByYear(Integer year) {