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

[SAMBAD-248] 모임 목록 API에 모임명 정보 추가 #99

Merged
merged 2 commits into from
Aug 14, 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 @@ -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
) {
}
}
Loading