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 @@ -152,7 +152,7 @@ ResponseEntity<ApiResponse<PersonalRetrospectiveResponse>> writePersonalRetrospe
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PersonalRetrospectiveFormResponse.class),
examples = @ExampleObject(value = """
{"code": "SUCCESS", "message": "개인 회고 입력 폼 조회를 성공했습니다.", "data": {"meetingId": 1, "preOpinions": [{"topicId": 1, "topicName": "깨끗한 코드", "content": "사전 의견 내용을 작성합니다."}], "topics": [{"topicId": 1, "topicName": "깨끗한 코드", "confirmOrder": 1}], "meetingMembers": [{"meetingMemberId": 10, "nickname": "독서왕", "profileImage": "https://example.com/profile.jpg"}]}}
{"code": "SUCCESS", "message": "개인 회고 입력 폼 조회를 성공했습니다.", "data": {"meetingId": 1, "meetingHeaderInfo": {"gatheringName": "독서 모임", "bookTitle": "클린 코드", "bookAuthor": "로버트 마틴"}, "preOpinions": [{"topicId": 1, "topicName": "깨끗한 코드", "content": "사전 의견 내용을 작성합니다."}], "topics": [{"topicId": 1, "topicName": "깨끗한 코드", "confirmOrder": 1}], "meetingMembers": [{"meetingMemberId": 10, "nickname": "독서왕", "profileImage": "https://example.com/profile.jpg"}]}}
""")
)
),
Expand Down Expand Up @@ -246,7 +246,7 @@ ResponseEntity<ApiResponse<PersonalRetrospectiveFormResponse>> getPersonalRetros
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PersonalRetrospectiveEditResponse.class),
examples = @ExampleObject(value = """
{"code": "SUCCESS", "message": "개인 회고 수정 폼 조회를 성공했습니다.", "data": {"retrospectiveId": 1, "retrospective": {"changedThoughts": [{"topicId": 1, "keyIssue": "요약된 핵심 쟁점", "preOpinion": "토론 전 나의 생각", "postOpinion": "토론 후 바뀐 생각"}], "othersPerspectives": [{"topicId": 1, "meetingMemberId": 10, "opinionContent": "상대 의견이 인상적이었습니다.", "impressiveReason": "새로운 관점을 제공했기 때문입니다."}], "freeTexts": [{"title": "오늘의 한 줄", "content": "회고 내용을 작성합니다."}]}, "topics": [{"topicId": 1, "topicName": "깨끗한 코드", "confirmOrder": 1}], "meetingMembers": [{"meetingMemberId": 10, "nickname": "독서왕", "profileImage": "https://example.com/profile.jpg"}]}}
{"code": "SUCCESS", "message": "개인 회고 수정 폼 조회를 성공했습니다.", "data": {"retrospectiveId": 1, "meetingHeaderInfo": {"gatheringName": "독서 모임", "bookTitle": "클린 코드", "bookAuthor": "로버트 마틴"}, "retrospective": {"changedThoughts": [{"topicId": 1, "keyIssue": "요약된 핵심 쟁점", "preOpinion": "토론 전 나의 생각", "postOpinion": "토론 후 바뀐 생각"}], "othersPerspectives": [{"topicId": 1, "meetingMemberId": 10, "opinionContent": "상대 의견이 인상적이었습니다.", "impressiveReason": "새로운 관점을 제공했기 때문입니다."}], "freeTexts": [{"title": "오늘의 한 줄", "content": "회고 내용을 작성합니다."}]}, "topics": [{"topicId": 1, "topicName": "깨끗한 코드", "confirmOrder": 1}], "meetingMembers": [{"meetingMemberId": 10, "nickname": "독서왕", "profileImage": "https://example.com/profile.jpg"}]}}
""")
)
),
Expand Down Expand Up @@ -337,7 +337,7 @@ ResponseEntity<ApiResponse<PersonalRetrospectiveEditResponse>> getPersonalRetros
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PersonalRetrospectiveDetailResponse.class),
examples = @ExampleObject(value = """
{"code": "SUCCESS", "message": "개인 회고 조회를 성공했습니다.", "data": {"retrospectiveId": 1, "retrospective": {"changedThoughts": [{"topicId": 1, "topicTitle": "깨끗한 코드", "keyIssue": "요약된 핵심 쟁점", "preOpinion": "토론 전 나의 생각", "postOpinion": "토론 후 바뀐 생각"}], "othersPerspectives": [{"topicId": 1, "meetingMemberId": 10, "profileImage": "https://example.com/profile.jpg", "nickname": "독서왕", "opinionContent": "상대 의견이 인상적이었습니다.", "impressiveReason": "새로운 관점을 제공했기 때문입니다."}], "freeTexts": [{"title": "오늘의 한 줄", "content": "회고 내용을 작성합니다."}]}}}
{"code": "SUCCESS", "message": "개인 회고 조회를 성공했습니다.", "data": {"retrospectiveId": 1, "meetingHeaderInfo": {"gatheringName": "독서 모임", "bookTitle": "클린 코드", "bookAuthor": "로버트 마틴"}, "retrospective": {"changedThoughts": [{"topicId": 1, "topicTitle": "깨끗한 코드", "keyIssue": "요약된 핵심 쟁점", "preOpinion": "토론 전 나의 생각", "postOpinion": "토론 후 바뀐 생각"}], "othersPerspectives": [{"topicId": 1, "meetingMemberId": 10, "profileImage": "https://example.com/profile.jpg", "nickname": "독서왕", "opinionContent": "상대 의견이 인상적이었습니다.", "impressiveReason": "새로운 관점을 제공했기 때문입니다."}], "freeTexts": [{"title": "오늘의 한 줄", "content": "회고 내용을 작성합니다."}]}}}
""")
)
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.dokdok.retrospective.dto.response;

import com.dokdok.meeting.entity.Meeting;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "약속 헤더 정보")
public record MeetingHeaderInfo(
@Schema(description = "모임 이름", example = "독서 모임")
String gatheringName,
@Schema(description = "책 제목", example = "클린 코드")
String bookTitle,
@Schema(description = "저자", example = "로버트 마틴")
String bookAuthor
) {
public static MeetingHeaderInfo from(Meeting meeting) {
return new MeetingHeaderInfo(
meeting.getGathering().getGatheringName(),
meeting.getBook().getBookName(),
meeting.getBook().getAuthor()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public record PersonalRetrospectiveDetailResponse(
@Schema(description = "개인 회고 ID", example = "1")
Long retrospectiveId,
@Schema(description = "약속 헤더 정보")
MeetingHeaderInfo meetingHeaderInfo,
@Schema(description = "개인 회고 데이터")
RetrospectiveData retrospective
) {
Expand Down Expand Up @@ -101,12 +103,14 @@ public static FreeText from(RetrospectiveFreeText freeText) {

public static PersonalRetrospectiveDetailResponse from(
Long retrospectiveId,
MeetingHeaderInfo meetingHeaderInfo,
List<ChangedThought> changedThoughts,
List<OthersPerspective> othersPerspectives,
List<FreeText> freeTexts
) {
return new PersonalRetrospectiveDetailResponse(
retrospectiveId,
meetingHeaderInfo,
new RetrospectiveData(changedThoughts, othersPerspectives, freeTexts)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
public record PersonalRetrospectiveEditResponse(
@Schema(description = "개인 회고 ID", example = "1")
Long retrospectiveId,
@Schema(description = "약속 헤더 정보")
MeetingHeaderInfo meetingHeaderInfo,
@Schema(description = "개인 회고 데이터")
RetrospectiveData retrospective, // 작성 데이터 묶음
@Schema(description = "확정된 주제 목록")
Expand Down Expand Up @@ -92,6 +94,7 @@ public static FreeText from(RetrospectiveFreeText freeText) {

public static PersonalRetrospectiveEditResponse from(
Long retrospectiveId,
MeetingHeaderInfo meetingHeaderInfo,
List<ChangedThought> changedThoughts,
List<OthersPerspective> othersPerspectives,
List<FreeText> freeTexts,
Expand All @@ -100,6 +103,7 @@ public static PersonalRetrospectiveEditResponse from(
) {
return new PersonalRetrospectiveEditResponse(
retrospectiveId,
meetingHeaderInfo,
new RetrospectiveData(changedThoughts, othersPerspectives, freeTexts), // 묶어서 전달
topics,
meetingMembers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
public record PersonalRetrospectiveFormResponse(
@Schema(description = "약속 ID", example = "1")
Long meetingId,
@Schema(description = "약속 헤더 정보")
MeetingHeaderInfo meetingHeaderInfo,
@Schema(description = "사전 의견 목록")
List<PreOpinions> preOpinions,
@Schema(description = "확정된 주제 목록")
Expand Down Expand Up @@ -38,12 +40,14 @@ public static PreOpinions from(Topic topic, TopicAnswer topicAnswer) {

public static PersonalRetrospectiveFormResponse of(
Long meetingId,
MeetingHeaderInfo meetingHeaderInfo,
List<PreOpinions> preOpinions,
List<TopicInfo> topics,
List<MemberInfo> meetingMembers
) {
return new PersonalRetrospectiveFormResponse(
meetingId,
meetingHeaderInfo,
preOpinions,
topics,
meetingMembers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dokdok.retrospective.service;

import com.dokdok.meeting.entity.Meeting;
import com.dokdok.meeting.entity.MeetingMember;
import com.dokdok.retrospective.dto.projection.ChangedThoughtProjection;
import com.dokdok.retrospective.dto.projection.FreeTextProjection;
Expand Down Expand Up @@ -29,7 +30,7 @@ public class PersonalRetrospectiveAssembler {
private final StorageService storageService;

public PersonalRetrospectiveFormResponse assembleCreate(
Long meetingId,
Meeting meeting,
List<Topic> topics,
List<TopicAnswer> topicAnswers,
List<MeetingMember> meetingMembers
Expand Down Expand Up @@ -58,14 +59,16 @@ public PersonalRetrospectiveFormResponse assembleCreate(
List<MemberInfo> memberDtos = toMemberDtos(meetingMembers);

return PersonalRetrospectiveFormResponse.of(
meetingId,
meeting.getId(),
MeetingHeaderInfo.from(meeting),
preOpinions,
topicDtos,
memberDtos
);
}

public PersonalRetrospectiveEditResponse assembleEdit(
Meeting meeting,
Long retrospectiveId,
List<RetrospectiveChangedThought> changedThoughts,
List<RetrospectiveOthersPerspective> othersPerspectives,
Expand Down Expand Up @@ -93,6 +96,7 @@ public PersonalRetrospectiveEditResponse assembleEdit(

return PersonalRetrospectiveEditResponse.from(
retrospectiveId,
MeetingHeaderInfo.from(meeting),
changedThoughtList,
othersPerspectiveList,
freeTextList,
Expand All @@ -102,6 +106,7 @@ public PersonalRetrospectiveEditResponse assembleEdit(
}

public PersonalRetrospectiveDetailResponse assembleView(
Meeting meeting,
Long retrospectiveId,
List<RetrospectiveChangedThought> changedThoughts,
List<RetrospectiveOthersPerspective> othersPerspectives,
Expand Down Expand Up @@ -129,6 +134,7 @@ public PersonalRetrospectiveDetailResponse assembleView(

return PersonalRetrospectiveDetailResponse.from(
retrospectiveId,
MeetingHeaderInfo.from(meeting),
changedThoughtList,
othersPerspectiveList,
freeTextList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public PersonalRetrospectiveFormResponse getPersonalRetrospectiveForm(Long meeti

Long userId = SecurityUtil.getCurrentUserId();

meetingValidator.validateMeeting(meetingId);
Meeting meeting = meetingValidator.findMeetingOrThrow(meetingId);
meetingValidator.validateMeetingMember(meetingId, userId);
retrospectiveValidator.validateRetrospective(meetingId, userId);

Expand All @@ -92,7 +92,7 @@ public PersonalRetrospectiveFormResponse getPersonalRetrospectiveForm(Long meeti
List<MeetingMember> meetingMembers = meetingMemberRepository.findOtherMembersByMeetingId(meetingId, userId);

return assembler.assembleCreate(
meetingId,
meeting,
topics,
topicAnswers,
meetingMembers
Expand All @@ -110,6 +110,7 @@ public PersonalRetrospectiveEditResponse getPersonalRetrospectiveEditForm(Long m
PersonalMeetingRetrospective retrospective
= retrospectiveValidator.getRetrospectiveByMeetingAndUser(meetingId, userId);
Long retrospectiveId = retrospective.getId();
Meeting meeting = retrospective.getMeeting();

List<RetrospectiveChangedThought> changedThoughts
= changedThoughtRepository.findByPersonalMeetingRetrospective(retrospectiveId);
Expand All @@ -126,6 +127,7 @@ public PersonalRetrospectiveEditResponse getPersonalRetrospectiveEditForm(Long m
= meetingMemberRepository.findOtherMembersByMeetingId(meetingId, userId);

return assembler.assembleEdit(
meeting,
retrospectiveId,
changedThoughts,
othersPerspectives,
Expand Down Expand Up @@ -250,6 +252,7 @@ public PersonalRetrospectiveDetailResponse getPersonalRetrospective(Long meeting
PersonalMeetingRetrospective retrospective
= retrospectiveValidator.getRetrospectiveByMeetingAndUser(meetingId, userId);
Long retrospectiveId = retrospective.getId();
Meeting meeting = retrospective.getMeeting();

List<RetrospectiveChangedThought> changedThoughts
= changedThoughtRepository.findByPersonalMeetingRetrospective(retrospectiveId);
Expand All @@ -261,6 +264,7 @@ public PersonalRetrospectiveDetailResponse getPersonalRetrospective(Long meeting
freeTextRepository.findByPersonalMeetingRetrospective_Id(retrospectiveId);

return assembler.assembleView(
meeting,
retrospectiveId,
changedThoughts,
othersPerspectives,
Expand Down
Loading