-
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
8 changed files
with
117 additions
and
5 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
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
58 changes: 58 additions & 0 deletions
58
...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,58 @@ | ||
package sopt.org.umbba.api.controller.qna.dto.response; | ||
|
||
import static sopt.org.umbba.domain.domain.parentchild.ParentchildRelation.*; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
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.qna.QuestionSection; | ||
import sopt.org.umbba.domain.domain.user.User; | ||
|
||
@Getter | ||
@Builder | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
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 Long matchedDate; | ||
private Integer qnaCnt; | ||
|
||
public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchild parentchild, QnA qnA, long date, 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()) | ||
.matchedDate(date) // 일수와 문답 수는 다를 수 있음 | ||
.qnaCnt(qnaCnt).build(); | ||
} | ||
|
||
// 아직 매칭된 유저가 없는 경우 | ||
public static MyUserInfoResponseDto of(User myUser) { | ||
|
||
return MyUserInfoResponseDto.builder() | ||
.myUsername(myUser.getUsername()) | ||
.section(QuestionSection.YOUNG.getValue()) | ||
.matchedDate(0L) | ||
.qnaCnt(0).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