Skip to content

Commit

Permalink
MNG-24 feat: 유저 프로퍼티 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
minsu20 committed May 15, 2024
1 parent 6ab60be commit 1b3e028
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.moing.backend.domain.member.dto.response;

import com.moing.backend.domain.member.domain.constant.Gender;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class UserProperty {
private Gender gender;
private LocalDate birthDate;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.moing.backend.domain.team.application.dto.response;

import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.member.dto.response.UserProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -16,13 +18,16 @@ public class GetTeamResponse {
private String memberNickName;
private Integer numOfTeam;
private List<TeamBlock> teamBlocks = new ArrayList<>();
private UserProperty userProperty;

public GetTeamResponse(Integer numOfTeam, List<TeamBlock> teamBlocks) {
this.numOfTeam=numOfTeam;
this.teamBlocks = teamBlocks;
}
public void updateMemberNickName(String memberNickName) {
this.memberNickName=memberNickName;
public void updateMemberInfo(Member member) {
this.memberNickName=member.getNickName();
this.userProperty=new UserProperty(member.getGender(), member.getBirthDate());

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TeamGetService {

public GetTeamResponse getTeamByMember(Member member) {
GetTeamResponse getTeamResponse = teamRepository.findTeamByMemberId(member.getMemberId());
getTeamResponse.updateMemberNickName(member.getNickName());
getTeamResponse.updateMemberInfo(member);
return getTeamResponse;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.moing.backend.domain.team.presentation;

import com.moing.backend.config.CommonControllerTest;
import com.moing.backend.domain.member.domain.constant.Gender;
import com.moing.backend.domain.member.dto.response.UserProperty;
import com.moing.backend.domain.team.application.dto.request.CreateTeamRequest;
import com.moing.backend.domain.team.application.dto.request.UpdateTeamRequest;
import com.moing.backend.domain.team.application.dto.response.*;
Expand All @@ -12,6 +14,7 @@
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.test.web.servlet.ResultActions;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -129,10 +132,12 @@ public void get_team() throws Exception {
teamBlocks.add(teamBlock1);
teamBlocks.add(teamBlock2);

UserProperty userProperty=new UserProperty(Gender.WOMAN, LocalDate.of(2000, 3, 28));
GetTeamResponse output = GetTeamResponse.builder()
.numOfTeam(1)
.memberNickName("유저 닉네임")
.teamBlocks(teamBlocks)
.userProperty(userProperty)
.build();

given(getTeamUseCase.getTeam(any())).willReturn(output);
Expand Down Expand Up @@ -167,7 +172,9 @@ public void get_team() throws Exception {
fieldWithPath("data.teamBlocks[].category").description("소모임 카테고리"),
fieldWithPath("data.teamBlocks[].startDate").description("소모임 시작일"),
fieldWithPath("data.teamBlocks[].deletionTime").description("소모임 삭제 시간 (삭제 안했으면 null)"),
fieldWithPath("data.teamBlocks[].profileImgUrl").description("프로필 사진 url")
fieldWithPath("data.teamBlocks[].profileImgUrl").description("프로필 사진 url"),
fieldWithPath("data.userProperty.gender").description("유저 성별"),
fieldWithPath("data.userProperty.birthDate").description("유저 태어난 날")
)

)
Expand Down

0 comments on commit 1b3e028

Please sign in to comment.