Skip to content

Commit

Permalink
fix : 다른 날짜의 데일리 질문에도 답변을 남길 수 있도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Dec 17, 2023
1 parent 8cbc4a5 commit e3a533f
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package tify.server.domain.domains.question.validator;


import java.time.LocalDate;
import lombok.RequiredArgsConstructor;
import tify.server.core.annotation.Validator;
import tify.server.domain.domains.question.adaptor.AnswerAdaptor;
import tify.server.domain.domains.question.adaptor.DailyQuestionAdaptor;
import tify.server.domain.domains.question.exception.AlreadyAnsweredQuestionException;
import tify.server.domain.domains.question.exception.NotValidTodayQuestionException;

@Validator
@RequiredArgsConstructor
Expand All @@ -17,11 +15,6 @@ public class QuestionValidator {
private final AnswerAdaptor answerAdaptor;

public void isValidateAnswerToQuestion(Long questionId, Long userId) {
// 질문이 오늘 날짜의 질문이 맞는지
LocalDate now = LocalDate.now();
if (!dailyQuestionAdaptor.query(questionId).getLoadingDate().isEqual(now)) {
throw NotValidTodayQuestionException.EXCEPTION;
}
// 유저가 이미 해당 질문에 대한 답을 남겼는지
if (answerAdaptor.optionalQueryByQuestionAndUser(questionId, userId).isPresent()) {
throw AlreadyAnsweredQuestionException.EXCEPTION;
Expand Down

0 comments on commit e3a533f

Please sign in to comment.