Skip to content

Commit

Permalink
chore: 실행 목표 조회 로직 변경, 리뷰 사항 반영 (#139)
Browse files Browse the repository at this point in the history
* chore: 실행 목표가 없는 회고 응답에서 제외

* chore: dto 이름 변경

* chore: 새로운 폼 저장 title ->formName으로 변경
  • Loading branch information
clean2001 authored Aug 12, 2024
1 parent 27f9efc commit fd27291
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface ActionItemApi {
}
)
ResponseEntity<Void> createActionItem(@MemberId Long memberId,
@Validated @RequestBody CreateActionItemRequest createActionItemRequest);
@Validated @RequestBody ActionItemCreateRequest actionItemCreateRequest);


@Operation(summary = "개인의 액션 아이템 조회", method = "GET", description = """
Expand All @@ -40,7 +40,7 @@ ResponseEntity<Void> createActionItem(@MemberId Long memberId,
)
}
)
ResponseEntity<MemberActionItemResponse> memberActionItem(@MemberId Long currentMemberId);
ResponseEntity<MemberActionItemGetResponse> memberActionItem(@MemberId Long currentMemberId);

@Operation(summary = "팀의 액션 아이템 조회", method = "GET", description = """
팀 아이디로 팀의 모든 액션아이템을 회고 별로 조회합니다.
Expand All @@ -57,7 +57,7 @@ ResponseEntity<Void> createActionItem(@MemberId Long memberId,
)
}
)
ResponseEntity<GetSpaceRetrospectActionItemResponse> teamActionItem(@MemberId Long memberId,
ResponseEntity<SpaceRetrospectActionItemGetResponse> teamActionItem(@MemberId Long memberId,
@PathVariable Long spaceId);


Expand All @@ -76,7 +76,7 @@ ResponseEntity<GetSpaceRetrospectActionItemResponse> teamActionItem(@MemberId Lo
)
}
)
ResponseEntity<GetSpaceActionItemResponse> spaceRecentActionItem(@MemberId Long memberId,
ResponseEntity<SpaceActionItemGetResponse> spaceRecentActionItem(@MemberId Long memberId,
@PathVariable Long spaceId);

@Operation(summary = "액션 아이템 삭제", method = "DELETE", description = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.layer.common.annotation.MemberId;
import org.layer.domain.actionItem.controller.dto.CreateActionItemRequest;
import org.layer.domain.actionItem.controller.dto.MemberActionItemResponse;
import org.layer.domain.actionItem.controller.dto.GetSpaceActionItemResponse;
import org.layer.domain.actionItem.controller.dto.GetSpaceRetrospectActionItemResponse;
import org.layer.domain.actionItem.controller.dto.ActionItemCreateRequest;
import org.layer.domain.actionItem.controller.dto.MemberActionItemGetResponse;
import org.layer.domain.actionItem.controller.dto.SpaceActionItemGetResponse;
import org.layer.domain.actionItem.controller.dto.SpaceRetrospectActionItemGetResponse;
import org.layer.domain.actionItem.service.ActionItemService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -24,35 +24,35 @@ public class ActionItemController implements ActionItemApi {
@PostMapping("/create")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<Void> createActionItem(@MemberId Long memberId,
@Validated @RequestBody CreateActionItemRequest createActionItemRequest) {
@Validated @RequestBody ActionItemCreateRequest actionItemCreateRequest) {
actionItemService.createActionItem(memberId,
createActionItemRequest.retrospectId(),
createActionItemRequest.content());
actionItemCreateRequest.retrospectId(),
actionItemCreateRequest.content());

return new ResponseEntity<>(null, HttpStatus.CREATED);
}

@Override
@GetMapping("/member")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<MemberActionItemResponse> memberActionItem(@MemberId Long currentMemberId) {
MemberActionItemResponse memberActionItems = actionItemService.getMemberActionItemList(currentMemberId);
public ResponseEntity<MemberActionItemGetResponse> memberActionItem(@MemberId Long currentMemberId) {
MemberActionItemGetResponse memberActionItems = actionItemService.getMemberActionItemList(currentMemberId);
return new ResponseEntity<>(memberActionItems, HttpStatus.OK);
}

@Override
@GetMapping("/space/{spaceId}")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<GetSpaceRetrospectActionItemResponse> teamActionItem(@MemberId Long memberId, @PathVariable(name = "spaceId") Long spaceId) {
GetSpaceRetrospectActionItemResponse teamActionItem = actionItemService.getSpaceActionItemList(memberId, spaceId);
public ResponseEntity<SpaceRetrospectActionItemGetResponse> teamActionItem(@MemberId Long memberId, @PathVariable(name = "spaceId") Long spaceId) {
SpaceRetrospectActionItemGetResponse teamActionItem = actionItemService.getSpaceActionItemList(memberId, spaceId);

return new ResponseEntity<>(teamActionItem, HttpStatus.OK);
}

@Override
@GetMapping("/space/{spaceId}/recent")
public ResponseEntity<GetSpaceActionItemResponse> spaceRecentActionItem(@MemberId Long memberId, @PathVariable(name = "spaceId") Long spaceId) {
GetSpaceActionItemResponse spaceRecentActionItems = actionItemService.getSpaceRecentActionItems(memberId, spaceId);
public ResponseEntity<SpaceActionItemGetResponse> spaceRecentActionItem(@MemberId Long memberId, @PathVariable(name = "spaceId") Long spaceId) {
SpaceActionItemGetResponse spaceRecentActionItems = actionItemService.getSpaceRecentActionItems(memberId, spaceId);

return new ResponseEntity<>(spaceRecentActionItems, HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jakarta.validation.constraints.NotNull;

@Schema(description = "액션 아이템 생성 요정")
public record CreateActionItemRequest(@NotNull
public record ActionItemCreateRequest(@NotNull
@Schema(description = "액션 아이템과 매핑되는 회고 ID")
Long retrospectId,
@NotNull
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.layer.domain.actionItem.controller.dto;

import jakarta.validation.constraints.NotNull;

import java.util.List;

public record MemberActionItemGetResponse(@NotNull List<MemberActionItemResponse> actionItems) {
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
package org.layer.domain.actionItem.controller.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import org.layer.domain.retrospect.entity.Retrospect;
import org.layer.domain.space.entity.Space;

import java.util.List;

@Builder
public record MemberActionItemResponse(List<MemberActionItemElementResponse> actionItemResponse) {
public record MemberActionItemResponse(@NotNull
@Schema(description = "회고 ID", example = "1")
Long retrospectId,
@NotNull
@Schema(description = "회고 제목", example = "중간 발표 이후 회고")
String retrospectTitle,
@NotNull
@Schema(description = "회고가 속한 스페이스 ID", example = "1")
Long spaceId,
@NotNull
@Schema(description = "회고가 속한 스페이스 이름", example = "떡잎방범대")
String spaceName,
@NotNull
@Schema(description = "액션 아이템 아이디와 내용 리스트")
List<ActionItemResponse> actionItemList) {
public static MemberActionItemResponse of(Space space, Retrospect retrospect, List<ActionItemResponse> actionItemList) {
return MemberActionItemResponse.builder()
.retrospectId(retrospect.getId())
.retrospectTitle(retrospect.getTitle())
.spaceId(space.getId())
.spaceName(space.getName())
.actionItemList(actionItemList)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.List;

@Builder
public record GetSpaceActionItemResponse(@NotNull
public record SpaceActionItemGetResponse(@NotNull
@Schema(description = "액션 아이템이 속한 스페이스 ID")
Long spaceId,
@NotNull
Expand All @@ -21,12 +21,12 @@ public record GetSpaceActionItemResponse(@NotNull
List<SpaceActionItemElementResponse> teamActionItemList
) {

public static GetSpaceActionItemResponse of(Space space, Retrospect retrospect, List<ActionItem> spaceActionItemList) {
public static SpaceActionItemGetResponse of(Space space, Retrospect retrospect, List<ActionItem> spaceActionItemList) {
List<SpaceActionItemElementResponse> actionItemElements = spaceActionItemList.stream()
.map(a -> SpaceActionItemElementResponse.of(a, retrospect))
.toList();

return GetSpaceActionItemResponse.builder()
return SpaceActionItemGetResponse.builder()
.spaceId(space.getId())
.spaceName(space.getName())
.teamActionItemList(actionItemElements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.List;

@Builder
public record GetSpaceRetrospectActionItemResponse(@NotNull
public record SpaceRetrospectActionItemGetResponse(@NotNull
@Schema(description = "액션 아이템이 속한 스페이스 ID")
Long spaceId,
@NotNull
Expand All @@ -19,8 +19,8 @@ public record GetSpaceRetrospectActionItemResponse(@NotNull
List<RetrospectActionItemResponse> teamActionItemList
) {

public static GetSpaceRetrospectActionItemResponse of(Space space, List<RetrospectActionItemResponse> actionItemList) {
return GetSpaceRetrospectActionItemResponse.builder()
public static SpaceRetrospectActionItemGetResponse of(Space space, List<RetrospectActionItemResponse> actionItemList) {
return SpaceRetrospectActionItemGetResponse.builder()
.spaceId(space.getId())
.spaceName(space.getName())
.teamActionItemList(actionItemList)
Expand Down
Loading

0 comments on commit fd27291

Please sign in to comment.