-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 과거의 질문과 답변 리스트 + 개별 조회 API
- Loading branch information
Showing
13 changed files
with
170 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...main/java/sopt/org/umbbaServer/domain/qna/controller/dto/response/QnAListResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package sopt.org.umbbaServer.domain.qna.controller.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class QnAListResponseDto { | ||
|
||
private int index; | ||
private String question; | ||
} |
57 changes: 57 additions & 0 deletions
57
...in/java/sopt/org/umbbaServer/domain/qna/controller/dto/response/SingleQnAResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package sopt.org.umbbaServer.domain.qna.controller.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import sopt.org.umbbaServer.domain.qna.model.QnA; | ||
import sopt.org.umbbaServer.domain.qna.model.Question; | ||
import sopt.org.umbbaServer.domain.user.model.User; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class SingleQnAResponseDto { | ||
|
||
private String section; | ||
private String topic; | ||
|
||
private String opponentQuestion; | ||
private String myQuestion; | ||
|
||
private String opponentAnswer; | ||
private String myAnswer; | ||
|
||
private String opponentUsername; | ||
private String myUsername; | ||
|
||
public static SingleQnAResponseDto of(User myUser, User opponentUser, QnA todayQnA, Question todayQuestion, boolean isMeChild) { | ||
String opponentQuestion; | ||
String myQuestion; | ||
String opponentAnswer; | ||
String myAnswer; | ||
|
||
if (isMeChild) { | ||
opponentQuestion = todayQuestion.getParentQuestion(); | ||
myQuestion = todayQuestion.getChildQuestion(); | ||
opponentAnswer = todayQnA.getParentAnswer(); | ||
myAnswer = todayQnA.getChildAnswer(); | ||
} else { | ||
opponentQuestion = todayQuestion.getChildQuestion(); | ||
myQuestion = todayQuestion.getParentQuestion(); | ||
opponentAnswer = todayQnA.getChildAnswer(); | ||
myAnswer = todayQnA.getParentAnswer(); | ||
} | ||
|
||
return SingleQnAResponseDto.builder() | ||
.section(todayQuestion.getSection().getValue()) | ||
.topic(todayQuestion.getTopic()) | ||
.opponentQuestion(opponentQuestion) | ||
.myQuestion(myQuestion) | ||
.opponentAnswer(opponentAnswer) | ||
.myAnswer(myAnswer) | ||
.opponentUsername(opponentUser.getUsername()) | ||
.myUsername(myUser.getUsername()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/java/sopt/org/umbbaServer/domain/qna/model/QuestionEffect.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters