Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SL-18 CHORE] application response dto 수정 #49

Merged
merged 1 commit into from
Dec 31, 2023
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 @@ -76,7 +76,7 @@ public WebMvcConfigurer corsConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000", "https://startlion.kro.kr")
.allowedOrigins("https://recruit-caulikelion.org", "http://localhost:3000", "https://startlion.kro.kr")
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ public CommonAnswerGetResponse(Answer answer) {
this.commonAnswer4 = answer.getCommonAnswer4();
this.commonAnswer5 = answer.getCommonAnswer5();
}

public static CommonAnswerGetResponse of(Answer answer) {
return new CommonAnswerGetResponse(answer);
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,56 @@
package com.startlion.startlionserver.dto.response.application;

import com.startlion.startlionserver.domain.entity.Application;
import com.startlion.startlionserver.domain.entity.Part;
import com.startlion.startlionserver.dto.response.part.PartIdResponse;
import com.startlion.startlionserver.dto.response.pathToKnow.PathToKnowGetResponse;
import lombok.AllArgsConstructor;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
@AllArgsConstructor
@Builder
@Schema(description = "지원서 1페이지 조회 응답")
public class ApplicationPage1GetResponse {
private Boolean isAgreed;

@Schema(description = "개인정보 수집 및 이용 동의 여부")
private boolean isAgreed;
@Schema(description = "이름")
private String name;

@Schema(description = "성별")
private String gender;

private Integer studentNum;

@Schema(description = "학번")
private int studentNum;
@Schema(description = "전공")
private String major;

@Schema(description = "복수전공")
private String multiMajor;

@Schema(description = "학기")
private String semester;

@Schema(description = "전화번호")
private String phone;

@Schema(description = "이메일")
private String email;

@Schema(description = "지원경로")
private List<PathToKnowGetResponse> pathToKnows;

@Schema(description = "지원파트")
private PartIdResponse part;

@Builder
public ApplicationPage1GetResponse(Boolean isAgreed, String name, String gender, Integer studentNum, String major, String multiMajor, String semester, String phone, String email, List<PathToKnowGetResponse> pathToKnows, PartIdResponse part) {
this.isAgreed = isAgreed;
this.name = name;
this.gender = gender;
this.studentNum = studentNum;
this.major = major;
this.multiMajor = multiMajor;
this.semester = semester;
this.phone = phone;
this.email = email;
this.pathToKnows = pathToKnows;
this.part = part;
}

public static ApplicationPage1GetResponse of(Application application) {
// 리스트 형태로 PathToKnow 생성
List<PathToKnowGetResponse> pathToKnowResponses = application.getPathToKnows().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@
import com.startlion.startlionserver.domain.entity.Answer;
import com.startlion.startlionserver.domain.entity.CommonQuestion;
import com.startlion.startlionserver.dto.response.answer.CommonAnswerGetResponse;
import lombok.AllArgsConstructor;
import com.startlion.startlionserver.dto.response.question.CommonQuestionResponse;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;


@Data
@AllArgsConstructor
public class ApplicationPage2GetResponse {
@Schema(description = "답변")
private CommonAnswerGetResponse answer;
private CommonQuestion generation;
@Schema(description = "질문")
private CommonQuestionResponse generation;

public ApplicationPage2GetResponse(CommonAnswerGetResponse answer, CommonQuestionResponse generation) {
this.answer = answer;
this.generation = generation;
}

public static ApplicationPage2GetResponse of(Answer answer, CommonQuestion generation) {
return new ApplicationPage2GetResponse(new CommonAnswerGetResponse(answer), generation);
return new ApplicationPage2GetResponse(CommonAnswerGetResponse.of(answer), CommonQuestionResponse.of(generation));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.startlion.startlionserver.dto.response.question;

import com.startlion.startlionserver.domain.entity.CommonQuestion;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class CommonQuestionResponse {
private Long commonQuestionId;
private Long generation;
private String commonQuestion1;
private String commonQuestion2;
private String commonQuestion3;
private String commonQuestion4;
private String commonQuestion5;

public static CommonQuestionResponse of(CommonQuestion commonQuestion) {
return new CommonQuestionResponse(
commonQuestion.getCommonQuestionId(),
commonQuestion.getGeneration(),
commonQuestion.getCommonQuestion1(),
commonQuestion.getCommonQuestion2(),
commonQuestion.getCommonQuestion3(),
commonQuestion.getCommonQuestion4(),
commonQuestion.getCommonQuestion5()
);
}
}