Skip to content

Commit

Permalink
Merge pull request #49 from cau-likelion-org/chore/SL-18/dto
Browse files Browse the repository at this point in the history
[SL-18 CHORE] application response dto 수정
  • Loading branch information
unanchoi authored Dec 31, 2023
2 parents c8b6cbe + 08d00d3 commit 509defe
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 20 deletions.
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()
);
}
}

0 comments on commit 509defe

Please sign in to comment.