Skip to content

Commit

Permalink
chore: formTag 생성 방식 변경 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks authored Aug 27, 2024
1 parent f6eb1e8 commit b8be9f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ public record RetrospectCreateRequest(
@NotNull
LocalDateTime deadline,
@Schema(description = "질문을 수정한 경우 true", example = "true")
boolean isNewForm,
Boolean isNewForm,
@Schema(description = "질문을 수정한 경우, 변경된 폼 이름", example = "변경된 커스텀 폼 제목")
String formName,
@Schema(description = "질문을 수정한 경우, 변경된 폼 한줄 소개", example = "변경된 커스텀 폼 한줄 소개")
String formIntroduction,
@Schema(description = "질문을 수정한 경우, 현재 form id", example = "3")
Long curFormId
Long curFormId,
@Schema(description = "질문을 수정한 경우, 현재 form id", example = "true")
Boolean hasChangedOriginal
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ public Long createRetrospect(RetrospectCreateRequest request, Long spaceId, Long
}

// 내 회고 폼에 추가
Form form = new Form(memberId, spaceId, request.formName(), request.introduction(), FormType.CUSTOM,
FormTag.CUSTOM);
FormTag formTag = FormTag.CUSTOM;
if (!request.hasChangedOriginal()) {
Form prevForm = formRepository.findByIdOrThrow(request.curFormId());
formTag = prevForm.getFormTag();
}

Form form = new Form(memberId, spaceId, request.formName(), request.introduction(), FormType.CUSTOM, formTag);
Form savedForm = formRepository.save(form);

List<Question> myQuestions = getQuestions(request.questions(), null, savedForm.getId());
Expand Down

0 comments on commit b8be9f4

Please sign in to comment.