Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/ne-o-rdinary/back into feat/…
Browse files Browse the repository at this point in the history
…getAnswer
  • Loading branch information
hcg0127 committed Nov 23, 2024
2 parents 8c261a9 + 79fdd60 commit 055f93a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
@Getter
public class AnswerResponseDto {

private int imageIndex;

private String question;

private String answer;

public AnswerResponseDto(String question, String answer) {
public AnswerResponseDto(int imageIndex, String question, String answer) {
this.imageIndex = imageIndex;
this.question = question;
this.answer = answer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
public class QuestionResponseDTO {
private Long questionId;
private String question;
public QuestionResponseDTO(Long questionId, String question) {
private int imageIndex;
public QuestionResponseDTO(Long questionId, String question, int imageIndex) {
this.questionId = questionId;
this.question = question;
this.imageIndex = imageIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class Question extends BaseEntity {
@Column(nullable = false, columnDefinition = "VARCHAR(15)")
private QuestionCategory questionCategory;

@Column
private int imageIndex;

public Question(String question) {
this.question = question;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public AnswerResponseDto getAnswer(String uuid) {
throw new GeneralException(ErrorStatus.QUESTION_ANSWER_NOT_FOUND.getReasonHttpStatus());
}

return new AnswerResponseDto(questionAnswer.getQuestion().getQuestion(),
return new AnswerResponseDto(questionAnswer.getQuestion().getImageIndex(),questionAnswer.getQuestion().getQuestion(),
questionAnswer.getAnswer().getAnswer());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public QuestionResponseDTO getRandomQuestion(QuestionCategory category) {
return QuestionResponseDTO.builder()
.questionId(q.getId())
.question(q.getQuestion())
.imageIndex(q.getImageIndex())
.build();
}
}

0 comments on commit 055f93a

Please sign in to comment.