Skip to content

Commit

Permalink
Merge pull request #8 from ne-o-rdinary/refactor/imageIndex
Browse files Browse the repository at this point in the history
refactor : responseDto imageIndex 전송
  • Loading branch information
OZIIJIN authored Nov 23, 2024
2 parents cdeca90 + 3ce5466 commit 79fdd60
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 @@ -49,7 +49,7 @@ public AnswerCreateResponseDto createAnswer(AnswerRequestDto dto) {
public AnswerResponseDto getAnswer(String uuid) {
QuestionAnswer questionAnswer = questionAnswerQuery.findByUUID(uuid);

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 79fdd60

Please sign in to comment.