Skip to content

Commit

Permalink
�chore: fe 요청에 맞게 수정 (#166)
Browse files Browse the repository at this point in the history
* chore: 필수 질문 제외 추가

* chore: 분석 여부 확인 로직 추가
  • Loading branch information
mikekks authored Aug 19, 2024
1 parent eb892ac commit cc0b052
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public record AnswerListGetResponse(
@Schema(description = "질문 기준 결과", example = "")
List<AnswerByQuestionGetResponse> questions,
@Schema(description = "개별 기준 결과", example = "")
List<AnswerByPersonGetResponse> individuals
List<AnswerByPersonGetResponse> individuals,
@Schema(description = "AI 분석 완료 여부", example = "true")
boolean hasAIAnalyzed
) {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.layer.domain.answer.service;

import lombok.RequiredArgsConstructor;

import org.layer.domain.analyze.entity.Analyze;
import org.layer.domain.analyze.repository.AnalyzeRepository;
import org.layer.domain.answer.controller.dto.request.AnswerCreateRequest;
import org.layer.domain.answer.controller.dto.request.AnswerListCreateRequest;
import org.layer.domain.answer.controller.dto.request.AnswerListUpdateRequest;
Expand Down Expand Up @@ -42,6 +45,7 @@ public class AnswerService {
private final RetrospectRepository retrospectRepository;
private final QuestionRepository questionRepository;
private final MemberRepository memberRepository;
private final AnalyzeRepository analyzeRepository;

private final Time time;

Expand Down Expand Up @@ -181,7 +185,10 @@ public AnswerListGetResponse getAnalyzeAnswer(Long spaceId, Long retrospectId, L
List<AnswerByPersonGetResponse> answerByPerson = getAnswerByPersonGetResponses(
answers, members, questions);

return new AnswerListGetResponse(answerByQuestions, answerByPerson);
// AI 기반 분석 여부 확인
Optional<Analyze> analyze = analyzeRepository.findByRetrospectId(retrospectId);

return new AnswerListGetResponse(answerByQuestions, answerByPerson, analyze.isPresent());
}

public List<WrittenAnswerGetResponse> getWrittenAnswer(Long spaceId, Long retrospectId, Long memberId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.layer.domain.form.exception.FormException;
import org.layer.domain.form.repository.FormRepository;
import org.layer.domain.question.entity.Question;
import org.layer.domain.question.enums.QuestionType;
import org.layer.domain.question.repository.QuestionRepository;
import org.layer.domain.space.entity.MemberSpaceRelation;
import org.layer.domain.space.entity.Space;
Expand Down Expand Up @@ -44,8 +45,13 @@ public class FormService {
private final TemplateMetadataRepository metadataRepository;

private static final int MIN = 10000;
private static final int MAX = 10002;
private static final int MAX = 10005;

/**
* 회고 폼 질문을 조회한다.
*
* @apiNote 필수질문(답변이 텍스트가 아닌 질문)은 모두 제외
* */
public FormGetResponse getForm(Long formId, Long memberId) {
Form form = formRepository.findByIdOrThrow(formId);

Expand All @@ -58,6 +64,7 @@ public FormGetResponse getForm(Long formId, Long memberId) {
List<Question> questions = questionRepository.findAllByFormId(formId);

List<QuestionGetResponse> questionResponses = questions.stream()
.filter(question -> question.getQuestionType().equals(QuestionType.PLAIN_TEXT))
.map(question -> QuestionGetResponse.of(question.getContent(),
question.getQuestionType().getStyle()))
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public record RetrospectGetResponse(
long writeCount,
@Schema(description = "전체 인원", example = "10")
long totalCount,

@Schema(description = "회고 생성 일자")
LocalDateTime createdAt,

@Schema(description = "회고 종료 일자")
LocalDateTime deadline
) {
Expand Down

0 comments on commit cc0b052

Please sign in to comment.