Skip to content

Commit 0779bb8

Browse files
EpicFnEpicFn
andauthored
Hotfix/스페이스초대목록 반환 시 invite id 포함 (#123)
* fix : 스페이스 초대 목록 조회 시 inviteId 반환하도록 변경 * fix : 관련 테스트 케이스 수정 --------- Co-authored-by: EpicFn <[email protected]>
1 parent e909138 commit 0779bb8

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

src/main/java/org/tuna/zoopzoop/backend/domain/space/membership/controller/ApiV1InviteController.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.tuna.zoopzoop.backend.domain.member.entity.Member;
99
import org.tuna.zoopzoop.backend.domain.space.membership.entity.Membership;
1010
import org.tuna.zoopzoop.backend.domain.space.membership.service.MembershipService;
11+
import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInvitationInfo;
1112
import org.tuna.zoopzoop.backend.domain.space.space.dto.res.ResBodyForSpaceInviteList;
1213
import org.tuna.zoopzoop.backend.domain.space.space.dto.res.ResBodyForSpaceSave;
1314
import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInfoWithoutAuthority;
@@ -81,19 +82,20 @@ public RsData<ResBodyForSpaceInviteList> getMyInvites(
8182

8283
// 멤버십(초대) 목록 조회
8384
List<Membership> invitations = membershipService.findByMember(member, "PENDING");
84-
List<SpaceInfoWithoutAuthority> invitationInfos = invitations.stream()
85-
.map(membership -> new SpaceInfoWithoutAuthority(
85+
List<SpaceInvitationInfo> invitationInfo = invitations.stream()
86+
.map(membership -> new SpaceInvitationInfo(
8687
membership.getSpace().getId(),
8788
membership.getSpace().getName(),
88-
membership.getSpace().getThumbnailUrl()
89+
membership.getSpace().getThumbnailUrl(),
90+
membership.getId()
8991
))
9092
.toList();
9193

9294
return new RsData<>(
9395
"200",
9496
"사용자에게 온 스페이스 초대 목록을 조회했습니다.",
9597
new ResBodyForSpaceInviteList(
96-
invitationInfos
98+
invitationInfo
9799
)
98100
);
99101
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.tuna.zoopzoop.backend.domain.space.space.dto.etc;
2+
3+
public record SpaceInvitationInfo(
4+
Integer spaceId,
5+
String spaceName,
6+
String spaceThumbnailUrl,
7+
Integer inviteId
8+
) {
9+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package org.tuna.zoopzoop.backend.domain.space.space.dto.res;
22

33
import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInfoWithoutAuthority;
4+
import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInvitationInfo;
45

56
import java.util.List;
67

78
public record ResBodyForSpaceInviteList(
8-
List<SpaceInfoWithoutAuthority> spaces
9+
List<SpaceInvitationInfo> spaces
910
) {
1011
}

src/test/java/org/tuna/zoopzoop/backend/domain/space/membership/controller/ApiV1InviteControllerTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,14 @@ void getMyInvites_Success() throws Exception {
278278
resultActions
279279
.andExpect(jsonPath("$.data.spaces").isArray())
280280
.andExpect(jsonPath("$.data.spaces.length()").value(2))
281-
.andExpect(jsonPath("$.data.spaces[0].id").value(space1.getId()))
282-
.andExpect(jsonPath("$.data.spaces[0].name").value(space1.getName()))
283-
.andExpect(jsonPath("$.data.spaces[0].thumbnailUrl").value(space1.getThumbnailUrl()))
284-
.andExpect(jsonPath("$.data.spaces[1].id").value(space2.getId()))
285-
.andExpect(jsonPath("$.data.spaces[1].name").value(space2.getName()))
286-
.andExpect(jsonPath("$.data.spaces[1].thumbnailUrl").value(space2.getThumbnailUrl()));
281+
.andExpect(jsonPath("$.data.spaces[0].spaceId").value(space1.getId()))
282+
.andExpect(jsonPath("$.data.spaces[0].spaceName").value(space1.getName()))
283+
.andExpect(jsonPath("$.data.spaces[0].spaceThumbnailUrl").value(space1.getThumbnailUrl()))
284+
.andExpect(jsonPath("$.data.spaces[0].inviteId").isNumber())
285+
.andExpect(jsonPath("$.data.spaces[1].spaceId").value(space2.getId()))
286+
.andExpect(jsonPath("$.data.spaces[1].spaceName").value(space2.getName()))
287+
.andExpect(jsonPath("$.data.spaces[1].spaceThumbnailUrl").value(space2.getThumbnailUrl()))
288+
.andExpect(jsonPath("$.data.spaces[1].inviteId").isNumber());
287289
}
288290

289291

0 commit comments

Comments
 (0)