Skip to content

Commit

Permalink
Merge pull request #175 from CEOS-Developers/dev
Browse files Browse the repository at this point in the history
[fix] 서류 결과 확인 response 생성 로직 수정
  • Loading branch information
mushroom1324 authored Feb 29, 2024
2 parents 22935f6 + 52b0651 commit 0cb55cf
Show file tree
Hide file tree
Showing 36 changed files with 860 additions and 109 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Make application-secret.yml without env
- name: Recreate application-secret.yml
run: |
rm -f ./src/main/resources/application-secret.yml
touch ./src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_DEV }}" > ./src/main/resources/application-secret.yml
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ out/

### application ###
application-secret.yml

###
.env**
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ private GetResultResponse(

public static GetResultResponse toDocumentResult(
Application application, Recruitment recruitment) {
ParsedDuration duration = null;

if (application.getInterviewDatetime() != null) {
duration = ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime());
}

return GetResultResponse.builder()
.pass(application.getDocumentPass())
.generation(recruitment.getGeneration())
.name(application.getApplicantInfo().getName())
.parsedDuration(
ParsedDurationConvertor.parsingDuration(application.getInterviewDatetime()))
.parsedDuration(duration)
.otDate(recruitment.getOtDate())
.attendanceStatus(application.isInterviewCheck())
.openChatUrl(recruitment.getOpenChatUrl())
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,27 @@

import ceos.backend.domain.application.domain.Application;
import ceos.backend.domain.application.domain.ApplicationQuestion;
import ceos.backend.domain.application.domain.Pass;
import ceos.backend.domain.application.dto.request.CreateApplicationRequest;
import ceos.backend.domain.application.dto.request.UpdateAttendanceRequest;
import ceos.backend.domain.application.enums.SortPartType;
import ceos.backend.domain.application.enums.SortPassType;
import ceos.backend.domain.application.exception.exceptions.ApplicantNotFound;
import ceos.backend.domain.application.mapper.ApplicationMapper;
import ceos.backend.domain.application.repository.ApplicationQuestionRepository;
import ceos.backend.domain.application.repository.ApplicationRepository;
import ceos.backend.global.common.dto.AwsSESMail;
import ceos.backend.global.common.dto.SlackUnavailableReason;
import ceos.backend.global.common.entity.Part;
import ceos.backend.global.common.event.Event;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class ApplicationHelper {
private final ApplicationMapper applicationMapper;
private final ApplicationRepository applicationRepository;
private final ApplicationQuestionRepository applicationQuestionRepository;

public Page<Application> getApplications(
SortPassType docPass,
SortPassType finalPass,
SortPartType sortType,
PageRequest pageRequest) {
Page<Application> pageManagements = null;
Part part = toPart(sortType);
if (docPass == SortPassType.ALL && finalPass == SortPassType.ALL) {
switch (sortType) {
case ALL -> pageManagements = applicationRepository.findAll(pageRequest);
default -> pageManagements =
applicationRepository.findAllByPart(toPart(sortType), pageRequest);
}
} else if (docPass != SortPassType.ALL && finalPass == SortPassType.ALL) {
Pass pass = toPass(docPass);
switch (sortType) {
case ALL -> pageManagements =
applicationRepository.findAllByDocumentPass(pass, pageRequest);
default -> pageManagements =
applicationRepository.findAllByPartAndDocumentPass(
toPart(sortType), pass, pageRequest);
}
} else if (docPass == SortPassType.ALL && finalPass != SortPassType.ALL) {
Pass pass = toPass(finalPass);
switch (sortType) {
case ALL -> pageManagements =
applicationRepository.findAllByFinalPass(pass, pageRequest);
default -> pageManagements =
applicationRepository.findAllByPartAndFinalPass(
toPart(sortType), pass, pageRequest);
}
} else {
Pass convertedDocPass = toPass(docPass);
Pass convertedFinalPass = toPass(finalPass);
switch (sortType) {
case ALL -> pageManagements =
applicationRepository.findAllByDocumentPassAndFinalPass(
convertedDocPass, convertedFinalPass, pageRequest);
default -> pageManagements =
applicationRepository.findAllByPartAndDocumentPassAndFinalPass(
toPart(sortType),
convertedDocPass,
convertedFinalPass,
pageRequest);
}
}
return pageManagements;
}

public String generateUUID() {
String newUUID;
while (true) {
Expand Down Expand Up @@ -122,30 +65,4 @@ public Application getApplicationByUuidAndEmail(String uuid, String email) {
throw ApplicantNotFound.EXCEPTION;
});
}

private Pass toPass(SortPassType passType) {
Pass pass = Pass.FAIL;
if (passType == SortPassType.PASS) {
pass = Pass.PASS;
}
return pass;
}

private Part toPart(SortPartType sortType) {
switch (sortType) {
case DESIGN -> {
return Part.DESIGN;
}
case BACKEND -> {
return Part.BACKEND;
}
case PRODUCT -> {
return Part.PRODUCT;
}
case FRONTEND -> {
return Part.FRONTEND;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
package ceos.backend.domain.application.mapper;

import static java.util.Map.*;

import ceos.backend.domain.application.domain.*;
import ceos.backend.domain.application.domain.Application;
import ceos.backend.domain.application.domain.ApplicationAnswer;
import ceos.backend.domain.application.domain.ApplicationInterview;
import ceos.backend.domain.application.domain.ApplicationQuestion;
import ceos.backend.domain.application.domain.ApplicationQuestionDetail;
import ceos.backend.domain.application.domain.Interview;
import ceos.backend.domain.application.domain.QuestionCategory;
import ceos.backend.domain.application.dto.request.CreateApplicationRequest;
import ceos.backend.domain.application.dto.request.UpdateApplicationQuestion;
import ceos.backend.domain.application.dto.response.*;
import ceos.backend.domain.application.dto.response.GetApplication;
import ceos.backend.domain.application.dto.response.GetApplicationQuestion;
import ceos.backend.domain.application.dto.response.GetApplications;
import ceos.backend.domain.application.dto.response.GetInterviewTime;
import ceos.backend.domain.application.dto.response.GetResultResponse;
import ceos.backend.domain.application.exception.exceptions.InterviewNotFound;
import ceos.backend.domain.application.exception.exceptions.QuestionNotFound;
import ceos.backend.domain.application.vo.*;
import ceos.backend.domain.application.vo.AnswerVo;
import ceos.backend.domain.application.vo.ApplicationBriefInfoVo;
import ceos.backend.domain.application.vo.InterviewDateTimesVo;
import ceos.backend.domain.application.vo.InterviewTimeVo;
import ceos.backend.domain.application.vo.QnAVo;
import ceos.backend.domain.application.vo.QuestionDetailVo;
import ceos.backend.domain.application.vo.QuestionListVo;
import ceos.backend.domain.application.vo.QuestionVo;
import ceos.backend.domain.application.vo.QuestionWithIdVo;
import ceos.backend.domain.recruitment.domain.Recruitment;
import ceos.backend.global.common.dto.PageInfo;
import ceos.backend.global.common.dto.ParsedDuration;
Expand All @@ -17,7 +34,11 @@
import ceos.backend.global.util.ParsedDurationConvertor;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package ceos.backend.domain.retrospect;


import ceos.backend.domain.retrospect.dto.request.CreateRetrospectRequest;
import ceos.backend.domain.retrospect.dto.response.GetRetrospectResponse;
import ceos.backend.domain.retrospect.dto.response.GetRetrospectsResponse;
import ceos.backend.domain.retrospect.service.RetrospectService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequiredArgsConstructor
@Validated
@RequestMapping(value = "/retrospect")
@Tag(name = "Retrospect")
public class RetrospectController {
private final RetrospectService retrospectService;

@Operation(summary = "회고록 목록 보기")
@GetMapping
public GetRetrospectsResponse getRetrospects(
@RequestParam("pageNum") int pageNum, @RequestParam("limit") int limit) {
log.info("회고록 목록 보기");

return retrospectService.getRetrospects(pageNum, limit);
}

@Operation(summary = "회고록 상세 보기")
@GetMapping("/{id}")
public GetRetrospectResponse getRetrospect(@PathVariable("id") Long id) {
log.info("회고록 상세 보기");

return retrospectService.getRetrospect(id);
}

@Operation(summary = "회고록 작성")
@PostMapping
public void createRetrospect(
@RequestBody @Valid CreateRetrospectRequest createRetrospectRequest) {
log.info("회고록 작성");

retrospectService.createRetrospect(createRetrospectRequest);
}

@Operation(summary = "회고록 수정")
@PutMapping("/{id}")
public GetRetrospectResponse updateRetrospect(
@PathVariable("id") Long id,
@RequestBody @Valid CreateRetrospectRequest createRetrospectRequest) {
log.info("회고록 수정");

return retrospectService.updateRetrospect(id, createRetrospectRequest);
}

@Operation(summary = "회고록 삭제")
@DeleteMapping("/{id}")
public void deleteRetrospect(@PathVariable("id") Long id) {
log.info("회고록 삭제");

retrospectService.deleteRetrospect(id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package ceos.backend.domain.retrospect.domain;


import ceos.backend.domain.retrospect.dto.request.CreateRetrospectRequest;
import ceos.backend.global.common.entity.BaseEntity;
import ceos.backend.global.common.entity.Part;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Retrospect extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "retrospect_id")
private Long id;

@NotBlank private String title;

@NotBlank private String url;

@NotBlank private String writer;

@NotNull @Positive private Integer generation;

@NotNull
@Enumerated(EnumType.STRING)
private Part part;

@Builder
public Retrospect(String title, String url, String writer, Integer generation, Part part) {
this.title = title;
this.url = url;
this.writer = writer;
this.generation = generation;
this.part = part;
}

public void update(CreateRetrospectRequest createRetrospectRequest) {
title = createRetrospectRequest.getTitle();
url = createRetrospectRequest.getUrl();
writer = createRetrospectRequest.getWriter();
generation = createRetrospectRequest.getGeneration();
part = createRetrospectRequest.getPart();
}
}
Loading

0 comments on commit 0cb55cf

Please sign in to comment.