Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 모임 가입자 조회 API 쿼리 파라미터 추가 #82

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public ResponseEntity<MeetingDto> getMeeting(
@IsMemberByMeetingId(meetingIdParamIndex = 0)
@GetMapping("/v1/meetings/{meetingId}/members")
public ResponseEntity<MembersDto> getMembers(
@PathVariable final Long meetingId
@PathVariable final Long meetingId,
@RequestParam(name = "exclude", required = false) final String exclude,
@UserId final Long userId
) {
return ResponseEntity.ok(meetingService.getMembers(meetingId));
return ResponseEntity.ok(meetingService.getMembers(meetingId, exclude, userId));
}

}
5 changes: 5 additions & 0 deletions src/main/java/org/kkumulkkum/server/domain/Participant.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(
uniqueConstraints = {
@UniqueConstraint(columnNames = {"promise_id", "member_id"})
}
)
public class Participant extends BaseTimeEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ public MeetingDto getMeeting(final Long meetingId) {
}

@Transactional(readOnly = true)
public MembersDto getMembers(final Long meetingId) {
public MembersDto getMembers(final Long meetingId, final String exclude, final Long userId) {
List<MemberDto> members = memberRetreiver.findAllByMeetingId(meetingId);
if (exclude != null) {
Member authenticatedMember = memberRetreiver.findByMeetingIdAndUserId(meetingId, userId);
members.removeIf(member -> member.memberId().equals(authenticatedMember.getId()));
}
return MembersDto.from(members);
}

Expand Down
Loading