-
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.
Merge pull request #182 from IoTeaTime/feature/181-member-detail
feat: 회원 상세 정보 조회 시 그룹 정보도 함께 조회
- Loading branch information
Showing
6 changed files
with
60 additions
and
14 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
14 changes: 14 additions & 0 deletions
14
src/main/java/org/ioteatime/meonghanyangserver/member/dto/response/GroupDetailResponse.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,14 @@ | ||
package org.ioteatime.meonghanyangserver.member.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.ioteatime.meonghanyangserver.group.domain.GroupEntity; | ||
|
||
@Schema(description = "그룹의 상세 정보 조회") | ||
public record GroupDetailResponse( | ||
@NotNull @Schema(description = "그룹 ID", example = "1") Long id, | ||
@NotNull @Schema(description = "그룹 이름", example = "멍하냥 그룹") String groupName) { | ||
public static GroupDetailResponse from(GroupEntity group) { | ||
return new GroupDetailResponse(group.getId(), group.getGroupName()); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...a/org/ioteatime/meonghanyangserver/member/dto/response/MemberWithGroupDetailResponse.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,16 @@ | ||
package org.ioteatime.meonghanyangserver.member.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
@Schema(description = "회원 및 그룹 정보 조회") | ||
public record MemberWithGroupDetailResponse( | ||
@NotNull @Schema(description = "회원 정보") MemberDetailResponse member, | ||
@Schema(description = "그룹 정보") GroupDetailResponse group) { | ||
@Builder | ||
public MemberWithGroupDetailResponse(MemberDetailResponse member, GroupDetailResponse group) { | ||
this.member = member; | ||
this.group = group; | ||
} | ||
} |
16 changes: 13 additions & 3 deletions
16
src/main/java/org/ioteatime/meonghanyangserver/member/mapper/MemberResponseMapper.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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
package org.ioteatime.meonghanyangserver.member.mapper; | ||
|
||
import org.ioteatime.meonghanyangserver.group.domain.GroupEntity; | ||
import org.ioteatime.meonghanyangserver.member.domain.MemberEntity; | ||
import org.ioteatime.meonghanyangserver.member.dto.response.GroupDetailResponse; | ||
import org.ioteatime.meonghanyangserver.member.dto.response.MemberDetailResponse; | ||
import org.ioteatime.meonghanyangserver.member.dto.response.MemberWithGroupDetailResponse; | ||
|
||
public class MemberResponseMapper { | ||
public static MemberDetailResponse from(MemberEntity member) { | ||
return new MemberDetailResponse( | ||
member.getId(), member.getEmail(), member.getProfileImgUrl(), member.getNickname()); | ||
public static MemberWithGroupDetailResponse from(MemberEntity member, GroupEntity group) { | ||
MemberDetailResponse memberDetail = MemberDetailResponse.from(member); | ||
if (group != null) { | ||
GroupDetailResponse groupDetail = GroupDetailResponse.from(group); | ||
return MemberWithGroupDetailResponse.builder() | ||
.member(memberDetail) | ||
.group(groupDetail) | ||
.build(); | ||
} | ||
return MemberWithGroupDetailResponse.builder().member(memberDetail).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