Skip to content
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 @@ -64,6 +64,6 @@ public static FlashDetailResponse from(FlashFacade.FlashDetail result) {
meeting.isApply(),
meeting.isApproved(),
MeetingUserResponse.from(meeting.leader()),
meeting.applies().stream().map(MeetingApplyWithUserResponse::from).toList());
MeetingApplyWithUserResponse.fromAll(meeting.applies()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@
import org.sopt.makers.domain.crew.meeting.facade.MeetingFacade;

public record JoinedMeetingPageResponse(
List<JoinedMeetingResponse> data,
long totalCount,
int totalPage,
int limit,
int pageNo,
boolean hasNextPage,
boolean hasPrevPage) {
List<JoinedMeetingResponse> meetings, MeetingPageMetaResponse meta) {

public static JoinedMeetingPageResponse from(PageResult<MeetingFacade.JoinedMeetingResult> page) {
return new JoinedMeetingPageResponse(
page.content().stream().map(JoinedMeetingResponse::from).toList(),
page.totalElements(),
page.totalPages(),
page.limit(),
page.page(),
page.hasNext(),
page.hasPrevious());
MeetingPageMetaResponse.from(page));
}

public record JoinedMeetingResponse(String role, MeetingSummaryResponse meeting) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public record MeetingApplicantListResponse(List<MeetingApplyWithUserResponse> ap
}

public static MeetingApplicantListResponse from(List<MeetingService.ApplyDetail> applicants) {
return new MeetingApplicantListResponse(
applicants.stream().map(MeetingApplyWithUserResponse::from).toList());
return new MeetingApplicantListResponse(MeetingApplyWithUserResponse.fromAll(applicants));
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
package org.sopt.makers.api.controller.crew.meeting.dto;

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.IntStream;
import org.sopt.makers.domain.crew.meeting.MeetingApply;
import org.sopt.makers.domain.crew.meeting.service.MeetingService;

public record MeetingApplyWithUserResponse(
Long id,
Integer applyNumber,
int applyNumber,
Integer type,
Long meetingId,
Long userId,
String content,
LocalDateTime appliedDate,
Integer status,
MeetingUserResponse user) {
MeetingUserProfileResponse user) {

public static MeetingApplyWithUserResponse from(MeetingService.ApplyDetail detail) {
/** 서비스가 정렬·필터링한 응답 목록 순서대로 1부터 번호를 부여한다. */
public static List<MeetingApplyWithUserResponse> fromAll(
List<MeetingService.ApplyDetail> details) {
return IntStream.range(0, details.size())
.mapToObj(index -> from(details.get(index), index + 1))
.toList();
}

private static MeetingApplyWithUserResponse from(
MeetingService.ApplyDetail detail, int applyNumber) {
MeetingApply apply = detail.apply();
return new MeetingApplyWithUserResponse(
apply.id(),
null,
applyNumber,
apply.type().getValue(),
apply.meetingId(),
apply.userId(),
apply.content(),
apply.appliedDate(),
apply.status().getValue(),
MeetingUserResponse.from(detail.user()));
MeetingUserProfileResponse.from(detail.user()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.sopt.makers.api.controller.crew.meeting.dto;

import org.sopt.makers.domain.crew.meeting.MeetingUser;

public record MeetingCoLeaderResponse(
Long userId, Long orgId, String userName, String userprofileImage) {

public static MeetingCoLeaderResponse from(MeetingUser user) {
return new MeetingCoLeaderResponse(user.id(), user.id(), user.name(), user.profileImage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public record MeetingDetailResponse(
LocalDateTime startDate,
LocalDateTime endDate,
Integer capacity,
int status,
LocalDateTime createdTimestamp,
String desc,
String processDesc,
LocalDateTime mStartDate,
Expand All @@ -32,14 +34,14 @@ public record MeetingDetailResponse(
Integer createdGeneration,
Integer targetActiveGeneration,
List<MeetingJoinablePart> joinableParts,
MeetingUserResponse meetingCreator,
List<MeetingUserResponse> coMeetingLeaders,
Boolean isHost,
MeetingUserProfileResponse user,
List<MeetingCoLeaderResponse> coMeetingLeaders,
Boolean host,
Boolean apply,
Boolean approved,
Boolean isCoLeader,
long approvedApplyCount,
List<MeetingApplyWithUserResponse> applies,
List<MeetingApplyWithUserResponse> appliedInfo,
List<String> welcomeMessageTypes,
List<String> meetingKeywordTypes) {

Expand All @@ -48,33 +50,35 @@ public static MeetingDetailResponse from(MeetingFacade.MeetingDetailResult resul
Meeting meeting = detail.meeting();
return baseFrom(
meeting,
MeetingUserResponse.from(detail.leader()),
detail.coLeaders().stream().map(MeetingUserResponse::from).toList(),
detail.status().getValue(),
MeetingUserProfileResponse.from(detail.leader()),
detail.coLeaders().stream().map(MeetingCoLeaderResponse::from).toList(),
detail.isHost(),
detail.isApply(),
detail.isApproved(),
detail.isCoLeader(),
detail.approvedApplyCount(),
detail.applies().stream().map(MeetingApplyWithUserResponse::from).toList(),
MeetingApplyWithUserResponse.fromAll(detail.applies()),
MeetingTagMapper.fromWelcomeMessageTypes(result.meetingTagInfo().welcomeMessageTypes()),
MeetingTagMapper.fromMeetingKeywordTypes(result.meetingTagInfo().meetingKeywordTypes()));
}

private static MeetingDetailResponse baseFrom(
Meeting meeting,
MeetingUserResponse meetingCreator,
List<MeetingUserResponse> coMeetingLeaders,
Boolean isHost,
int status,
MeetingUserProfileResponse user,
List<MeetingCoLeaderResponse> coMeetingLeaders,
Boolean host,
Boolean apply,
Boolean approved,
Boolean isCoLeader,
long approvedApplyCount,
List<MeetingApplyWithUserResponse> applies,
List<MeetingApplyWithUserResponse> appliedInfo,
List<String> welcomeMessageTypes,
List<String> meetingKeywordTypes) {
return new MeetingDetailResponse(
meeting.id(),
meetingCreator.userId(),
user.id(),
meeting.meetingDemandId(),
meeting.title(),
meeting.subTitle(),
Expand All @@ -83,6 +87,8 @@ private static MeetingDetailResponse baseFrom(
meeting.startDate(),
meeting.endDate(),
meeting.capacity(),
status,
meeting.createdAt(),
meeting.description(),
meeting.processDescription(),
meeting.activityStartDate(),
Expand All @@ -95,14 +101,14 @@ private static MeetingDetailResponse baseFrom(
meeting.createdGeneration(),
meeting.targetActiveGeneration(),
meeting.joinableParts(),
meetingCreator,
user,
coMeetingLeaders,
isHost,
host,
apply,
approved,
isCoLeader,
approvedApplyCount,
applies,
appliedInfo,
welcomeMessageTypes,
meetingKeywordTypes);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.sopt.makers.api.controller.crew.meeting.dto;

import org.sopt.makers.core.pagination.PageResult;

public record MeetingPageMetaResponse(
int page,
int take,
long itemCount,
int pageCount,
boolean hasPreviousPage,
boolean hasNextPage) {

public static MeetingPageMetaResponse from(PageResult<?> page) {
return new MeetingPageMetaResponse(
page.page(),
page.limit(),
page.totalElements(),
page.totalPages(),
page.hasPrevious(),
page.hasNext());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public static MeetingPartMembersResponse from(MeetingService.MeetingPartMembers
members.participantCount(),
members.isActiveGeneration(),
members.activeGeneration(),
members.appliedInfo().stream().map(MeetingApplyWithUserResponse::from).toList());
MeetingApplyWithUserResponse.fromAll(members.appliedInfo()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@
import org.sopt.makers.domain.crew.meeting.facade.MeetingFacade;

public record MeetingSummaryPageResponse(
List<MeetingSummaryResponse> data,
long totalCount,
int totalPage,
int limit,
int pageNo,
boolean hasNextPage,
boolean hasPrevPage) {
List<MeetingSummaryResponse> meetings, MeetingPageMetaResponse meta) {

public static MeetingSummaryPageResponse from(
PageResult<MeetingFacade.MeetingSummaryResult> page) {
return new MeetingSummaryPageResponse(
page.content().stream().map(MeetingSummaryResponse::from).toList(),
page.totalElements(),
page.totalPages(),
page.limit(),
page.page(),
page.hasNext(),
page.hasPrevious());
MeetingPageMetaResponse.from(page));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.sopt.makers.api.controller.crew.meeting.dto;

import java.util.List;
import org.sopt.makers.domain.crew.meeting.MeetingUser;
import org.sopt.makers.domain.user.Activity;

/** 기존 CREW 모임장 및 신청자 사용자 응답 계약. */
public record MeetingUserProfileResponse(
Long id,
String name,
Long orgId,
String profileImage,
List<ActivityResponse> activities,
String phone) {

public static MeetingUserProfileResponse from(MeetingUser user) {
if (user == null) {
return null;
}
return new MeetingUserProfileResponse(
user.id(),
user.name(),
user.id(),
user.profileImage(),
user.activities().stream().map(ActivityResponse::from).toList(),
user.phone());
}

public record ActivityResponse(String part, int generation) {

private static ActivityResponse from(Activity activity) {
return new ActivityResponse(
activity.part() == null ? null : activity.part().getName(), activity.generation());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MeetingControllerTest {
.param("pageNo", "1")
.param("limit", "20"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.totalCount").value(0));
.andExpect(jsonPath("$.data.meta.itemCount").value(0));

ArgumentCaptor<MeetingService.SearchMeetingsCommand> commandCaptor =
ArgumentCaptor.forClass(MeetingService.SearchMeetingsCommand.class);
Expand Down Expand Up @@ -85,7 +85,7 @@ class MeetingControllerTest {
mockMvc
.perform(get("/meeting/v2/me/joined"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.data").isArray());
.andExpect(jsonPath("$.data.meetings").isArray());

verify(meetingFacade).findJoinedMeetings(USER_ID, 1, 10);
}
Expand Down
Loading
Loading