-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/DDING-91
- Loading branch information
Showing
15 changed files
with
289 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...main/java/ddingdong/ddingdongBE/domain/form/controller/dto/request/UpdateFormRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package ddingdong.ddingdongBE.domain.form.controller.dto.request; | ||
|
||
import ddingdong.ddingdongBE.domain.form.entity.FieldType; | ||
import ddingdong.ddingdongBE.domain.form.service.dto.command.UpdateFormCommand; | ||
import ddingdong.ddingdongBE.domain.form.service.dto.command.UpdateFormCommand.UpdateFormFieldCommand; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public record UpdateFormRequest( | ||
@Schema(description = "폼지 제목", example = "폼지제목입니다") | ||
@NotNull(message = "폼지 제목은 null이 될 수 없습니다.") | ||
String title, | ||
|
||
@Schema(description = "폼지 설명", example = "우리 동아리는 띵동입니다.") | ||
String description, | ||
|
||
@Schema(description = "폼지 시작일자", example = "2001-01-01") | ||
@NotNull(message = "폼지 시작일자는 null이 될 수 없습니다.") | ||
LocalDate startDate, | ||
|
||
@Schema(description = "폼지 종료일자", example = "2001-01-02") | ||
@NotNull(message = "폼지 종료일자는 null이 될 수 없습니다.") | ||
LocalDate endDate, | ||
|
||
@Schema(description = "면접여부", example = "true") | ||
@NotNull(message = "면접여부는 null이 될 수 없습니다.") | ||
boolean hasInterview, | ||
|
||
@ArraySchema(schema = @Schema(implementation = UpdateFormFieldRequest.class)) | ||
List<UpdateFormFieldRequest> formFields | ||
) { | ||
|
||
record UpdateFormFieldRequest( | ||
@Schema(description = "폼지 질문", example = "우리 동아리 들어올겁니까?") | ||
@NotNull(message = "질문는 null이 될 수 없습니다.") | ||
String question, | ||
|
||
@Schema(description = "질문 종류", example = "CHECK_BOX") | ||
@NotNull(message = "질문 종류는 null이 될 수 없습니다.") | ||
FieldType type, | ||
|
||
@Schema(description = "질문의 선택리스트", example = "[지문1이다., 지문2이다., 지문3이다.]") | ||
List<String> options, | ||
|
||
@Schema(description = "필수여부", example = "true") | ||
@NotNull(message = "필수여부는 null이 될 수 없습니다.") | ||
boolean required, | ||
|
||
@Schema(description = "질문 순서", example = "1") | ||
@NotNull(message = "질문 순서는 null이 될 수 없습니다.") | ||
int order, | ||
|
||
@Schema(description = "질문 섹션 종류", example = "공통") | ||
@NotNull(message = "질문 섹션종류는 null이 될 수 없습니다.") | ||
String section | ||
) { | ||
|
||
public UpdateFormFieldCommand toCommand() { | ||
return UpdateFormFieldCommand.builder() | ||
.question(question) | ||
.type(type) | ||
.options(options) | ||
.required(required) | ||
.order(order) | ||
.section(section) | ||
.build(); | ||
} | ||
} | ||
|
||
public UpdateFormCommand toCommand(Long formId) { | ||
List<UpdateFormFieldCommand> updateFormFieldCommands = formFields.stream() | ||
.map(UpdateFormFieldRequest::toCommand) | ||
.toList(); | ||
return UpdateFormCommand.builder() | ||
.formId(formId) | ||
.title(title) | ||
.description(description) | ||
.startDate(startDate) | ||
.endDate(endDate) | ||
.hasInterview(hasInterview) | ||
.formFieldCommands(updateFormFieldCommands) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/java/ddingdong/ddingdongBE/domain/form/repository/FormFieldRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package ddingdong.ddingdongBE.domain.form.repository; | ||
|
||
import ddingdong.ddingdongBE.domain.form.entity.Form; | ||
import ddingdong.ddingdongBE.domain.form.entity.FormField; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface FormFieldRepository extends JpaRepository<FormField, Long> { | ||
|
||
List<FormField> findAllByForm(Form form); | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeCentralFormService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package ddingdong.ddingdongBE.domain.form.service; | ||
|
||
import ddingdong.ddingdongBE.domain.form.service.dto.command.CreateFormCommand; | ||
import ddingdong.ddingdongBE.domain.form.service.dto.command.UpdateFormCommand; | ||
|
||
public interface FacadeCentralFormService { | ||
|
||
void createForm(CreateFormCommand command); | ||
|
||
void updateForm(UpdateFormCommand command); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ public interface FormService { | |
|
||
Form create(Form form); | ||
|
||
Form getById(Long id); | ||
Form getById(Long formId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/ddingdong/ddingdongBE/domain/form/service/dto/command/UpdateFormCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package ddingdong.ddingdongBE.domain.form.service.dto.command; | ||
|
||
import ddingdong.ddingdongBE.domain.form.entity.FieldType; | ||
import ddingdong.ddingdongBE.domain.form.entity.Form; | ||
import ddingdong.ddingdongBE.domain.form.entity.FormField; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record UpdateFormCommand( | ||
Long formId, | ||
String title, | ||
String description, | ||
LocalDate startDate, | ||
LocalDate endDate, | ||
boolean hasInterview, | ||
List<UpdateFormFieldCommand> formFieldCommands | ||
) { | ||
|
||
@Builder | ||
public record UpdateFormFieldCommand( | ||
String question, | ||
FieldType type, | ||
List<String> options, | ||
boolean required, | ||
int order, | ||
String section | ||
) { | ||
|
||
public FormField toEntity(Form form) { | ||
return FormField.builder() | ||
.form(form) | ||
.question(question) | ||
.fieldType(type) | ||
.options(options) | ||
.required(required) | ||
.fieldOrder(order) | ||
.section(section) | ||
.build(); | ||
} | ||
} | ||
|
||
public Form toEntity() { | ||
return Form.builder() | ||
.title(title) | ||
.description(description) | ||
.startDate(startDate) | ||
.endDate(endDate) | ||
.hasInterview(hasInterview) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.