-
Notifications
You must be signed in to change notification settings - Fork 2
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 #491 from tukcomCD2024/fix/group_capsule-B-#490
fix : 그룹 캡슐 요약 조회 api 수정 #490
- Loading branch information
Showing
24 changed files
with
790 additions
and
330 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
89 changes: 89 additions & 0 deletions
89
...ulearchive/core/domain/capsule/group_capsule/data/dto/CombinedGroupCapsuleSummaryDto.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,89 @@ | ||
package site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
import java.util.function.UnaryOperator; | ||
import org.locationtech.jts.geom.Point; | ||
import site.timecapsulearchive.core.domain.capsule.group_capsule.data.response.GroupCapsuleMemberResponse; | ||
import site.timecapsulearchive.core.domain.capsule.group_capsule.data.response.GroupCapsuleSummaryResponse; | ||
|
||
public record CombinedGroupCapsuleSummaryDto( | ||
Long groupId, | ||
String groupName, | ||
String groupProfileUrl, | ||
String creatorNickname, | ||
String creatorProfileUrl, | ||
String skinUrl, | ||
String title, | ||
ZonedDateTime dueDate, | ||
Point point, | ||
String address, | ||
String roadName, | ||
Boolean isCapsuleOpened, | ||
ZonedDateTime createdAt, | ||
Boolean isRequestMemberCapsuleOpen, | ||
Boolean hasEditPermission, | ||
Boolean hasDeletePermission, | ||
List<GroupCapsuleMemberDto> groupMembers | ||
) { | ||
|
||
public static CombinedGroupCapsuleSummaryDto create( | ||
final GroupCapsuleSummaryDto groupCapsuleSummaryDto, | ||
final List<GroupCapsuleMemberDto> groupCapsuleMemberSummaryDtos, | ||
final Boolean isRequestMemberCapsuleOpen, | ||
final Boolean hasEditPermission, | ||
final Boolean hasDeletePermission | ||
) { | ||
return new CombinedGroupCapsuleSummaryDto( | ||
groupCapsuleSummaryDto.groupId(), | ||
groupCapsuleSummaryDto.groupName(), | ||
groupCapsuleSummaryDto.groupProfileUrl(), | ||
groupCapsuleSummaryDto.creatorNickname(), | ||
groupCapsuleSummaryDto.creatorProfileUrl(), | ||
groupCapsuleSummaryDto.skinUrl(), | ||
groupCapsuleSummaryDto.title(), | ||
groupCapsuleSummaryDto.dueDate(), | ||
groupCapsuleSummaryDto.point(), | ||
groupCapsuleSummaryDto.address(), | ||
groupCapsuleSummaryDto.roadName(), | ||
groupCapsuleSummaryDto.isOpened(), | ||
groupCapsuleSummaryDto.createdAt(), | ||
isRequestMemberCapsuleOpen, | ||
hasEditPermission, | ||
hasDeletePermission, | ||
groupCapsuleMemberSummaryDtos | ||
); | ||
} | ||
|
||
public GroupCapsuleSummaryResponse toResponse( | ||
final UnaryOperator<String> preSignUrlFunction, | ||
final UnaryOperator<Point> changePointFunction | ||
) { | ||
final Point changePoint = changePointFunction.apply(point); | ||
|
||
final List<GroupCapsuleMemberResponse> groupMembers = this.groupMembers.stream() | ||
.map(GroupCapsuleMemberDto::toResponse) | ||
.toList(); | ||
|
||
return GroupCapsuleSummaryResponse.builder() | ||
.groupId(groupId) | ||
.groupMembers(groupMembers) | ||
.groupName(groupName) | ||
.groupProfileUrl(preSignUrlFunction.apply(groupProfileUrl)) | ||
.creatorNickname(creatorNickname) | ||
.creatorProfileUrl(creatorProfileUrl) | ||
.skinUrl(preSignUrlFunction.apply(skinUrl)) | ||
.title(title) | ||
.dueDate(dueDate) | ||
.latitude(changePoint.getX()) | ||
.longitude(changePoint.getY()) | ||
.address(address) | ||
.roadName(roadName) | ||
.isCapsuleOpened(isCapsuleOpened) | ||
.isRequestMemberCapsuleOpened(isRequestMemberCapsuleOpen) | ||
.hasEditPermission(hasEditPermission) | ||
.hasDeletePermission(hasDeletePermission) | ||
.createdAt(createdAt) | ||
.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
16 changes: 16 additions & 0 deletions
16
.../timecapsulearchive/core/domain/capsule/group_capsule/data/dto/GroupCapsuleMemberDto.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 site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto; | ||
|
||
import site.timecapsulearchive.core.domain.capsule.group_capsule.data.response.GroupCapsuleMemberResponse; | ||
|
||
public record GroupCapsuleMemberDto( | ||
Long id, | ||
String nickname, | ||
String profileUrl, | ||
Boolean isGroupOwner, | ||
Boolean isOpened | ||
) { | ||
|
||
public GroupCapsuleMemberResponse toResponse() { | ||
return new GroupCapsuleMemberResponse(id, nickname, profileUrl, isGroupOwner, isOpened); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...psulearchive/core/domain/capsule/group_capsule/data/dto/GroupCapsuleMemberSummaryDto.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 site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto; | ||
|
||
import site.timecapsulearchive.core.domain.capsule.group_capsule.data.response.GroupCapsuleMemberSummaryResponse; | ||
|
||
public record GroupCapsuleMemberSummaryDto( | ||
String nickname, | ||
String profileUrl, | ||
Boolean isOpened | ||
) { | ||
|
||
public GroupCapsuleMemberSummaryResponse toResponse() { | ||
return new GroupCapsuleMemberSummaryResponse(nickname, profileUrl, isOpened); | ||
} | ||
} |
50 changes: 15 additions & 35 deletions
50
...timecapsulearchive/core/domain/capsule/group_capsule/data/dto/GroupCapsuleSummaryDto.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,43 +1,23 @@ | ||
package site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto; | ||
|
||
import java.util.List; | ||
import java.util.function.Function; | ||
import java.time.ZonedDateTime; | ||
import org.locationtech.jts.geom.Point; | ||
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.dto.CapsuleSummaryDto; | ||
import site.timecapsulearchive.core.domain.capsule.group_capsule.data.response.GroupCapsuleSummaryResponse; | ||
import site.timecapsulearchive.core.domain.group.data.dto.GroupMemberSummaryDto; | ||
import site.timecapsulearchive.core.domain.group.data.response.GroupMemberSummaryResponse; | ||
|
||
public record GroupCapsuleSummaryDto( | ||
CapsuleSummaryDto capsuleSummaryDto, | ||
List<GroupMemberSummaryDto> members | ||
Long groupId, | ||
String groupName, | ||
String groupProfileUrl, | ||
Long creatorId, | ||
String creatorNickname, | ||
String creatorProfileUrl, | ||
String skinUrl, | ||
String title, | ||
ZonedDateTime dueDate, | ||
Point point, | ||
String address, | ||
String roadName, | ||
Boolean isOpened, | ||
ZonedDateTime createdAt | ||
) { | ||
|
||
public List<GroupMemberSummaryResponse> groupMemberSummaryDtoToResponse() { | ||
return members.stream() | ||
.map(GroupMemberSummaryDto::toResponse) | ||
.toList(); | ||
} | ||
|
||
public GroupCapsuleSummaryResponse toResponse( | ||
final Function<String, String> preSignUrlFunction, | ||
final Function<Point, Point> changePointFunction | ||
) { | ||
final Point changePoint = changePointFunction.apply(capsuleSummaryDto.point()); | ||
|
||
return GroupCapsuleSummaryResponse.builder() | ||
.members(groupMemberSummaryDtoToResponse()) | ||
.nickname(capsuleSummaryDto.nickname()) | ||
.profileUrl(capsuleSummaryDto.profileUrl()) | ||
.skinUrl(preSignUrlFunction.apply(capsuleSummaryDto.skinUrl())) | ||
.title(capsuleSummaryDto.title()) | ||
.dueDate(capsuleSummaryDto.dueDate()) | ||
.latitude(changePoint.getX()) | ||
.longitude(changePoint.getY()) | ||
.address(capsuleSummaryDto.address()) | ||
.roadName(capsuleSummaryDto.roadName()) | ||
.isOpened(capsuleSummaryDto.isOpened()) | ||
.createdAt(capsuleSummaryDto.createdAt()) | ||
.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
24 changes: 24 additions & 0 deletions
24
...learchive/core/domain/capsule/group_capsule/data/response/GroupCapsuleMemberResponse.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,24 @@ | ||
package site.timecapsulearchive.core.domain.capsule.group_capsule.data.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "그룹원 요약 정보") | ||
public record GroupCapsuleMemberResponse( | ||
|
||
@Schema(description = "사용자 아이디") | ||
Long id, | ||
|
||
@Schema(description = "닉네임") | ||
String nickname, | ||
|
||
@Schema(description = "프로필 url") | ||
String profileUrl, | ||
|
||
@Schema(description = "그룹장 여부") | ||
Boolean isGroupOwner, | ||
|
||
@Schema(description = "개봉 여부") | ||
Boolean isOpened | ||
) { | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
.../response/GroupMemberSummaryResponse.java → ...se/GroupCapsuleMemberSummaryResponse.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
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
Oops, something went wrong.