Skip to content

Commit

Permalink
Merge pull request #144 from Team-Shaka/refactor/143
Browse files Browse the repository at this point in the history
♻️ Refactor: 내가 받은 초대장 로직 수정
  • Loading branch information
koojun99 authored Oct 17, 2024
2 parents 80c5057 + 62645d4 commit fd542a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public InvitationResponseDTO.getInvitations getInvitations(User user) {
List<Invitation> invitations = invitationQueryAdapter.findAllByPhone(user.getPhone());

List<InvitationResponseDTO.getInvitation> invitationDtos = invitations.stream()
// 초대장을 보낸 트리하우스에 이미 가입한 멤버는 제외
.filter(invitation ->
invitation.getTreeHouse().getMemberList().stream()
.noneMatch(member -> member.getUser().getId().equals(user.getId()))
)
.map(invitation -> {
TreeHouse treeHouse = invitation.getTreeHouse();
List<Member> treeMembers = treeHouse.getMemberList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import treehouse.server.global.entity.User.User;
import treehouse.server.global.entity.User.UserRole;
import treehouse.server.global.entity.redis.RefreshToken;
import treehouse.server.global.entity.treeHouse.TreeHouse;
import treehouse.server.global.redis.service.RedisService;
import treehouse.server.global.security.jwt.dto.TokenDTO;
import treehouse.server.global.security.provider.TokenProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public enum GlobalErrorCode implements BaseErrorCode{
INVITATION_NOT_FOUND(NOT_FOUND, "INVITATION404_1", "존재하지 않는 초대장입니다."),

// INVITATION + 409 CONFLICT : Resource 를 찾을 수 없음
INVITATION_ALREADY_EXIST(CONFLICT, "INVITATION409_1", "이미 존재하는 초대장입니다."),
INVITATION_ALREADY_EXIST(CONFLICT, "INVITATION409_1", "이미 해당 트리하우스에 초대되었습니다."),

// POST + 401 Unauthorized - 권한 없음
POST_UNAUTHORIZED(UNAUTHORIZED, "POST401_1", "게시글 수정 및 삭제 권한이 없습니다."),
Expand Down

0 comments on commit fd542a9

Please sign in to comment.