-
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.
- Loading branch information
Showing
6 changed files
with
85 additions
and
2 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
45 changes: 45 additions & 0 deletions
45
...i/src/main/java/sopt/org/umbba/api/controller/qna/dto/response/MyUserInfoResponseDto.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,45 @@ | ||
package sopt.org.umbba.api.controller.qna.dto.response; | ||
|
||
import static sopt.org.umbba.domain.domain.parentchild.ParentchildRelation.*; | ||
|
||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import sopt.org.umbba.domain.domain.parentchild.Parentchild; | ||
import sopt.org.umbba.domain.domain.parentchild.ParentchildRelation; | ||
import sopt.org.umbba.domain.domain.qna.QnA; | ||
import sopt.org.umbba.domain.domain.user.User; | ||
|
||
@Getter | ||
@Builder | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public class MyUserInfoResponseDto { | ||
|
||
private String myUsername; | ||
private String myUserType; | ||
private String opponentUsername; | ||
private String opponentUserType; | ||
|
||
private String parentchildRelation; | ||
private Boolean isMeChild; | ||
|
||
private String section; | ||
private Integer qnaDate; | ||
private Integer qnaCnt; | ||
|
||
public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchild parentchild, QnA qnA, int qnaCnt) { | ||
|
||
return MyUserInfoResponseDto.builder() | ||
.myUsername(myUser.getUsername()) | ||
.myUserType(getUserType(parentchild.getRelation(), myUser.isMeChild())) | ||
.opponentUsername(opponentUser.getUsername()) | ||
.opponentUserType(getUserType(parentchild.getRelation(), opponentUser.isMeChild())) | ||
.parentchildRelation(parentchild.getRelation().getValue()) | ||
.isMeChild(myUser.isMeChild()) | ||
.section(qnA.getQuestion().getSection().getValue()) | ||
.qnaDate(parentchild.getCount()) // 일수와 문답 수는 다를 수 있음 | ||
.qnaCnt(qnaCnt).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
. |
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