Skip to content

Commit a21b31e

Browse files
committed
merge develop into dding-97
2 parents de574ee + 5084cc4 commit a21b31e

File tree

50 files changed

+1332
-1048
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1332
-1048
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package ddingdong.ddingdongBE.domain.form.api;
2+
3+
import ddingdong.ddingdongBE.domain.form.controller.dto.response.FormSectionResponse;
4+
import io.swagger.v3.oas.annotations.Operation;
5+
import io.swagger.v3.oas.annotations.media.Content;
6+
import io.swagger.v3.oas.annotations.media.Schema;
7+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
8+
import io.swagger.v3.oas.annotations.tags.Tag;
9+
import org.springframework.http.HttpStatus;
10+
import org.springframework.web.bind.annotation.GetMapping;
11+
import org.springframework.web.bind.annotation.PathVariable;
12+
import org.springframework.web.bind.annotation.RequestMapping;
13+
import org.springframework.web.bind.annotation.ResponseStatus;
14+
15+
@Tag(name = "Form - User", description = "User Form API")
16+
@RequestMapping("/server")
17+
public interface UserFormApi {
18+
19+
@Operation(summary = "폼지 섹션 조회 API")
20+
@ApiResponse(responseCode = "200", description = "폼지 섹션 조회 성공",
21+
content = @Content(schema = @Schema(implementation = FormSectionResponse.class)))
22+
@ResponseStatus(HttpStatus.OK)
23+
@GetMapping("/forms/{formId}/sections")
24+
FormSectionResponse getFormSections(
25+
@PathVariable("formId") Long formId
26+
);
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ddingdong.ddingdongBE.domain.form.controller;
2+
3+
import ddingdong.ddingdongBE.domain.form.api.UserFormApi;
4+
import ddingdong.ddingdongBE.domain.form.controller.dto.response.FormSectionResponse;
5+
import ddingdong.ddingdongBE.domain.form.service.FacadeUserFormService;
6+
import ddingdong.ddingdongBE.domain.form.service.dto.query.FormSectionQuery;
7+
import lombok.RequiredArgsConstructor;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
@RestController
11+
@RequiredArgsConstructor
12+
public class UserFormController implements UserFormApi {
13+
14+
private final FacadeUserFormService facadeUserFormService;
15+
16+
@Override
17+
public FormSectionResponse getFormSections(Long formId) {
18+
FormSectionQuery query = facadeUserFormService.getFormSection(formId);
19+
return FormSectionResponse.from(query);
20+
}
21+
}

src/main/java/ddingdong/ddingdongBE/domain/form/controller/dto/request/CreateFormRequest.java

+66-66
Original file line numberDiff line numberDiff line change
@@ -12,79 +12,79 @@
1212

1313

1414
public record CreateFormRequest(
15-
@Schema(description = "폼지 제목", example = "폼지제목입니다")
16-
@NotNull(message = "폼지 제목은 null이 될 수 없습니다.")
17-
String title,
15+
@Schema(description = "폼지 제목", example = "폼지제목입니다")
16+
@NotNull(message = "폼지 제목은 null이 될 수 없습니다.")
17+
String title,
1818

19-
@Schema(description = "폼지 설명", example = "우리 동아리는 띵동입니다.")
20-
String description,
19+
@Schema(description = "폼지 설명", example = "우리 동아리는 띵동입니다.")
20+
String description,
2121

22-
@Schema(description = "폼지 시작일자", example = "2001-01-01")
23-
@NotNull(message = "폼지 시작일자는 null이 될 수 없습니다.")
24-
LocalDate startDate,
22+
@Schema(description = "폼지 시작일자", example = "2001-01-01")
23+
@NotNull(message = "폼지 시작일자는 null이 될 수 없습니다.")
24+
LocalDate startDate,
2525

26-
@Schema(description = "폼지 종료일자", example = "2001-01-02")
27-
@NotNull(message = "폼지 종료일자는 null이 될 수 없습니다.")
28-
LocalDate endDate,
26+
@Schema(description = "폼지 종료일자", example = "2001-01-02")
27+
@NotNull(message = "폼지 종료일자는 null이 될 수 없습니다.")
28+
LocalDate endDate,
2929

30-
@Schema(description = "면접여부", example = "true")
31-
@NotNull(message = "면접여부는 null이 될 수 없습니다.")
32-
boolean hasInterview,
30+
@Schema(description = "면접여부", example = "true")
31+
@NotNull(message = "면접여부는 null이 될 수 없습니다.")
32+
boolean hasInterview,
3333

34-
@ArraySchema(schema = @Schema(implementation = CreateFormFieldRequest.class))
35-
List<CreateFormFieldRequest> formFields
34+
@ArraySchema(schema = @Schema(implementation = CreateFormFieldRequest.class))
35+
List<CreateFormFieldRequest> formFields
3636
) {
3737

38-
record CreateFormFieldRequest(
39-
@Schema(description = "폼지 질문", example = "우리 동아리 들어올겁니까?")
40-
@NotNull(message = "질문는 null이 될 수 없습니다.")
41-
String question,
42-
43-
@Schema(description = "질문 종류", example = "CHECK_BOX")
44-
@NotNull(message = "질문 종류는 null이 될 수 없습니다.")
45-
FieldType type,
46-
47-
@Schema(description = "질문의 선택리스트", example = "[지문1이다., 지문2이다., 지문3이다.]")
48-
List<String> options,
49-
50-
@Schema(description = "필수여부", example = "true")
51-
@NotNull(message = "필수여부는 null이 될 수 없습니다.")
52-
boolean required,
53-
54-
@Schema(description = "질문 순서", example = "1")
55-
@NotNull(message = "질문 순서는 null이 될 수 없습니다.")
56-
int order,
57-
58-
@Schema(description = "질문 섹션 종류", example = "공통")
59-
@NotNull(message = "질문 섹션종류는 null이 될 수 없습니다.")
60-
String section
61-
) {
62-
63-
public CreateFormFieldCommand toCommand() {
64-
return CreateFormFieldCommand.builder()
65-
.question(question)
66-
.type(type)
67-
.options(options)
68-
.required(required)
69-
.order(order)
70-
.section(section)
71-
.build();
72-
}
73-
}
74-
75-
public CreateFormCommand toCommand(User user) {
76-
List<CreateFormFieldCommand> createFormFieldCommands = formFields.stream()
77-
.map(CreateFormFieldRequest::toCommand)
78-
.toList();
79-
return CreateFormCommand.builder()
80-
.user(user)
81-
.title(title)
82-
.description(description)
83-
.startDate(startDate)
84-
.endDate(endDate)
85-
.hasInterview(hasInterview)
86-
.formFieldCommands(createFormFieldCommands)
87-
.build();
38+
record CreateFormFieldRequest(
39+
@Schema(description = "폼지 질문", example = "우리 동아리 들어올겁니까?")
40+
@NotNull(message = "질문는 null이 될 수 없습니다.")
41+
String question,
42+
43+
@Schema(description = "질문 종류", example = "CHECK_BOX")
44+
@NotNull(message = "질문 종류는 null이 될 수 없습니다.")
45+
FieldType type,
46+
47+
@Schema(description = "질문의 선택리스트", example = "[지문1이다., 지문2이다., 지문3이다.]")
48+
List<String> options,
49+
50+
@Schema(description = "필수여부", example = "true")
51+
@NotNull(message = "필수여부는 null이 될 수 없습니다.")
52+
boolean required,
53+
54+
@Schema(description = "질문 순서", example = "1")
55+
@NotNull(message = "질문 순서는 null이 될 수 없습니다.")
56+
int order,
57+
58+
@Schema(description = "질문 섹션 종류", example = "공통")
59+
@NotNull(message = "질문 섹션종류는 null이 될 수 없습니다.")
60+
String section
61+
) {
62+
63+
public CreateFormFieldCommand toCommand() {
64+
return CreateFormFieldCommand.builder()
65+
.question(question)
66+
.type(type)
67+
.options(options)
68+
.required(required)
69+
.order(order)
70+
.section(section)
71+
.build();
8872
}
73+
}
74+
75+
public CreateFormCommand toCommand(User user) {
76+
List<CreateFormFieldCommand> createFormFieldCommands = formFields.stream()
77+
.map(CreateFormFieldRequest::toCommand)
78+
.toList();
79+
return CreateFormCommand.builder()
80+
.user(user)
81+
.title(title)
82+
.description(description)
83+
.startDate(startDate)
84+
.endDate(endDate)
85+
.hasInterview(hasInterview)
86+
.formFieldCommands(createFormFieldCommands)
87+
.build();
88+
}
8989

9090
}

src/main/java/ddingdong/ddingdongBE/domain/form/controller/dto/request/UpdateFormRequest.java

+66-66
Original file line numberDiff line numberDiff line change
@@ -10,79 +10,79 @@
1010
import java.util.List;
1111

1212
public record UpdateFormRequest(
13-
@Schema(description = "폼지 제목", example = "폼지제목입니다")
14-
@NotNull(message = "폼지 제목은 null이 될 수 없습니다.")
15-
String title,
13+
@Schema(description = "폼지 제목", example = "폼지제목입니다")
14+
@NotNull(message = "폼지 제목은 null이 될 수 없습니다.")
15+
String title,
1616

17-
@Schema(description = "폼지 설명", example = "우리 동아리는 띵동입니다.")
18-
String description,
17+
@Schema(description = "폼지 설명", example = "우리 동아리는 띵동입니다.")
18+
String description,
1919

20-
@Schema(description = "폼지 시작일자", example = "2001-01-01")
21-
@NotNull(message = "폼지 시작일자는 null이 될 수 없습니다.")
22-
LocalDate startDate,
20+
@Schema(description = "폼지 시작일자", example = "2001-01-01")
21+
@NotNull(message = "폼지 시작일자는 null이 될 수 없습니다.")
22+
LocalDate startDate,
2323

24-
@Schema(description = "폼지 종료일자", example = "2001-01-02")
25-
@NotNull(message = "폼지 종료일자는 null이 될 수 없습니다.")
26-
LocalDate endDate,
24+
@Schema(description = "폼지 종료일자", example = "2001-01-02")
25+
@NotNull(message = "폼지 종료일자는 null이 될 수 없습니다.")
26+
LocalDate endDate,
2727

28-
@Schema(description = "면접여부", example = "true")
29-
@NotNull(message = "면접여부는 null이 될 수 없습니다.")
30-
boolean hasInterview,
28+
@Schema(description = "면접여부", example = "true")
29+
@NotNull(message = "면접여부는 null이 될 수 없습니다.")
30+
boolean hasInterview,
3131

32-
@ArraySchema(schema = @Schema(implementation = UpdateFormFieldRequest.class))
33-
List<UpdateFormFieldRequest> formFields
32+
@ArraySchema(schema = @Schema(implementation = UpdateFormFieldRequest.class))
33+
List<UpdateFormFieldRequest> formFields
3434
) {
3535

36-
record UpdateFormFieldRequest(
37-
@Schema(description = "폼지 질문", example = "우리 동아리 들어올겁니까?")
38-
@NotNull(message = "질문는 null이 될 수 없습니다.")
39-
String question,
40-
41-
@Schema(description = "질문 종류", example = "CHECK_BOX")
42-
@NotNull(message = "질문 종류는 null이 될 수 없습니다.")
43-
FieldType type,
44-
45-
@Schema(description = "질문의 선택리스트", example = "[지문1이다., 지문2이다., 지문3이다.]")
46-
List<String> options,
47-
48-
@Schema(description = "필수여부", example = "true")
49-
@NotNull(message = "필수여부는 null이 될 수 없습니다.")
50-
boolean required,
51-
52-
@Schema(description = "질문 순서", example = "1")
53-
@NotNull(message = "질문 순서는 null이 될 수 없습니다.")
54-
int order,
55-
56-
@Schema(description = "질문 섹션 종류", example = "공통")
57-
@NotNull(message = "질문 섹션종류는 null이 될 수 없습니다.")
58-
String section
59-
) {
60-
61-
public UpdateFormFieldCommand toCommand() {
62-
return UpdateFormFieldCommand.builder()
63-
.question(question)
64-
.type(type)
65-
.options(options)
66-
.required(required)
67-
.order(order)
68-
.section(section)
69-
.build();
70-
}
71-
}
72-
73-
public UpdateFormCommand toCommand(Long formId) {
74-
List<UpdateFormFieldCommand> updateFormFieldCommands = formFields.stream()
75-
.map(UpdateFormFieldRequest::toCommand)
76-
.toList();
77-
return UpdateFormCommand.builder()
78-
.formId(formId)
79-
.title(title)
80-
.description(description)
81-
.startDate(startDate)
82-
.endDate(endDate)
83-
.hasInterview(hasInterview)
84-
.formFieldCommands(updateFormFieldCommands)
85-
.build();
36+
record UpdateFormFieldRequest(
37+
@Schema(description = "폼지 질문", example = "우리 동아리 들어올겁니까?")
38+
@NotNull(message = "질문는 null이 될 수 없습니다.")
39+
String question,
40+
41+
@Schema(description = "질문 종류", example = "CHECK_BOX")
42+
@NotNull(message = "질문 종류는 null이 될 수 없습니다.")
43+
FieldType type,
44+
45+
@Schema(description = "질문의 선택리스트", example = "[지문1이다., 지문2이다., 지문3이다.]")
46+
List<String> options,
47+
48+
@Schema(description = "필수여부", example = "true")
49+
@NotNull(message = "필수여부는 null이 될 수 없습니다.")
50+
boolean required,
51+
52+
@Schema(description = "질문 순서", example = "1")
53+
@NotNull(message = "질문 순서는 null이 될 수 없습니다.")
54+
int order,
55+
56+
@Schema(description = "질문 섹션 종류", example = "공통")
57+
@NotNull(message = "질문 섹션종류는 null이 될 수 없습니다.")
58+
String section
59+
) {
60+
61+
public UpdateFormFieldCommand toCommand() {
62+
return UpdateFormFieldCommand.builder()
63+
.question(question)
64+
.type(type)
65+
.options(options)
66+
.required(required)
67+
.order(order)
68+
.section(section)
69+
.build();
8670
}
71+
}
72+
73+
public UpdateFormCommand toCommand(Long formId) {
74+
List<UpdateFormFieldCommand> updateFormFieldCommands = formFields.stream()
75+
.map(UpdateFormFieldRequest::toCommand)
76+
.toList();
77+
return UpdateFormCommand.builder()
78+
.formId(formId)
79+
.title(title)
80+
.description(description)
81+
.startDate(startDate)
82+
.endDate(endDate)
83+
.hasInterview(hasInterview)
84+
.formFieldCommands(updateFormFieldCommands)
85+
.build();
86+
}
8787

8888
}

src/main/java/ddingdong/ddingdongBE/domain/form/controller/dto/response/FormListResponse.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77

88
@Builder
99
public record FormListResponse(
10-
@Schema(description = "지원 폼지 ID", example = "1")
11-
Long formId,
12-
@Schema(description = "지원 폼지 제목", example = "폼지 제목입니다.")
13-
String title,
14-
@Schema(description = "지원 폼지 시작일", example = "2001-01-01")
15-
LocalDate startDate,
16-
@Schema(description = "지원 폼지 종료일", example = "2001-01-02")
17-
LocalDate endDate,
18-
@Schema(description = "활성화 여부", example = "true")
19-
boolean isActive
10+
@Schema(description = "지원 폼지 ID", example = "1")
11+
Long formId,
12+
@Schema(description = "지원 폼지 제목", example = "폼지 제목입니다.")
13+
String title,
14+
@Schema(description = "지원 폼지 시작일", example = "2001-01-01")
15+
LocalDate startDate,
16+
@Schema(description = "지원 폼지 종료일", example = "2001-01-02")
17+
LocalDate endDate,
18+
@Schema(description = "활성화 여부", example = "true")
19+
boolean isActive
2020
) {
2121

22-
public static FormListResponse from(FormListQuery query) {
23-
return FormListResponse.builder()
24-
.formId(query.formId())
25-
.title(query.title())
26-
.startDate(query.startDate())
27-
.endDate(query.endDate())
28-
.isActive(query.isActive())
29-
.build();
30-
}
22+
public static FormListResponse from(FormListQuery query) {
23+
return FormListResponse.builder()
24+
.formId(query.formId())
25+
.title(query.title())
26+
.startDate(query.startDate())
27+
.endDate(query.endDate())
28+
.isActive(query.isActive())
29+
.build();
30+
}
3131
}

0 commit comments

Comments
 (0)