Skip to content

Commit

Permalink
fix : 단어 수정
Browse files Browse the repository at this point in the history
- 더 명확한 의미를 위해 반의어인 receiving으로 수정
  • Loading branch information
seokho-1116 committed Jun 4, 2024
1 parent 86641df commit 603f155
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,7 +27,7 @@ public interface MemberGroupQueryApi {
description = "ok"
)
})
ResponseEntity<ApiSpec<GroupReceptionInvitesSliceResponse>> findGroupReceptionInvites(
ResponseEntity<ApiSpec<GroupReceivingInvitesSliceResponse>> findGroupReceivingInvites(
Long memberId,

@Parameter(in = ParameterIn.QUERY, description = "페이지 크기", required = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,24 +30,24 @@ public class MemberGroupQueryApiController implements MemberGroupQueryApi {


@GetMapping(
value = "/reception-invites",
value = "/receiving-invites",
produces = {"application/json"}
)
@Override
public ResponseEntity<ApiSpec<GroupReceptionInvitesSliceResponse>> findGroupReceptionInvites(
public ResponseEntity<ApiSpec<GroupReceivingInvitesSliceResponse>> findGroupReceivingInvites(
@AuthenticationPrincipal final Long memberId,
@RequestParam(defaultValue = "20", value = "size") final int size,
@RequestParam(value = "created_at") final ZonedDateTime createdAt
) {
final Slice<GroupInviteSummaryDto> groupInviteSummarySlice = memberGroupQueryService.findGroupReceptionInvitesSlice(
final Slice<GroupInviteSummaryDto> 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
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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<String, String> preSignedUrlFunction
) {
return GroupReceptionInviteSummaryResponse.builder()
return GroupReceivingInviteSummaryResponse.builder()
.groupId(groupId)
.groupName(groupName)
.groupProfileUrl(preSignedUrlFunction.apply(groupProfileUrl))
.description(description)
.groupReceptionInviteTime(groupReceptionInviteTime)
.groupReceivingInviteTime(groupReceivingInviteTime)
.groupOwnerName(groupOwnerName)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@Builder
@Schema(description = "초대온 그룹 요약 정보")
public record GroupReceptionInviteSummaryResponse(
public record GroupReceivingInviteSummaryResponse(

@Schema(description = "그룹 아이디")
Long groupId,
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GroupReceptionInviteSummaryResponse> responses,
List<GroupReceivingInviteSummaryResponse> responses,

@Schema(description = "다음 페이지 유무")
Boolean hasNext
) {

public static GroupReceptionInvitesSliceResponse createOf(
public static GroupReceivingInvitesSliceResponse createOf(
final List<GroupInviteSummaryDto> dtos,
final boolean hasNext,
final Function<String, String> preSignedUrlFunction
) {
List<GroupReceptionInviteSummaryResponse> groupReceptionInviteSummaryResponses = dtos.stream()
List<GroupReceivingInviteSummaryResponse> groupReceivingInviteSummaryResponse = dtos.stream()
.map(dto -> dto.toResponse(preSignedUrlFunction)).toList();

return new GroupReceptionInvitesSliceResponse(groupReceptionInviteSummaryResponses,
return new GroupReceivingInvitesSliceResponse(groupReceivingInviteSummaryResponse,
hasNext);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface GroupInviteQueryRepository {

List<Long> findGroupInviteIdsByGroupIdAndGroupOwnerId(final Long groupId, final Long memberId);

Slice<GroupInviteSummaryDto> findGroupRecetpionInvitesSlice(
Slice<GroupInviteSummaryDto> findGroupReceivingInvitesSlice(
final Long memberId,
final int size,
final ZonedDateTime createdAt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,7 +73,7 @@ public List<Long> findGroupInviteIdsByGroupIdAndGroupOwnerId(
}

@Override
public Slice<GroupInviteSummaryDto> findGroupRecetpionInvitesSlice(
public Slice<GroupInviteSummaryDto> findGroupReceivingInvitesSlice(
final Long memberId,
final int size,
final ZonedDateTime createdAt
Expand All @@ -96,22 +97,9 @@ public Slice<GroupInviteSummaryDto> findGroupRecetpionInvitesSlice(
.limit(size + 1)
.fetch();

return makeSlice(size, groupInviteSummaryDtos);
return SliceUtil.makeSlice(size, groupInviteSummaryDtos);
}

private <T> Slice<T> makeSlice(
final int size,
final List<T> dtos
) {
final boolean hasNext = dtos.size() > size;
if (hasNext) {
dtos.remove(size);
}

return new SliceImpl<>(dtos, Pageable.ofSize(size), hasNext);
}

@Override
public List<GroupSendingInviteMemberDto> findGroupSendingInvites(
final Long memberId,
final Long groupId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public class MemberGroupQueryService {

private final GroupInviteRepository groupInviteRepository;

public Slice<GroupInviteSummaryDto> findGroupReceptionInvitesSlice(
public Slice<GroupInviteSummaryDto> findGroupReceivingInvitesSlice(
final Long memberId,
final int size,
final ZonedDateTime createdAt
) {
return groupInviteRepository.findGroupRecetpionInvitesSlice(memberId, size, createdAt);
return groupInviteRepository.findGroupReceivingInvitesSlice(memberId, size, createdAt);
}

public List<GroupSendingInviteMemberDto> findGroupSendingInvites(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void setUp(@Autowired EntityManager entityManager) {
ZonedDateTime createAt = ZonedDateTime.now().plusDays(1);

//when
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice(
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice(
memberId, size, createAt);

//then
Expand All @@ -95,7 +95,7 @@ void setUp(@Autowired EntityManager entityManager) {
ZonedDateTime createAt = ZonedDateTime.now().plusDays(1);

//when
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice(
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice(
memberId, size, createAt);

//then
Expand All @@ -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<GroupInviteSummaryDto> firstSlice = groupInviteRepository.findGroupRecetpionInvitesSlice(
Slice<GroupInviteSummaryDto> firstSlice = groupInviteRepository.findGroupReceivingInvitesSlice(
memberId, size, now);

//when
GroupInviteSummaryDto dto = firstSlice.getContent().get(0);
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupRecetpionInvitesSlice(
memberId, size, dto.groupReceptionInviteTime().plusSeconds(1L));
Slice<GroupInviteSummaryDto> groupInvitesSummary = groupInviteRepository.findGroupReceivingInvitesSlice(
memberId, size, dto.groupReceivingInviteTime().plusSeconds(1L));

//then
assertThat(groupInvitesSummary.getContent()).isNotEmpty();
Expand Down

0 comments on commit 603f155

Please sign in to comment.