diff --git a/src/main/java/page/clab/api/domain/activity/activitygroup/api/ActivityGroupMemberController.java b/src/main/java/page/clab/api/domain/activity/activitygroup/api/ActivityGroupMemberController.java index 141d2bbd0..965623b55 100644 --- a/src/main/java/page/clab/api/domain/activity/activitygroup/api/ActivityGroupMemberController.java +++ b/src/main/java/page/clab/api/domain/activity/activitygroup/api/ActivityGroupMemberController.java @@ -19,6 +19,7 @@ import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupStatus; import page.clab.api.domain.activity.activitygroup.dto.param.GroupScheduleDto; import page.clab.api.domain.activity.activitygroup.dto.request.ApplyFormRequestDto; +import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupDetailResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupStatusResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.GroupMemberResponseDto; @@ -57,10 +58,10 @@ public ApiResponse> getActivityGroups @Operation(summary = "[U] 활동 상세 조회", description = "ROLE_ANONYMOUS 이상의 권한이 필요함") @PreAuthorize("hasRole('USER')") @GetMapping("/{activityGroupId}") - public ApiResponse getActivityGroup( + public ApiResponse getActivityGroup( @PathVariable(name = "activityGroupId") Long activityGroupId ) { - Object activityGroup = activityGroupMemberService.getActivityGroup(activityGroupId); + ActivityGroupDetailResponseDto activityGroup = activityGroupMemberService.getActivityGroup(activityGroupId); return ApiResponse.success(activityGroup); } diff --git a/src/main/java/page/clab/api/domain/activity/activitygroup/application/ActivityGroupMemberService.java b/src/main/java/page/clab/api/domain/activity/activitygroup/application/ActivityGroupMemberService.java index af334f5ff..7eaff27e9 100644 --- a/src/main/java/page/clab/api/domain/activity/activitygroup/application/ActivityGroupMemberService.java +++ b/src/main/java/page/clab/api/domain/activity/activitygroup/application/ActivityGroupMemberService.java @@ -24,10 +24,9 @@ import page.clab.api.domain.activity.activitygroup.dto.param.GroupScheduleDto; import page.clab.api.domain.activity.activitygroup.dto.request.ApplyFormRequestDto; import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupBoardResponseDto; -import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupProjectResponseDto; +import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupDetailResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupStatusResponseDto; -import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupStudyResponseDto; import page.clab.api.domain.activity.activitygroup.dto.response.GroupMemberResponseDto; import page.clab.api.domain.activity.activitygroup.exception.AlreadyAppliedException; import page.clab.api.domain.activity.activitygroup.exception.InvalidCategoryException; @@ -60,7 +59,7 @@ public PagedResponseDto getActivityGroups(Pageable pag } @Transactional(readOnly = true) - public Object getActivityGroup(Long activityGroupId) { + public ActivityGroupDetailResponseDto getActivityGroup(Long activityGroupId) { ActivityGroupDetails details = activityGroupDetailsRepository.fetchActivityGroupDetails(activityGroupId); Member currentMember = externalRetrieveMemberUseCase.getCurrentMember(); @@ -71,7 +70,7 @@ public Object getActivityGroup(Long activityGroupId) { .map(groupMember -> GroupMemberResponseDto.toDto(externalRetrieveMemberUseCase.findByIdOrThrow(groupMember.getMemberId()), groupMember)) .toList(); - List activityGroupResponseDtos = + List activityGroupBoardResponseDtos = details.getActivityGroupBoards().stream() .map(board -> { MemberBasicInfoDto memberBasicInfoDto = externalRetrieveMemberUseCase.getCurrentMemberBasicInfo(); @@ -79,13 +78,7 @@ public Object getActivityGroup(Long activityGroupId) { }) .toList(); - if (details.getActivityGroup().isStudy()) { - return ActivityGroupStudyResponseDto.create(details.getActivityGroup(), details.getGroupMembers(), activityGroupResponseDtos, groupMemberResponseDtos, isOwner); - } else if (details.getActivityGroup().isProject()) { - return ActivityGroupProjectResponseDto.create(details.getActivityGroup(), details.getGroupMembers(), activityGroupResponseDtos, groupMemberResponseDtos, isOwner); - } else { - throw new InvalidCategoryException("해당 카테고리가 존재하지 않습니다."); - } + return ActivityGroupDetailResponseDto.create(details.getActivityGroup(), activityGroupBoardResponseDtos, groupMemberResponseDtos, isOwner); } @Transactional(readOnly = true) diff --git a/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupProjectResponseDto.java b/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupDetailResponseDto.java similarity index 85% rename from src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupProjectResponseDto.java rename to src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupDetailResponseDto.java index 6d9f72cf4..557c187e3 100644 --- a/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupProjectResponseDto.java +++ b/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupDetailResponseDto.java @@ -1,21 +1,19 @@ package page.clab.api.domain.activity.activitygroup.dto.response; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; import lombok.Builder; import lombok.Getter; import page.clab.api.domain.activity.activitygroup.domain.ActivityGroup; -import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupBoard; import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupCategory; import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupStatus; import page.clab.api.domain.activity.activitygroup.domain.GroupMember; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - @Getter @Builder -public class ActivityGroupProjectResponseDto { +public class ActivityGroupDetailResponseDto { private Long id; private ActivityGroupCategory category; @@ -23,7 +21,9 @@ public class ActivityGroupProjectResponseDto { private String name; private String content; private ActivityGroupStatus status; + private Long progress; private String imageUrl; + private String curriculum; private List groupMembers; private LocalDate startDate; private LocalDate endDate; @@ -35,16 +35,18 @@ public class ActivityGroupProjectResponseDto { private boolean isOwner; private LocalDateTime createdAt; - public static ActivityGroupProjectResponseDto create(ActivityGroup activityGroup, List groupMembers, + public static ActivityGroupDetailResponseDto create(ActivityGroup activityGroup, List boards, List groupMemberResponseDtos, boolean isOwner) { - return ActivityGroupProjectResponseDto.builder() + return ActivityGroupDetailResponseDto.builder() .id(activityGroup.getId()) .category(activityGroup.getCategory()) .subject(activityGroup.getSubject()) .name(activityGroup.getName()) .content(activityGroup.getContent()) .status(activityGroup.getStatus()) + .progress(activityGroup.getProgress()) .imageUrl(activityGroup.getImageUrl()) + .curriculum(activityGroup.getCurriculum()) .groupMembers(groupMemberResponseDtos) .startDate(activityGroup.getStartDate()) .endDate(activityGroup.getEndDate()) diff --git a/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupStudyResponseDto.java b/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupStudyResponseDto.java deleted file mode 100644 index 462d6200a..000000000 --- a/src/main/java/page/clab/api/domain/activity/activitygroup/dto/response/ActivityGroupStudyResponseDto.java +++ /dev/null @@ -1,51 +0,0 @@ -package page.clab.api.domain.activity.activitygroup.dto.response; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Getter; -import page.clab.api.domain.activity.activitygroup.domain.ActivityGroup; -import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupBoard; -import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupCategory; -import page.clab.api.domain.activity.activitygroup.domain.ActivityGroupStatus; -import page.clab.api.domain.activity.activitygroup.domain.GroupMember; - -import java.time.LocalDateTime; -import java.util.List; - -@Getter -@Builder -public class ActivityGroupStudyResponseDto { - - private Long id; - private ActivityGroupCategory category; - private String subject; - private String name; - private String content; - private ActivityGroupStatus status; - private String imageUrl; - private List groupMembers; - private String curriculum; - private List activityGroupBoards; - - @JsonProperty("isOwner") - private boolean isOwner; - private LocalDateTime createdAt; - - public static ActivityGroupStudyResponseDto create(ActivityGroup activityGroup, List groupMembers, - List boards, List groupMemberResponseDtos, boolean isOwner) { - return ActivityGroupStudyResponseDto.builder() - .id(activityGroup.getId()) - .category(activityGroup.getCategory()) - .subject(activityGroup.getSubject()) - .name(activityGroup.getName()) - .content(activityGroup.getContent()) - .status(activityGroup.getStatus()) - .imageUrl(activityGroup.getImageUrl()) - .groupMembers(groupMemberResponseDtos) - .curriculum(activityGroup.getCurriculum()) - .activityGroupBoards(boards) - .isOwner(isOwner) - .createdAt(activityGroup.getCreatedAt()) - .build(); - } -}