From 603f155bf1d13b543cd8d8e4ee62d27d63c8aae6 Mon Sep 17 00:00:00 2001 From: hong seokho Date: Tue, 4 Jun 2024 22:59:54 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=8B=A8=EC=96=B4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 더 명확한 의미를 위해 반의어인 receiving으로 수정 --- .../api/query/MemberGroupQueryApi.java | 4 ++-- .../query/MemberGroupQueryApiController.java | 14 +++++++------- .../data/dto/GroupInviteSummaryDto.java | 10 +++++----- ...> GroupReceivingInviteSummaryResponse.java} | 10 +++++----- ...=> GroupReceivingInvitesSliceResponse.java} | 10 +++++----- .../GroupInviteQueryRepository.java | 2 +- .../GroupInviteQueryRepositoryImpl.java | 18 +++--------------- .../service/MemberGroupQueryService.java | 4 ++-- .../GroupInviteQueryRepositoryTest.java | 10 +++++----- 9 files changed, 35 insertions(+), 47 deletions(-) rename backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/{GroupReceptionInviteSummaryResponse.java => GroupReceivingInviteSummaryResponse.java} (76%) rename backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/{GroupReceptionInvitesSliceResponse.java => GroupReceivingInvitesSliceResponse.java} (64%) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApi.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApi.java index b3fc268bd..92489c5c3 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApi.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApi.java @@ -8,7 +8,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import java.time.ZonedDateTime; import org.springframework.http.ResponseEntity; -import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceptionInvitesSliceResponse; +import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceivingInvitesSliceResponse; import site.timecapsulearchive.core.domain.member_group.data.response.GroupSendingInvitesResponse; import site.timecapsulearchive.core.global.common.response.ApiSpec; @@ -27,7 +27,7 @@ public interface MemberGroupQueryApi { description = "ok" ) }) - ResponseEntity> findGroupReceptionInvites( + ResponseEntity> findGroupReceivingInvites( Long memberId, @Parameter(in = ParameterIn.QUERY, description = "페이지 크기", required = true) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApiController.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApiController.java index 0685b9703..2d1e1e6ff 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApiController.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/api/query/MemberGroupQueryApiController.java @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController; import site.timecapsulearchive.core.domain.member_group.data.dto.GroupInviteSummaryDto; import site.timecapsulearchive.core.domain.member_group.data.dto.GroupSendingInviteMemberDto; -import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceptionInvitesSliceResponse; +import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceivingInvitesSliceResponse; import site.timecapsulearchive.core.domain.member_group.data.response.GroupSendingInvitesResponse; import site.timecapsulearchive.core.domain.member_group.service.MemberGroupQueryService; import site.timecapsulearchive.core.global.common.response.ApiSpec; @@ -30,24 +30,24 @@ public class MemberGroupQueryApiController implements MemberGroupQueryApi { @GetMapping( - value = "/reception-invites", + value = "/receiving-invites", produces = {"application/json"} ) @Override - public ResponseEntity> findGroupReceptionInvites( + public ResponseEntity> findGroupReceivingInvites( @AuthenticationPrincipal final Long memberId, @RequestParam(defaultValue = "20", value = "size") final int size, @RequestParam(value = "created_at") final ZonedDateTime createdAt ) { - final Slice groupInviteSummarySlice = memberGroupQueryService.findGroupReceptionInvitesSlice( + final Slice groupReceivingInvitesSlice = memberGroupQueryService.findGroupReceivingInvitesSlice( memberId, size, createdAt); return ResponseEntity.ok( ApiSpec.success( SuccessCode.SUCCESS, - GroupReceptionInvitesSliceResponse.createOf( - groupInviteSummarySlice.getContent(), - groupInviteSummarySlice.hasNext(), + GroupReceivingInvitesSliceResponse.createOf( + groupReceivingInvitesSlice.getContent(), + groupReceivingInvitesSlice.hasNext(), s3PreSignedUrlManager::getS3PreSignedUrlForGet ) ) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/dto/GroupInviteSummaryDto.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/dto/GroupInviteSummaryDto.java index 3d3ec6570..a5fb7fb54 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/dto/GroupInviteSummaryDto.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/dto/GroupInviteSummaryDto.java @@ -3,7 +3,7 @@ import java.time.ZonedDateTime; import java.util.function.Function; import lombok.Builder; -import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceptionInviteSummaryResponse; +import site.timecapsulearchive.core.domain.member_group.data.response.GroupReceivingInviteSummaryResponse; @Builder public record GroupInviteSummaryDto( @@ -12,19 +12,19 @@ public record GroupInviteSummaryDto( String groupName, String groupProfileUrl, String description, - ZonedDateTime groupReceptionInviteTime, + ZonedDateTime groupReceivingInviteTime, String groupOwnerName ) { - public GroupReceptionInviteSummaryResponse toResponse( + public GroupReceivingInviteSummaryResponse toResponse( final Function preSignedUrlFunction ) { - return GroupReceptionInviteSummaryResponse.builder() + return GroupReceivingInviteSummaryResponse.builder() .groupId(groupId) .groupName(groupName) .groupProfileUrl(preSignedUrlFunction.apply(groupProfileUrl)) .description(description) - .groupReceptionInviteTime(groupReceptionInviteTime) + .groupReceivingInviteTime(groupReceivingInviteTime) .groupOwnerName(groupOwnerName) .build(); } diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInviteSummaryResponse.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInviteSummaryResponse.java similarity index 76% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInviteSummaryResponse.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInviteSummaryResponse.java index dff6de490..13d154fff 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInviteSummaryResponse.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInviteSummaryResponse.java @@ -7,7 +7,7 @@ @Builder @Schema(description = "초대온 그룹 요약 정보") -public record GroupReceptionInviteSummaryResponse( +public record GroupReceivingInviteSummaryResponse( @Schema(description = "그룹 아이디") Long groupId, @@ -22,15 +22,15 @@ public record GroupReceptionInviteSummaryResponse( String description, @Schema(description = "그룹 초대 시간") - ZonedDateTime groupReceptionInviteTime, + ZonedDateTime groupReceivingInviteTime, @Schema(description = "그룹장") String groupOwnerName ) { - public GroupReceptionInviteSummaryResponse { - if (groupReceptionInviteTime != null) { - groupReceptionInviteTime = groupReceptionInviteTime.withZoneSameInstant( + public GroupReceivingInviteSummaryResponse { + if (groupReceivingInviteTime != null) { + groupReceivingInviteTime = groupReceivingInviteTime.withZoneSameInstant( ResponseMappingConstant.ZONE_ID); } } diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInvitesSliceResponse.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInvitesSliceResponse.java similarity index 64% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInvitesSliceResponse.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInvitesSliceResponse.java index 95e5acdd8..815b84658 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceptionInvitesSliceResponse.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/data/response/GroupReceivingInvitesSliceResponse.java @@ -5,23 +5,23 @@ import java.util.function.Function; import site.timecapsulearchive.core.domain.member_group.data.dto.GroupInviteSummaryDto; -public record GroupReceptionInvitesSliceResponse( +public record GroupReceivingInvitesSliceResponse( @Schema(description = "초대 온 그룹 요약 정보 리스트") - List responses, + List responses, @Schema(description = "다음 페이지 유무") Boolean hasNext ) { - public static GroupReceptionInvitesSliceResponse createOf( + public static GroupReceivingInvitesSliceResponse createOf( final List dtos, final boolean hasNext, final Function preSignedUrlFunction ) { - List groupReceptionInviteSummaryResponses = dtos.stream() + List groupReceivingInviteSummaryResponse = dtos.stream() .map(dto -> dto.toResponse(preSignedUrlFunction)).toList(); - return new GroupReceptionInvitesSliceResponse(groupReceptionInviteSummaryResponses, + return new GroupReceivingInvitesSliceResponse(groupReceivingInviteSummaryResponse, hasNext); } } diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepository.java index 899883909..c9c5c3166 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepository.java @@ -12,7 +12,7 @@ public interface GroupInviteQueryRepository { List findGroupInviteIdsByGroupIdAndGroupOwnerId(final Long groupId, final Long memberId); - Slice findGroupRecetpionInvitesSlice( + Slice findGroupReceivingInvitesSlice( final Long memberId, final int size, final ZonedDateTime createdAt diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java index 85465284a..fd3b95d2c 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java @@ -22,6 +22,7 @@ import org.springframework.stereotype.Repository; import site.timecapsulearchive.core.domain.member_group.data.dto.GroupInviteSummaryDto; import site.timecapsulearchive.core.domain.member_group.data.dto.GroupSendingInviteMemberDto; +import site.timecapsulearchive.core.global.util.SliceUtil; @Repository @RequiredArgsConstructor @@ -72,7 +73,7 @@ public List findGroupInviteIdsByGroupIdAndGroupOwnerId( } @Override - public Slice findGroupRecetpionInvitesSlice( + public Slice findGroupReceivingInvitesSlice( final Long memberId, final int size, final ZonedDateTime createdAt @@ -96,22 +97,9 @@ public Slice findGroupRecetpionInvitesSlice( .limit(size + 1) .fetch(); - return makeSlice(size, groupInviteSummaryDtos); + return SliceUtil.makeSlice(size, groupInviteSummaryDtos); } - private Slice makeSlice( - final int size, - final List dtos - ) { - final boolean hasNext = dtos.size() > size; - if (hasNext) { - dtos.remove(size); - } - - return new SliceImpl<>(dtos, Pageable.ofSize(size), hasNext); - } - - @Override public List findGroupSendingInvites( final Long memberId, final Long groupId diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/service/MemberGroupQueryService.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/service/MemberGroupQueryService.java index 90b888beb..e44aa6f7f 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/service/MemberGroupQueryService.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/service/MemberGroupQueryService.java @@ -17,12 +17,12 @@ public class MemberGroupQueryService { private final GroupInviteRepository groupInviteRepository; - public Slice findGroupReceptionInvitesSlice( + public Slice findGroupReceivingInvitesSlice( final Long memberId, final int size, final ZonedDateTime createdAt ) { - return groupInviteRepository.findGroupRecetpionInvitesSlice(memberId, size, createdAt); + return groupInviteRepository.findGroupReceivingInvitesSlice(memberId, size, createdAt); } public List findGroupSendingInvites( diff --git a/backend/core/src/test/java/site/timecapsulearchive/core/domain/member_group/repository/GroupInviteQueryRepositoryTest.java b/backend/core/src/test/java/site/timecapsulearchive/core/domain/member_group/repository/GroupInviteQueryRepositoryTest.java index 65910ed1c..5e8522e18 100644 --- a/backend/core/src/test/java/site/timecapsulearchive/core/domain/member_group/repository/GroupInviteQueryRepositoryTest.java +++ b/backend/core/src/test/java/site/timecapsulearchive/core/domain/member_group/repository/GroupInviteQueryRepositoryTest.java @@ -80,7 +80,7 @@ void setUp(@Autowired EntityManager entityManager) { ZonedDateTime createAt = ZonedDateTime.now().plusDays(1); //when - Slice groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice( + Slice groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice( memberId, size, createAt); //then @@ -95,7 +95,7 @@ void setUp(@Autowired EntityManager entityManager) { ZonedDateTime createAt = ZonedDateTime.now().plusDays(1); //when - Slice groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice( + Slice groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice( memberId, size, createAt); //then @@ -114,13 +114,13 @@ void setUp(@Autowired EntityManager entityManager) { Long memberId = groupMemberId; int size = 1; ZonedDateTime now = ZonedDateTime.now(ZoneId.of("UTC")).plusDays(3); - Slice firstSlice = groupInviteRepository.findGroupRecetpionInvitesSlice( + Slice firstSlice = groupInviteRepository.findGroupReceivingInvitesSlice( memberId, size, now); //when GroupInviteSummaryDto dto = firstSlice.getContent().get(0); - Slice groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice( - memberId, size, dto.groupReceptionInviteTime().plusSeconds(1L)); + Slice groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice( + memberId, size, dto.groupReceivingInviteTime().plusSeconds(1L)); //then assertThat(groupInvitesSummary.getContent()).isNotEmpty();