Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
geunoo committed Mar 21, 2024
2 parents 6289826 + ce3cc9e commit 1b558c8
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public class CreateApplicationUseCase {

public void execute(Long recruitmentId, List<AttachmentRequest> attachmentRequests) {
Student student = securityPort.getCurrentStudent();

Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitmentId)
.orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION);
recruitment.checkIsApplicable(student.getSchoolNumber().getGrade());

recruitment.checkIsApplicable(student.getEntranceYear());

if (queryApplicationPort.existsApplicationByStudentIdAndApplicationStatusIn(
student.getId(), ApplicationStatus.DUPLICATE_CHECK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum BannerType {

RECRRUITMENT,
RECRUITMENT,
BOOKMARK,
NONE,
INTERNSHIP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Getter
@AllArgsConstructor
public class TeacherBannersVO {
private final Long bannerId;
private final Long id;
private final String bannerUrl;
private final BannerType bannerType;
private final LocalDate startDate;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package team.retum.jobis.domain.code.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(force = true)
@AllArgsConstructor
@Builder
public class CodeResponse {
private final Long id;
private final String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import team.retum.jobis.domain.code.model.CodeResponse;

import java.util.List;

Expand All @@ -15,9 +16,9 @@ public class RecruitAreaResponse {

private final Long id;

private final List<String> job;
private final List<CodeResponse> job;

private final List<String> tech;
private final List<CodeResponse> tech;

private final int hiring;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,23 @@ public Recruitment changeStatus(RecruitStatus status) {
.build();
}

public void checkIsApplicable(Integer studentGrade) {
public void checkIsApplicable(Integer entranceYear) {
if (this.status != RecruitStatus.RECRUITING) {
throw InvalidRecruitmentStatusException.EXCEPTION;
}

if (studentGrade == 1 || (!this.winterIntern && studentGrade == 2)) {
// 졸업생이 지원시 예외를 던짐
if (Year.now().getValue() - 3 >= entranceYear) {
throw InvalidGradeException.EXCEPTION;
}

// 1학년이 지원할 경우 예외를 던짐
if (Year.now().getValue() == entranceYear) {
throw InvalidGradeException.EXCEPTION;
}

// 2학년이 아닌 학년이 채험형 현장실습 지원시 예외를 던짐
if (this.winterIntern && entranceYear != Year.now().getValue() - 1) {
throw InvalidGradeException.EXCEPTION;
}
}
Expand Down Expand Up @@ -130,5 +141,4 @@ public Recruitment update(UpdateRecruitmentRequest request) {
.etc(request.etc())
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import team.retum.jobis.common.annotation.ReadOnlyUseCase;
import team.retum.jobis.common.spi.SecurityPort;
import team.retum.jobis.domain.auth.model.Authority;
import team.retum.jobis.domain.code.model.CodeResponse;
import team.retum.jobis.domain.recruitment.dto.response.QueryRecruitmentDetailResponse;
import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse;
import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException;
Expand Down Expand Up @@ -31,8 +32,12 @@ public QueryRecruitmentDetailResponse execute(Long recruitId) {
.map(recruitAreaResponse ->
RecruitAreaResponse.builder()
.id(recruitAreaResponse.getId())
.job(recruitAreaResponse.getJob())
.tech(recruitAreaResponse.getTech())
.job(recruitAreaResponse.getJob().stream()
.map(job -> new CodeResponse(job.getId(), job.getName()))
.toList())
.tech(recruitAreaResponse.getTech().stream()
.map(tech -> new CodeResponse(tech.getId(), tech.getName()))
.toList())
.hiring(recruitAreaResponse.getHiring())
.majorTask(recruitAreaResponse.getMajorTask())
.preferentialTreatment(recruitAreaResponse.getPreferentialTreatment())
Expand All @@ -49,4 +54,4 @@ private Boolean getApplicable(boolean winterIntern) {
}
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.querydsl.core.annotations.QueryProjection;
import lombok.Getter;
import team.retum.jobis.domain.code.model.CodeResponse;
import team.retum.jobis.domain.code.model.CodeType;
import team.retum.jobis.domain.code.persistence.entity.CodeEntity;
import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse;
Expand All @@ -12,17 +13,16 @@
public class QueryRecruitAreaVO extends RecruitAreaResponse {

@QueryProjection
public QueryRecruitAreaVO(Long id, Integer hiredCount, String majorTask,
String preferentialTreatment, List<CodeEntity> codes) {
public QueryRecruitAreaVO(Long id, Integer hiredCount, String majorTask, String preferentialTreatment, List<CodeEntity> codes) {
super(
id,
codes.stream()
.filter(code -> code.getType().equals(CodeType.JOB))
.map(CodeEntity::getKeyword)
.map(code -> new CodeResponse(code.getCode(), code.getKeyword()))
.toList(),
codes.stream()
.filter(code -> code.getType().equals(CodeType.TECH))
.map(CodeEntity::getKeyword)
.map(code -> new CodeResponse(code.getCode(), code.getKeyword()))
.toList(),
hiredCount,
majorTask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
name = "tbl_student",
uniqueConstraints = {
@UniqueConstraint(
columnNames = {"grade", "classRoom", "number"}
columnNames = {"grade", "classRoom", "number", "entranceYear"}
)
}
)
Expand Down
1 change: 1 addition & 0 deletions jobis-infrastructure/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spring:
flyway:
baseline-on-migrate: true
baseline-version: 0
enabled: ${FLYWAY_ENABLED:true}

jpa:
database-platform: team.retum.jobis.global.config.MysqlDialectConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table tbl_student drop constraint UKd3mywdtv4c22n8m41uag1osc2;
alter table tbl_student add constraint SCHOOL_NUMBER_UNIQUE unique (grade, class_room, number, entrance_year)

0 comments on commit 1b558c8

Please sign in to comment.