Skip to content

Commit

Permalink
[SAMBAD-248] 모임 목록 API에 모임명 정보 추가 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkjsw17 authored Aug 14, 2024
1 parent abfbd47 commit 5b43698
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void inactivateLastEventByType(Long userId, Long meetingId, EventType typ
.ifPresent(Event::inactivate);
}

@Transactional
public PollingEventListResponse getActiveEvents(Long userId, Long meetingId) {
meetingMemberValidator.validateUserIsMemberOfMeeting(userId, meetingId);
List<Event> events = eventRepository.findByUserIdAndMeetingIdAndStatus(userId, meetingId, EventStatus.ACTIVE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@
import io.swagger.v3.oas.annotations.media.Schema;

public record MeetingResponse(
@Schema(description = "모임 ID 목록", example = "[1, 2, 3]", requiredMode = REQUIRED)
List<Long> meetingIds
@Schema(description = "가입 되어 있는 모임의 정보 목록", requiredMode = REQUIRED)
List<MeetingResponseDetail> meetings
) {
public static MeetingResponse from(List<Meeting> meetings) {
return new MeetingResponse(
meetings.stream()
.map(Meeting::getId)
.map(meeting -> new MeetingResponseDetail(meeting.getId(), meeting.getName()))
.toList()
);
}

public record MeetingResponseDetail(
@Schema(description = "모임 ID", example = "1", requiredMode = REQUIRED)
Long meetingId,

@Schema(description = "모임명", example = "삼밧드의 모험", requiredMode = REQUIRED)
String name
) {
}
}

0 comments on commit 5b43698

Please sign in to comment.