Skip to content

Commit

Permalink
Merge pull request #125 from seniors-project/Feature/#59
Browse files Browse the repository at this point in the history
Resume 도메인 리팩토링
  • Loading branch information
strangehoon authored Nov 23, 2023
2 parents 1ebf9f6 + b58b357 commit 42ae681
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class CommentController {
@ApiResponse(responseCode = "200", description = "생성 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "댓글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PostMapping("")
Expand All @@ -58,11 +58,11 @@ public DataResponseDto<String> commentAdd(
@ApiResponse(responseCode = "200", description = "수정 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "댓글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PatchMapping("/{commentId}")
Expand All @@ -78,11 +78,11 @@ public DataResponseDto<String> commentModify(
@ApiResponse(responseCode = "200", description = "삭제 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "댓글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@DeleteMapping("/{commentId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public SseEmitter subscribeNotification(
content = @Content(mediaType = "application/json", schema =
@Schema(implementation = CustomPage.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "알림이 존재하지 않습니다",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@GetMapping("")
Expand All @@ -72,9 +72,9 @@ public DataResponseDto<CustomSlice<NotificationDto>> notificationList(
@ApiResponse(responseCode = "200", description = "단건 조회 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = PostDto.GetPostRes.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "알림이 존재하지 않습니다",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PatchMapping("/{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public class PostController {
@ApiResponse(responseCode = "200", description = "생성 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PostMapping(value = "", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE})
Expand All @@ -63,9 +63,9 @@ public DataResponseDto<String> postAdd(
@ApiResponse(responseCode = "200", description = "단건 조회 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetPostRes.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@GetMapping("/{postId}")
Expand All @@ -81,9 +81,9 @@ public DataResponseDto<GetPostRes> postDetails(
content = @Content(mediaType = "application/json", schema =
@Schema(implementation = CustomPage.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@GetMapping("")
Expand All @@ -102,11 +102,11 @@ public DataResponseDto<CustomPage<GetPostRes>> postList(
@ApiResponse(responseCode = "200", description = "단건 수정 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PatchMapping(value = "/{postId}", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE})
Expand All @@ -123,9 +123,9 @@ public DataResponseDto<String> postModify(
@ApiResponse(responseCode = "200", description = "단건 삭제 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@DeleteMapping("/{postId}")
Expand All @@ -143,11 +143,11 @@ public DataResponseDto<String> postRemove(
@ApiResponse(responseCode = "200", description = "좋아요 성공",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = DataResponseDto.class)))
@ApiResponse(responseCode = "400", description = "유효성 검증 실패",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "401", description = "유효하지 않은 회원입니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotAuthorizedException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "404", description = "게시글이 존재하지 않습니다.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = NotFoundException.class)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@ApiResponse(responseCode = "500", description = "서버 에러.",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))
@PostMapping("/like")
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/seniors/domain/resume/dto/ResumeDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public static class SaveResumeReq {
private String name;

@Valid
private List<CertificateDto.saveCertificateReq> certificateList = new ArrayList<>();
private List<CertificateDto.saveCertificateReq> certificates = new ArrayList<>();

@Valid
private List<CareerDto.saveCareerReq> careerList = new ArrayList<>();
private List<CareerDto.saveCareerReq> careers = new ArrayList<>();

@Valid
private List<EducationDto.saveEducationReq> educationList = new ArrayList<>();
private List<EducationDto.saveEducationReq> educations = new ArrayList<>();

}

Expand All @@ -70,13 +70,13 @@ public static class ModifyResumeReq {
private String name;

@Valid
private List<CertificateDto.modifyCertificateReq> certificateList = new ArrayList<>();
private List<CertificateDto.modifyCertificateReq> certificates = new ArrayList<>();

@Valid
private List<CareerDto.modifyCareerReq> careerList = new ArrayList<>();
private List<CareerDto.modifyCareerReq> careers = new ArrayList<>();

@Valid
private List<EducationDto.modifyEducationReq> educationList = new ArrayList<>();
private List<EducationDto.modifyEducationReq> educations = new ArrayList<>();

}

Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/seniors/domain/resume/service/ResumeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ public Long addResume(SaveResumeReq resumeReq, MultipartFile image, Long userId)
if (resumeRepository.findByUsersId(userId).isPresent()) {
throw new ConflictException("이미 해당 유저의 이력서가 존재합니다.");
}

resumeReq.getCareers().stream()


resumeReq.getCareerList().stream()
.filter(saveCareerReq -> saveCareerReq.getEndedAt()!=null && saveCareerReq.getIsAttendanced()==true)
.findAny()
.ifPresent(saveCareerReq -> {
throw new BadRequestException("퇴사연도를 입력하심면 재직중 여부를 체크하실 수 없습니다.");
});

resumeReq.getEducationList().stream()
resumeReq.getEducations().stream()
.filter(saveEducationReq -> saveEducationReq.getEndedAt()!=null && saveEducationReq.getIsProcessed()==true)
.findAny()
.ifPresent(saveEducationReq1 -> {
Expand All @@ -73,15 +73,15 @@ public Long addResume(SaveResumeReq resumeReq, MultipartFile image, Long userId)
resume.uploadPhotoUrl(null);
}

resumeReq.getCareerList().stream()
resumeReq.getCareers().stream()
.map(Career::from)
.forEach(resume::addCareer);

resumeReq.getCertificateList().stream()
resumeReq.getCertificates().stream()
.map(Certificate::from)
.forEach(resume::addCertificate);

resumeReq.getEducationList().stream()
resumeReq.getEducations().stream()
.map(Education::from)
.forEach(resume::addEducation);

Expand Down Expand Up @@ -141,14 +141,14 @@ public void modifyResume(Long resumeId, ResumeDto.ModifyResumeReq resumeReq, Mul
() ->new NotFoundException("이력서가 존재하지 않습니다.")
);

resumeReq.getCareerList().stream()
resumeReq.getCareers().stream()
.filter(modifyCareerReq -> modifyCareerReq.getEndedAt()!=null && modifyCareerReq.getIsAttendanced()==true)
.findAny()
.ifPresent(modifyCareerReq -> {
throw new BadRequestException("퇴사연도를 입력하심면 재직중 여부를 체크하실 수 없습니다.");
});

resumeReq.getEducationList().stream()
resumeReq.getEducations().stream()
.filter(modifyEducationReq -> modifyEducationReq.getEndedAt()!=null && modifyEducationReq.getIsProcessed()==true)
.findAny()
.ifPresent(modifyCareerReq -> {
Expand Down Expand Up @@ -176,15 +176,15 @@ public void modifyResume(Long resumeId, ResumeDto.ModifyResumeReq resumeReq, Mul
resume.getCertificates().clear();
resume.getEducations().clear();

resumeReq.getCareerList().stream()
resumeReq.getCareers().stream()
.map(Career::from)
.forEach(resume::addCareer);

resumeReq.getCertificateList().stream()
resumeReq.getCertificates().stream()
.map(Certificate::from)
.forEach(resume::addCertificate);

resumeReq.getEducationList().stream()
resumeReq.getEducations().stream()
.map(Education::from)
.forEach(resume::addEducation);
}
Expand Down
Loading

0 comments on commit 42ae681

Please sign in to comment.