diff --git a/jobis-application/build.gradle b/jobis-application/build.gradle index 9adf4cd73..a1910c44a 100644 --- a/jobis-application/build.gradle +++ b/jobis-application/build.gradle @@ -1,9 +1,9 @@ dependencies { - //randomString - implementation 'net.bytebuddy:byte-buddy:1.12.17' - //transaction implementation 'org.springframework:spring-tx:5.3.22' + + // util + implementation 'org.apache.commons:commons-lang3:3.0' } diff --git a/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java b/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java index e505c1868..3710fe09b 100644 --- a/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java +++ b/jobis-application/src/main/java/team/retum/jobis/common/util/StringUtil.java @@ -2,7 +2,6 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; -import net.bytebuddy.utility.RandomString; import java.util.ArrayList; import java.util.Arrays; @@ -24,15 +23,4 @@ public static List divideString(String content, String key) { return new ArrayList<>(dividedList); } - - public static String combineIfNotNull(String content, String key, String nullableValue) { - if (nullableValue != null) { - return content + key + nullableValue; - } - return content; - } - - public static String generateRandomCode(int size) { - return RandomString.make(size); - } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/SendAuthCodeUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/SendAuthCodeUseCase.java index b17453d54..fb087a69c 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/SendAuthCodeUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/SendAuthCodeUseCase.java @@ -1,6 +1,7 @@ package team.retum.jobis.domain.auth.usecase; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.RandomStringUtils; import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.common.spi.SendEmailPort; import team.retum.jobis.domain.auth.model.AuthCode; @@ -10,8 +11,6 @@ import team.retum.jobis.domain.student.exception.StudentNotFoundException; import team.retum.jobis.domain.user.spi.QueryUserPort; -import java.util.Random; - @RequiredArgsConstructor @UseCase public class SendAuthCodeUseCase { @@ -32,7 +31,7 @@ public void execute(String email, AuthCodeType authCodeType) { } AuthCode authCode = AuthCode.builder() - .code(String.valueOf(new Random().nextInt(899999) + 100000)) + .code(RandomStringUtils.randomNumeric(6)) .ttl(300) .isVerified(false) .email(email) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/TokenReissueUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/TokenReissueUseCase.java index f8c9abc19..e018fb12d 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/TokenReissueUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/auth/usecase/TokenReissueUseCase.java @@ -28,6 +28,7 @@ public TokenResponse execute(String refresh, PlatformType platformType, String d .orElseThrow(() -> UserNotFoundException.EXCEPTION); commandUserPort.saveUser(user.setToken(deviceToken)); + return jwtPort.generateTokens(token.getUserId(), token.getAuthority(), platformType); } } \ No newline at end of file diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/code/model/Code.java b/jobis-application/src/main/java/team/retum/jobis/domain/code/model/Code.java index 75fcfa4bb..d95438d2b 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/code/model/Code.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/code/model/Code.java @@ -4,6 +4,13 @@ import lombok.Getter; import team.retum.jobis.common.annotation.Aggregate; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static team.retum.jobis.domain.code.model.CodeType.JOB; +import static team.retum.jobis.domain.code.model.CodeType.TECH; + @Getter @Builder(toBuilder = true) @Aggregate @@ -26,4 +33,12 @@ public Code changeAccessible(boolean isPublic) { .isPublic(isPublic) .build(); } + + public static Map> combineCodesWithType(List jobCode, List techCode) { + Map> codeIds = new HashMap<>(); + codeIds.put(JOB, jobCode); + codeIds.put(TECH, techCode); + + return codeIds; + } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/request/UpdateCompanyDetailsRequest.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/request/UpdateCompanyDetailsRequest.java index 31d624c0d..cfea45224 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/request/UpdateCompanyDetailsRequest.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/request/UpdateCompanyDetailsRequest.java @@ -2,6 +2,8 @@ import lombok.Builder; +import java.util.List; + @Builder public record UpdateCompanyDetailsRequest( String companyIntroduce, @@ -21,6 +23,9 @@ public record UpdateCompanyDetailsRequest( double take, String companyProfileUrl, String serviceName, - String representativePhoneNo + String representativePhoneNo, + Long businessAreaCode, + String bizRegistrationUrl, + List attachmentUrls ) { } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/response/CompanyMyPageResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/response/CompanyMyPageResponse.java index c46cb098f..d152edc35 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/response/CompanyMyPageResponse.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/dto/response/CompanyMyPageResponse.java @@ -6,6 +6,7 @@ import team.retum.jobis.domain.company.model.CompanyType; import java.time.LocalDate; +import java.util.List; @Getter @Builder @@ -21,6 +22,7 @@ public class CompanyMyPageResponse { private final String subAddressDetail; private final String subZipCode; private final String representative; + private final String representativePhoneNo; private final LocalDate foundedAt; private final double take; private final int workersCount; @@ -35,6 +37,7 @@ public class CompanyMyPageResponse { private final String serviceName; private final String businessArea; private final String bizRegistrationUrl; + private final List attachmentUrls; public static CompanyMyPageResponse from(Company company) { return CompanyMyPageResponse.builder() @@ -49,6 +52,7 @@ public static CompanyMyPageResponse from(Company company) { .subAddressDetail(company.getAddressInfo().subAddressDetail()) .subZipCode(company.getAddressInfo().subZipCode()) .representative(company.getRepresentative()) + .representativePhoneNo(company.getRepresentativePhoneNo()) .foundedAt(company.getFoundedAt()) .take(company.getTake()) .workersCount(company.getWorkersCount()) @@ -63,6 +67,7 @@ public static CompanyMyPageResponse from(Company company) { .serviceName(company.getServiceName()) .businessArea(company.getBusinessArea()) .bizRegistrationUrl(company.getBizRegistrationUrl()) + .attachmentUrls(company.getAttachmentUrls()) .build(); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/model/Company.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/model/Company.java index 3f00f7edf..aa87ebf92 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/model/Company.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/model/Company.java @@ -28,6 +28,7 @@ public class Company { private final AddressInfo addressInfo; private final String representative; + private final String representativePhoneNo; private final LocalDate foundedAt; @@ -95,7 +96,7 @@ public static Company of(RegisterCompanyRequest request, String businessArea) { .build(); } - public Company update(UpdateCompanyDetailsRequest request) { + public Company update(UpdateCompanyDetailsRequest request, String businessArea) { return this.toBuilder() .addressInfo( AddressInfo.builder() @@ -123,6 +124,9 @@ public Company update(UpdateCompanyDetailsRequest request) { .fax(request.fax()) .email(request.email()) .serviceName(request.serviceName()) + .attachmentUrls(request.attachmentUrls()) + .businessArea(businessArea) + .bizRegistrationUrl(request.bizRegistrationUrl()) .build(); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/QueryCompanyDetailsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/QueryCompanyDetailsUseCase.java index 554367d36..ddb3b5f8e 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/QueryCompanyDetailsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/QueryCompanyDetailsUseCase.java @@ -36,6 +36,7 @@ public QueryCompanyDetailsResponse execute(Long companyId) { .fax(vo.getFax()) .email(vo.getEmail()) .representativeName(vo.getRepresentativeName()) + .representativePhoneNo(vo.getRepresentativePhoneNo()) .foundedAt(vo.getFoundedAt()) .workerNumber(vo.getWorkerNumber()) .take(vo.getTake()) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/UpdateCompanyDetailsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/UpdateCompanyDetailsUseCase.java index 56734fc42..14c7b68b3 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/UpdateCompanyDetailsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/UpdateCompanyDetailsUseCase.java @@ -4,6 +4,9 @@ import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.common.spi.SecurityPort; import team.retum.jobis.domain.auth.model.Authority; +import team.retum.jobis.domain.code.exception.CodeNotFoundException; +import team.retum.jobis.domain.code.model.Code; +import team.retum.jobis.domain.code.spi.QueryCodePort; import team.retum.jobis.domain.company.dto.request.UpdateCompanyDetailsRequest; import team.retum.jobis.domain.company.exception.CompanyNotFoundException; import team.retum.jobis.domain.company.model.Company; @@ -16,16 +19,20 @@ public class UpdateCompanyDetailsUseCase { private final QueryCompanyPort queryCompanyPort; private final CommandCompanyPort commandCompanyPort; + private final QueryCodePort queryCodePort; private final SecurityPort securityPort; public void execute(UpdateCompanyDetailsRequest request, Long companyId) { Company company = queryCompanyPort.queryCompanyById(companyId) .orElseThrow(() -> CompanyNotFoundException.EXCEPTION); + Code code = queryCodePort.queryCodeById(request.businessAreaCode()) + .orElseThrow(() -> CodeNotFoundException.EXCEPTION); + if (securityPort.getCurrentUserAuthority() == Authority.COMPANY) { company.verifySameCompany(securityPort.getCurrentCompany()); } - commandCompanyPort.saveCompany(company.update(request)); + commandCompanyPort.saveCompany(company.update(request, code.getKeyword())); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticesResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticesResponse.java new file mode 100644 index 000000000..2f00e3d44 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticesResponse.java @@ -0,0 +1,15 @@ +package team.retum.jobis.domain.notice.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import team.retum.jobis.domain.notice.spi.vo.NoticeVO; + +import java.util.List; + +@Getter +@AllArgsConstructor +public class QueryNoticesResponse { + + private final List notices; + +} \ No newline at end of file diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/QueryNoticePort.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/QueryNoticePort.java index 75d791c53..c8f6a31fd 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/QueryNoticePort.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/QueryNoticePort.java @@ -1,10 +1,15 @@ package team.retum.jobis.domain.notice.spi; import team.retum.jobis.domain.notice.model.Notice; +import team.retum.jobis.domain.notice.spi.vo.NoticeVO; +import java.util.List; import java.util.Optional; public interface QueryNoticePort { Optional queryNoticeById(Long noticeId); + + List queryNotices(); + } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/vo/NoticeVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/vo/NoticeVO.java new file mode 100644 index 000000000..fe42b3c70 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/spi/vo/NoticeVO.java @@ -0,0 +1,15 @@ +package team.retum.jobis.domain.notice.spi.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.time.LocalDateTime; + +@Getter +@AllArgsConstructor +public class NoticeVO{ + + private final Long id; + private final String title; + private final LocalDateTime createdAt; +} \ No newline at end of file diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/QueryNoticesUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/QueryNoticesUseCase.java new file mode 100644 index 000000000..320ec11e4 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/QueryNoticesUseCase.java @@ -0,0 +1,22 @@ +package team.retum.jobis.domain.notice.usecase; + +import lombok.RequiredArgsConstructor; +import team.retum.jobis.common.annotation.ReadOnlyUseCase; +import team.retum.jobis.domain.notice.dto.response.QueryNoticesResponse; +import team.retum.jobis.domain.notice.spi.QueryNoticePort; +import team.retum.jobis.domain.notice.spi.vo.NoticeVO; + +import java.util.List; + +@RequiredArgsConstructor +@ReadOnlyUseCase +public class QueryNoticesUseCase { + + private final QueryNoticePort queryNoticePort; + + public QueryNoticesResponse execute() { + List noticeVOs = queryNoticePort.queryNotices(); + + return new QueryNoticesResponse(noticeVOs); + } +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java index 404e60daa..f28f64414 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/ApplyRecruitmentRequest.java @@ -12,6 +12,7 @@ public record ApplyRecruitmentRequest( List areas, Integer requiredGrade, String workingHours, + boolean flexibleWorking, List requiredLicenses, List hiringProgress, int trainPay, diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/UpdateRecruitmentRequest.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/UpdateRecruitmentRequest.java index d417b7bce..79f708e97 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/UpdateRecruitmentRequest.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/request/UpdateRecruitmentRequest.java @@ -11,6 +11,7 @@ public record UpdateRecruitmentRequest( Integer requiredGrade, String workingHours, + boolean flexibleWorking, List requiredLicenses, List hiringProgress, Integer trainPay, diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentResponse.java index b0585f869..b5cd65ab9 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentResponse.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentResponse.java @@ -20,6 +20,7 @@ public class QueryMyRecruitmentResponse { private final List areas; private final Integer requiredGrade; private final String workingHours; + private final boolean flexibleWorking; private final List requiredLicenses; private final List hiringProgress; private final Integer trainPay; @@ -39,6 +40,7 @@ public static QueryMyRecruitmentResponse of(RecruitmentDetailVO recruitmentDetai .companyProfileUrl(recruitmentDetail.getCompanyProfileUrl()) .companyName(recruitmentDetail.getCompanyName()) .workingHours(recruitmentDetail.getWorkingHours()) + .flexibleWorking(recruitmentDetail.isFlexibleWorking()) .areas(recruitAreas) .requiredGrade(recruitmentDetail.getRequiredGrade()) .requiredLicenses(recruitmentDetail.getRequiredLicenses()) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentsResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentsResponse.java new file mode 100644 index 000000000..d579e7560 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryMyRecruitmentsResponse.java @@ -0,0 +1,15 @@ +package team.retum.jobis.domain.recruitment.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import team.retum.jobis.domain.recruitment.spi.vo.MyAllRecruitmentsVO; + +import java.util.List; + +@Getter +@NoArgsConstructor(force = true) +@AllArgsConstructor +public class QueryMyRecruitmentsResponse { + private final List myRecruitments; +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryRecruitmentDetailResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryRecruitmentDetailResponse.java index 8b059692b..0a4515bcf 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryRecruitmentDetailResponse.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/dto/response/QueryRecruitmentDetailResponse.java @@ -24,6 +24,7 @@ public class QueryRecruitmentDetailResponse { private final List areas; private final Integer requiredGrade; private final String workingHours; + private final boolean flexibleWorking; private final List requiredLicenses; private final List hiringProgress; private final Integer trainPay; @@ -46,6 +47,7 @@ public static QueryRecruitmentDetailResponse of(RecruitmentDetailVO recruitmentD .areas(recruitAreas) .requiredGrade(recruitmentDetail.getRequiredGrade()) .workingHours(recruitmentDetail.getWorkingHours()) + .flexibleWorking(recruitmentDetail.isFlexibleWorking()) .requiredLicenses(recruitmentDetail.getRequiredLicenses()) .hiringProgress(recruitmentDetail.getHiringProgress()) .trainPay(recruitmentDetail.getTrainPay()) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java index f1cdfc16a..f5e2f4459 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitArea.java @@ -3,18 +3,15 @@ import lombok.Builder; import lombok.Getter; import team.retum.jobis.common.annotation.Aggregate; +import team.retum.jobis.domain.code.model.Code; import team.retum.jobis.domain.code.model.CodeType; import team.retum.jobis.domain.recruitment.dto.request.CreateRecruitAreaRequest; -import java.util.HashMap; import java.util.List; import java.util.Map; -import static team.retum.jobis.domain.code.model.CodeType.JOB; -import static team.retum.jobis.domain.code.model.CodeType.TECH; - @Getter -@Builder +@Builder(toBuilder = true) @Aggregate public class RecruitArea { @@ -31,15 +28,21 @@ public class RecruitArea { private final Map> codes; public static RecruitArea of(CreateRecruitAreaRequest request, Long recruitmentId) { - Map> codeIds = new HashMap<>(); - codeIds.put(JOB, request.jobCodes()); - codeIds.put(TECH, request.techCodes()); return RecruitArea.builder() .recruitmentId(recruitmentId) .hiredCount(request.hiring()) .majorTask(request.majorTask()) .preferentialTreatment(request.preferentialTreatment()) - .codes(codeIds) + .codes(Code.combineCodesWithType(request.jobCodes(), request.techCodes())) + .build(); + } + + public RecruitArea update(CreateRecruitAreaRequest request) { + return this.toBuilder() + .hiredCount(request.hiring()) + .majorTask(request.majorTask()) + .preferentialTreatment(request.preferentialTreatment()) + .codes(Code.combineCodesWithType(request.jobCodes(), request.techCodes())) .build(); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitingPeriod.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitingPeriod.java index b178cb216..aa7f6a62b 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitingPeriod.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/RecruitingPeriod.java @@ -2,5 +2,4 @@ import java.time.LocalDate; -public record RecruitingPeriod(LocalDate startDate, LocalDate endDate) { -} +public record RecruitingPeriod(LocalDate startDate, LocalDate endDate) {} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java index bef0e5998..a1ac7af8a 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/model/Recruitment.java @@ -31,6 +31,8 @@ public class Recruitment { private final String workingHours; + private final boolean flexibleWorking; + private final String benefits; private final boolean militarySupport; @@ -58,6 +60,7 @@ public static Recruitment of(ApplyRecruitmentRequest request, Long currentCompan .militarySupport(request.militarySupport()) .personalContract(request.personalContact()) .workingHours(request.workingHours()) + .flexibleWorking(request.flexibleWorking()) .salary(new Salary(request.trainPay(), request.pay())) .requiredLicenses(request.requiredLicenses()) .status(RecruitStatus.REQUESTED) @@ -116,6 +119,7 @@ public Recruitment update(UpdateRecruitmentRequest request) { return this.toBuilder() .requiredGrade(request.requiredGrade()) .workingHours(request.workingHours()) + .flexibleWorking(request.flexibleWorking()) .requiredLicenses(request.requiredLicenses()) .hiringProgress(request.hiringProgress()) .salary(new Salary(request.trainPay(), request.pay())) diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/CheckRecruitmentPermissionService.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/CheckRecruitmentPermissionService.java index 24a701907..3aa253bbe 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/CheckRecruitmentPermissionService.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/service/CheckRecruitmentPermissionService.java @@ -2,31 +2,31 @@ import lombok.RequiredArgsConstructor; import team.retum.jobis.common.annotation.Service; +import team.retum.jobis.common.spi.SecurityPort; import team.retum.jobis.domain.auth.model.Authority; import team.retum.jobis.domain.recruitment.exception.CompanyMismatchException; import team.retum.jobis.domain.recruitment.model.RecruitArea; import team.retum.jobis.domain.recruitment.model.Recruitment; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; -import team.retum.jobis.domain.user.model.User; -// 추후 COMPANY 다시 활성화되면 사용 @RequiredArgsConstructor @Service public class CheckRecruitmentPermissionService { private final QueryRecruitmentPort queryRecruitmentPort; + private final SecurityPort securityPort; - public void checkPermission(User currentUser, Recruitment recruitment) { - if (currentUser.getAuthority() == Authority.TEACHER) { + public void checkPermission(Recruitment recruitment) { + if (securityPort.getCurrentUserAuthority() == Authority.TEACHER) { return; } - if (currentUser.getAuthority() == Authority.COMPANY && !currentUser.getId().equals(recruitment.getCompanyId())) { + if (!securityPort.getCurrentCompany().getId().equals(recruitment.getCompanyId())) { throw CompanyMismatchException.EXCEPTION; } } - public void checkPermission(User currentUser, RecruitArea recruitArea) { + public void checkPermission(RecruitArea recruitArea) { queryRecruitmentPort.queryRecruitmentById(recruitArea.getRecruitmentId()) - .ifPresent(recruitment -> checkPermission(currentUser, recruitment)); + .ifPresent(this::checkPermission); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java index 2daf3b347..4ef18b62d 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/QueryRecruitmentPort.java @@ -4,6 +4,7 @@ import team.retum.jobis.domain.recruitment.dto.response.RecruitAreaResponse; import team.retum.jobis.domain.recruitment.model.RecruitArea; import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.spi.vo.MyAllRecruitmentsVO; import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; import team.retum.jobis.domain.recruitment.spi.vo.StudentRecruitmentVO; import team.retum.jobis.domain.recruitment.spi.vo.TeacherRecruitmentVO; @@ -38,4 +39,6 @@ public interface QueryRecruitmentPort { List queryRecruitAreasByRecruitmentId(Long recruitmentId); Map queryCompanyNameByRecruitmentIds(List recruitmentIds); + + List queryMyAllRecruitmentsVOByCompanyId(Long companyId); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/MyAllRecruitmentsVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/MyAllRecruitmentsVO.java new file mode 100644 index 000000000..10d129f0a --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/MyAllRecruitmentsVO.java @@ -0,0 +1,16 @@ +package team.retum.jobis.domain.recruitment.spi.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Getter +@NoArgsConstructor(force = true) +@AllArgsConstructor +public class MyAllRecruitmentsVO { + private final Long id; + private final RecruitmentAreaElement recruitmentAreas; + private final LocalDateTime createdAt; +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentAreaElement.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentAreaElement.java new file mode 100644 index 000000000..2562f3517 --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentAreaElement.java @@ -0,0 +1,15 @@ +package team.retum.jobis.domain.recruitment.spi.vo; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Getter +@NoArgsConstructor(force = true) +@AllArgsConstructor +public class RecruitmentAreaElement { + private final List jobs; + private final int hiring; +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentDetailVO.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentDetailVO.java index a838af6a6..94ea1ab94 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentDetailVO.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/spi/vo/RecruitmentDetailVO.java @@ -18,6 +18,7 @@ public class RecruitmentDetailVO { private final String companyName; private final Integer requiredGrade; private final String workingHours; + private final boolean flexibleWorking; private final List requiredLicenses; private final List hiringProgress; private final Integer trainPay; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ChangeRecruitmentStatusSchedulerUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ChangeRecruitmentStatusSchedulerUseCase.java index 5fc7f2154..e47205d7e 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ChangeRecruitmentStatusSchedulerUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/ChangeRecruitmentStatusSchedulerUseCase.java @@ -4,12 +4,10 @@ import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.common.spi.PublishEventPort; import team.retum.jobis.domain.recruitment.event.RecruitmentStatusChangedEvent; -import team.retum.jobis.domain.recruitment.model.RecruitStatus; import team.retum.jobis.domain.recruitment.model.Recruitment; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; -import java.time.LocalDate; import java.util.List; @RequiredArgsConstructor diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CreateRecruitAreaUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CreateRecruitAreaUseCase.java index 54d32fb26..333e8e586 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CreateRecruitAreaUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/CreateRecruitAreaUseCase.java @@ -3,15 +3,24 @@ import lombok.RequiredArgsConstructor; import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.domain.recruitment.dto.request.CreateRecruitAreaRequest; +import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; import team.retum.jobis.domain.recruitment.model.RecruitArea; +import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.service.CheckRecruitmentPermissionService; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; +import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; @RequiredArgsConstructor @UseCase public class CreateRecruitAreaUseCase { + private final QueryRecruitmentPort queryRecruitmentPort; private final CommandRecruitmentPort commandRecruitmentPort; + private final CheckRecruitmentPermissionService checkRecruitmentPermissionService; public void execute(CreateRecruitAreaRequest request, Long recruitmentId) { + Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitmentId) + .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); + checkRecruitmentPermissionService.checkPermission(recruitment); commandRecruitmentPort.saveRecruitmentArea(RecruitArea.of(request, recruitmentId)); } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitAreaUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitAreaUseCase.java index 8f285a1da..1547d5bf4 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitAreaUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitAreaUseCase.java @@ -5,6 +5,7 @@ import team.retum.jobis.domain.recruitment.exception.RecruitAreaNotFoundException; import team.retum.jobis.domain.recruitment.model.RecruitArea; import team.retum.jobis.domain.recruitment.service.CheckRecruitmentAreaDeletableService; +import team.retum.jobis.domain.recruitment.service.CheckRecruitmentPermissionService; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; @@ -14,11 +15,13 @@ public class DeleteRecruitAreaUseCase { private final CommandRecruitmentPort commandRecruitmentPort; private final QueryRecruitmentPort queryRecruitmentPort; private final CheckRecruitmentAreaDeletableService checkRecruitmentAreaDeletableService; + private final CheckRecruitmentPermissionService checkRecruitmentPermissionService; public void execute(Long recruitAreaId) { RecruitArea recruitArea = queryRecruitmentPort.queryRecruitmentAreaById(recruitAreaId) .orElseThrow(() -> RecruitAreaNotFoundException.EXCEPTION); checkRecruitmentAreaDeletableService.checkRecruitmentAreaDeletable(recruitArea); + checkRecruitmentPermissionService.checkPermission(recruitArea); commandRecruitmentPort.deleteRecruitAreaById(recruitArea.getId()); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitmentUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitmentUseCase.java index f4d6f4b47..6f94cb978 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitmentUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/DeleteRecruitmentUseCase.java @@ -4,6 +4,7 @@ import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.service.CheckRecruitmentPermissionService; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; @@ -12,11 +13,13 @@ public class DeleteRecruitmentUseCase { private final QueryRecruitmentPort queryRecruitmentPort; private final CommandRecruitmentPort commandRecruitmentPort; + private final CheckRecruitmentPermissionService checkRecruitmentPermissionService; public void execute(Long recruitmentId) { Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitmentId) .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); recruitment.checkIsDeletable(); + checkRecruitmentPermissionService.checkPermission(recruitment); commandRecruitmentPort.deleteRecruitment(recruitment); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentsUseCase.java new file mode 100644 index 000000000..1395a5fdb --- /dev/null +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/QueryMyRecruitmentsUseCase.java @@ -0,0 +1,28 @@ +package team.retum.jobis.domain.recruitment.usecase; + +import lombok.RequiredArgsConstructor; +import team.retum.jobis.common.annotation.ReadOnlyUseCase; +import team.retum.jobis.common.spi.SecurityPort; +import team.retum.jobis.domain.company.model.Company; +import team.retum.jobis.domain.recruitment.dto.response.QueryMyRecruitmentsResponse; +import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; +import team.retum.jobis.domain.recruitment.spi.vo.MyAllRecruitmentsVO; + +import java.util.List; + +@RequiredArgsConstructor +@ReadOnlyUseCase +public class QueryMyRecruitmentsUseCase { + + private final QueryRecruitmentPort queryRecruitmentPort; + private final SecurityPort securityPort; + + public QueryMyRecruitmentsResponse execute() { + Company company = securityPort.getCurrentCompany(); + + List recruitments = + queryRecruitmentPort.queryMyAllRecruitmentsVOByCompanyId(company.getId()); + + return new QueryMyRecruitmentsResponse(recruitments); + } +} diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java index af3442ba6..750360f80 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/StudentQueryRecruitmentsUseCase.java @@ -5,7 +5,6 @@ import team.retum.jobis.common.dto.response.TotalPageCountResponse; import team.retum.jobis.common.spi.SecurityPort; import team.retum.jobis.common.util.NumberUtil; -import team.retum.jobis.common.util.StringUtil; import team.retum.jobis.domain.recruitment.dto.RecruitmentFilter; import team.retum.jobis.domain.recruitment.dto.response.StudentQueryRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.StudentQueryRecruitmentsResponse.StudentRecruitmentResponse; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java index ea571c5db..c490713c7 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/TeacherQueryRecruitmentsUseCase.java @@ -4,7 +4,6 @@ import team.retum.jobis.common.annotation.ReadOnlyUseCase; import team.retum.jobis.common.dto.response.TotalPageCountResponse; import team.retum.jobis.common.util.NumberUtil; -import team.retum.jobis.common.util.StringUtil; import team.retum.jobis.domain.recruitment.dto.RecruitmentFilter; import team.retum.jobis.domain.recruitment.dto.response.TeacherQueryRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.TeacherQueryRecruitmentsResponse.TeacherRecruitmentResponse; diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitAreaUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitAreaUseCase.java index b9ba84e7f..00d70eaa2 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitAreaUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitAreaUseCase.java @@ -3,17 +3,24 @@ import lombok.RequiredArgsConstructor; import team.retum.jobis.common.annotation.UseCase; import team.retum.jobis.domain.recruitment.dto.request.CreateRecruitAreaRequest; +import team.retum.jobis.domain.recruitment.exception.RecruitAreaNotFoundException; import team.retum.jobis.domain.recruitment.model.RecruitArea; +import team.retum.jobis.domain.recruitment.service.CheckRecruitmentPermissionService; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; +import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; @RequiredArgsConstructor @UseCase public class UpdateRecruitAreaUseCase { private final CommandRecruitmentPort commandRecruitmentPort; + private final QueryRecruitmentPort queryRecruitmentPort; + private final CheckRecruitmentPermissionService checkRecruitmentPermissionService; public void execute(CreateRecruitAreaRequest request, Long recruitAreaId) { - commandRecruitmentPort.saveRecruitmentArea( - RecruitArea.of(request, recruitAreaId) - ); + RecruitArea recruitArea = queryRecruitmentPort.queryRecruitmentAreaById(recruitAreaId) + .orElseThrow(() -> RecruitAreaNotFoundException.EXCEPTION); + checkRecruitmentPermissionService.checkPermission(recruitArea); + + commandRecruitmentPort.saveRecruitmentArea(recruitArea.update(request)); } } \ No newline at end of file diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitmentUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitmentUseCase.java index 68440da5b..b8c0ff5ea 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitmentUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/recruitment/usecase/UpdateRecruitmentUseCase.java @@ -5,6 +5,7 @@ import team.retum.jobis.domain.recruitment.dto.request.UpdateRecruitmentRequest; import team.retum.jobis.domain.recruitment.exception.RecruitmentNotFoundException; import team.retum.jobis.domain.recruitment.model.Recruitment; +import team.retum.jobis.domain.recruitment.service.CheckRecruitmentPermissionService; import team.retum.jobis.domain.recruitment.spi.CommandRecruitmentPort; import team.retum.jobis.domain.recruitment.spi.QueryRecruitmentPort; @@ -13,10 +14,12 @@ public class UpdateRecruitmentUseCase { private final QueryRecruitmentPort queryRecruitmentPort; private final CommandRecruitmentPort commandRecruitmentPort; + private final CheckRecruitmentPermissionService checkRecruitmentPermissionService; public void execute(UpdateRecruitmentRequest request, Long recruitmentId) { Recruitment recruitment = queryRecruitmentPort.queryRecruitmentById(recruitmentId) .orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION); + checkRecruitmentPermissionService.checkPermission(recruitment); commandRecruitmentPort.saveRecruitment(recruitment.update(request)); } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/user/model/User.java b/jobis-application/src/main/java/team/retum/jobis/domain/user/model/User.java index ac33607c4..ddf7799f0 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/user/model/User.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/user/model/User.java @@ -28,8 +28,12 @@ public User updatePassword(String password) { } public User setToken(String token) { - return this.toBuilder() - .token(token) - .build(); + if (token != null) { + return this.toBuilder() + .token(token) + .build(); + } else { + return this; + } } } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/user/usecase/LoginUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/user/usecase/LoginUseCase.java index cea176afc..eba59be94 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/user/usecase/LoginUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/user/usecase/LoginUseCase.java @@ -28,7 +28,9 @@ public TokenResponse execute(LoginRequest request) { if (!securityPort.isPasswordMatch(request.password(), user.getPassword())) { throw InvalidPasswordException.EXCEPTION; } + commandUserPort.saveUser(user.setToken(request.deviceToken())); + return jwtPort.generateTokens(user.getId(), user.getAuthority(), request.platformType()); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/AuthWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/AuthWebAdapter.java index e3aa8bf82..0e80be161 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/AuthWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/AuthWebAdapter.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController; import team.retum.jobis.domain.auth.dto.response.TokenResponse; import team.retum.jobis.domain.auth.model.PlatformType; -import team.retum.jobis.domain.auth.presentation.dto.SendAuthCodeWebRequest; +import team.retum.jobis.domain.auth.presentation.dto.request.SendAuthCodeWebRequest; import team.retum.jobis.domain.auth.presentation.dto.request.CompanySignInWebRequest; import team.retum.jobis.domain.auth.usecase.CompanySignInUseCase; import team.retum.jobis.domain.auth.usecase.SendAuthCodeUseCase; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/SendAuthCodeWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/request/SendAuthCodeWebRequest.java similarity index 89% rename from jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/SendAuthCodeWebRequest.java rename to jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/request/SendAuthCodeWebRequest.java index 177423343..6b6f3dcd2 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/SendAuthCodeWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/auth/presentation/dto/request/SendAuthCodeWebRequest.java @@ -1,4 +1,4 @@ -package team.retum.jobis.domain.auth.presentation.dto; +package team.retum.jobis.domain.auth.presentation.dto.request; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java index cb759b236..a8ec7bcaa 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/persistence/mapper/CompanyMapper.java @@ -80,7 +80,7 @@ public Company toDomain(CompanyEntity entity) { .build() ) .representative(entity.getRepresentative()) - .representativePhoneNo(entity.getRepresentative()) + .representativePhoneNo(entity.getRepresentativePhoneNo()) .serviceName(entity.getServiceName()) .take(entity.getTake()) .workersCount(entity.getWorkersCount()) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java index 7a5731a5d..5c4402c8a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/RegisterCompanyWebRequest.java @@ -86,10 +86,10 @@ public class RegisterCompanyWebRequest { private LocalDate foundedAt; @NotNull - private int workerNumber; + private Integer workerNumber; @NotNull - private double take; + private Double take; private String companyProfileUrl; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/UpdateCompanyDetailsWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/UpdateCompanyDetailsWebRequest.java index ad04b4cfd..89e19bab8 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/UpdateCompanyDetailsWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/company/presentation/dto/request/UpdateCompanyDetailsWebRequest.java @@ -8,6 +8,8 @@ import lombok.NoArgsConstructor; import team.retum.jobis.domain.company.dto.request.UpdateCompanyDetailsRequest; +import java.util.List; + @Getter @NoArgsConstructor public class UpdateCompanyDetailsWebRequest { @@ -58,10 +60,10 @@ public class UpdateCompanyDetailsWebRequest { private String email; @NotNull - private int workerNumber; + private Integer workerNumber; @NotNull - private double take; + private Double take; @NotBlank private String companyProfileUrl; @@ -73,6 +75,14 @@ public class UpdateCompanyDetailsWebRequest { @NotBlank private String representativePhoneNo; + @NotNull + private Long businessAreaCode; + + @NotBlank + private String bizRegistrationUrl; + + private List<@NotNull String> attachmentUrls; + public UpdateCompanyDetailsRequest toDomainRequest() { return UpdateCompanyDetailsRequest.builder() @@ -94,6 +104,10 @@ public UpdateCompanyDetailsRequest toDomainRequest() { .companyProfileUrl(this.companyProfileUrl) .serviceName(this.serviceName) .representativePhoneNo(this.representativePhoneNo) + .representativePhoneNo(this.representativePhoneNo) + .businessAreaCode(this.businessAreaCode) + .bizRegistrationUrl(this.bizRegistrationUrl) + .attachmentUrls(this.attachmentUrls) .build(); } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/NoticePersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/NoticePersistenceAdapter.java index 7b1d52070..157950e2e 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/NoticePersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/NoticePersistenceAdapter.java @@ -1,20 +1,28 @@ package team.retum.jobis.domain.notice.persistence; +import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; import team.retum.jobis.domain.notice.model.Notice; import team.retum.jobis.domain.notice.persistence.mapper.NoticeMapper; import team.retum.jobis.domain.notice.persistence.repository.NoticeJpaRepository; +import team.retum.jobis.domain.notice.persistence.repository.vo.QQueryNoticeVO; import team.retum.jobis.domain.notice.spi.NoticePort; +import team.retum.jobis.domain.notice.spi.vo.NoticeVO; +import java.util.List; import java.util.Optional; +import static team.retum.jobis.domain.notice.persistence.entity.QNoticeEntity.noticeEntity; + + @RequiredArgsConstructor @Repository public class NoticePersistenceAdapter implements NoticePort { private final NoticeJpaRepository noticeJpaRepository; private final NoticeMapper noticeMapper; + private final JPAQueryFactory queryFactory; @Override public void saveNotice(Notice notice) { @@ -35,4 +43,22 @@ public Optional queryNoticeById(Long noticeId) { public void deleteNotice(Notice notice) { noticeJpaRepository.delete(noticeMapper.toEntity(notice)); } + + @Override + public List queryNotices() { + return queryFactory + .select( + new QQueryNoticeVO( + noticeEntity.id, + noticeEntity.title, + noticeEntity.createdAt + ) + ) + .from(noticeEntity) + .orderBy(noticeEntity.createdAt.desc()) + .fetch() + .stream() + .map(NoticeVO.class::cast) + .toList(); + } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/repository/vo/QueryNoticeVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/repository/vo/QueryNoticeVO.java new file mode 100644 index 000000000..b07ff229b --- /dev/null +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/repository/vo/QueryNoticeVO.java @@ -0,0 +1,17 @@ +package team.retum.jobis.domain.notice.persistence.repository.vo; + +import com.querydsl.core.annotations.QueryProjection; +import lombok.Getter; +import team.retum.jobis.domain.notice.spi.vo.NoticeVO; + +import java.time.LocalDateTime; + + +@Getter +public class QueryNoticeVO extends NoticeVO { + + @QueryProjection + public QueryNoticeVO(Long id, String title, LocalDateTime createdAt) { + super(id, title, createdAt); + } +} diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/NoticeWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/NoticeWebAdapter.java index 15b91353d..3c0bfd301 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/NoticeWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/NoticeWebAdapter.java @@ -3,8 +3,8 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -13,11 +13,13 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import team.retum.jobis.domain.notice.dto.response.QueryNoticeDetailResponse; +import team.retum.jobis.domain.notice.dto.response.QueryNoticesResponse; import team.retum.jobis.domain.notice.presentation.dto.CreateNoticeWebRequest; import team.retum.jobis.domain.notice.presentation.dto.UpdateNoticeWebRequest; import team.retum.jobis.domain.notice.usecase.CreateNoticeUseCase; import team.retum.jobis.domain.notice.usecase.DeleteNoticeUseCase; import team.retum.jobis.domain.notice.usecase.QueryNoticeDetailUseCase; +import team.retum.jobis.domain.notice.usecase.QueryNoticesUseCase; import team.retum.jobis.domain.notice.usecase.UpdateNoticeUseCase; @RequiredArgsConstructor @@ -28,6 +30,7 @@ public class NoticeWebAdapter { private final CreateNoticeUseCase createNoticeUseCase; private final UpdateNoticeUseCase updateNoticeUseCase; private final DeleteNoticeUseCase deleteNoticeUseCase; + private final QueryNoticesUseCase queryNoticesUseCase; private final QueryNoticeDetailUseCase queryNoticeDetailsUseCase; @ResponseStatus(HttpStatus.CREATED) @@ -39,8 +42,8 @@ public void createNotice(@RequestBody @Valid CreateNoticeWebRequest request) { @ResponseStatus(HttpStatus.NO_CONTENT) @PatchMapping("/{notice-id}") public void updateNotice( - @RequestBody @Valid UpdateNoticeWebRequest request, - @PathVariable("notice-id") Long noticeId + @RequestBody @Valid UpdateNoticeWebRequest request, + @PathVariable("notice-id") Long noticeId ) { updateNoticeUseCase.execute(request.getTitle(), request.getContent(), noticeId); } @@ -51,6 +54,11 @@ public void deleteNotice(@PathVariable("notice-id") Long noticeId) { deleteNoticeUseCase.execute(noticeId); } + @GetMapping + public QueryNoticesResponse queryNotices() { + return queryNoticesUseCase.execute(); + } + @GetMapping("/{notice-id}") public QueryNoticeDetailResponse queryNoticeDetails( @PathVariable("notice-id") Long noticeId diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java index 519e0ce83..e12b71725 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/RecruitmentPersistenceAdapter.java @@ -1,7 +1,6 @@ package team.retum.jobis.domain.recruitment.persistence; import com.querydsl.core.types.dsl.BooleanExpression; -import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; @@ -22,11 +21,13 @@ import team.retum.jobis.domain.recruitment.persistence.mapper.RecruitmentMapper; import team.retum.jobis.domain.recruitment.persistence.repository.RecruitAreaJpaRepository; import team.retum.jobis.domain.recruitment.persistence.repository.RecruitmentJpaRepository; +import team.retum.jobis.domain.recruitment.persistence.repository.vo.QQueryMyAllRecruitmentsVO; import team.retum.jobis.domain.recruitment.persistence.repository.vo.QQueryRecruitAreaVO; import team.retum.jobis.domain.recruitment.persistence.repository.vo.QQueryRecruitmentDetailVO; import team.retum.jobis.domain.recruitment.persistence.repository.vo.QQueryStudentRecruitmentsVO; import team.retum.jobis.domain.recruitment.persistence.repository.vo.QQueryTeacherRecruitmentsVO; import team.retum.jobis.domain.recruitment.spi.RecruitmentPort; +import team.retum.jobis.domain.recruitment.spi.vo.MyAllRecruitmentsVO; import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; import team.retum.jobis.domain.recruitment.spi.vo.StudentRecruitmentVO; import team.retum.jobis.domain.recruitment.spi.vo.TeacherRecruitmentVO; @@ -175,6 +176,7 @@ public RecruitmentDetailVO queryRecruitmentDetailById(Long recruitmentId, Long u companyEntity.name, recruitmentEntity.requiredGrade, recruitmentEntity.workingHours, + recruitmentEntity.flexibleWorking, recruitmentEntity.requiredLicenses, recruitmentEntity.hiringProgress, recruitmentEntity.payInfo.trainPay, @@ -384,6 +386,32 @@ public Map queryCompanyNameByRecruitmentIds(List recruitment ); } + @Override + public List queryMyAllRecruitmentsVOByCompanyId(Long companyId) { + return queryFactory + .selectFrom(recruitmentEntity) + .join(recruitAreaEntity) + .on(recruitAreaEntity.recruitment.eq(recruitmentEntity)) + .join(recruitAreaEntity.recruitAreaCodes, recruitAreaCodeEntity) + .on(recruitAreaCodeEntity.type.eq(JOB)) + .join(recruitAreaCodeEntity.code, codeEntity) + .join(recruitmentEntity.company, companyEntity) + .where(companyEntity.id.eq(companyId)) + .orderBy(recruitmentEntity.createdAt.desc()) + .transform( + groupBy(recruitmentEntity.id) + .list( + new QQueryMyAllRecruitmentsVO( + recruitmentEntity.id, + list(codeEntity), + recruitAreaEntity.hiredCount, + recruitmentEntity.createdAt + ) + ) + ).stream().map(MyAllRecruitmentsVO.class::cast) + .toList(); + } + //===conditions===// private BooleanExpression eqYear(Integer year) { diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java index fdda4620a..24c708f0e 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/entity/RecruitmentEntity.java @@ -64,6 +64,10 @@ public class RecruitmentEntity extends BaseTimeEntity { @Column(columnDefinition = "VARCHAR(100)") private String workingHours; + @NotNull + @Column(columnDefinition = "TINYINT(1)") + private boolean flexibleWorking; + @Column(columnDefinition = "VARCHAR(550)") private String benefits; @@ -105,10 +109,11 @@ public class RecruitmentEntity extends BaseTimeEntity { public RecruitmentEntity(Long id, int recruitYear, RecruitStatus status, String workingHours, Integer trainPay, String pay, String submitDocument, LocalDate startDate, LocalDate endDate, CompanyEntity companyEntity, String benefits, boolean militarySupport, List requiredLicenses, String etc, - List hiringProgress, Integer requiredGrade, + List hiringProgress, Integer requiredGrade, boolean flexibleWorking, boolean personalContact, boolean winterIntern) { this.id = id; this.workingHours = workingHours; + this.flexibleWorking = flexibleWorking; this.hiringProgress = hiringProgress; this.submitDocument = submitDocument; this.requiredGrade = requiredGrade; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java index e4d4f6d44..888a039f3 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/mapper/RecruitmentMapper.java @@ -39,11 +39,19 @@ public RecruitmentEntity toEntity(Recruitment domain) { .trainPay(domain.getSalary().trainingPay()) .submitDocument(domain.getSubmitDocument()) .workingHours(domain.getWorkingHours()) + .flexibleWorking(domain.isFlexibleWorking()) .winterIntern(domain.isWinterIntern()) .build(); } public Recruitment toDomain(RecruitmentEntity entity) { + RecruitingPeriod recruitingPeriod = null; + if (entity.getRecruitDate() != null) { + recruitingPeriod = new RecruitingPeriod( + entity.getRecruitDate().getStartDate(), + entity.getRecruitDate().getFinishDate() + ); + } return Recruitment.builder() .id(entity.getId()) .companyId(entity.getCompany().getId()) @@ -54,15 +62,13 @@ public Recruitment toDomain(RecruitmentEntity entity) { .personalContract(entity.isPersonalContact()) .militarySupport(entity.isMilitarySupport()) .status(entity.getStatus()) - .recruitingPeriod(new RecruitingPeriod( - entity.getRecruitDate().getStartDate(), - entity.getRecruitDate().getFinishDate() - )) + .recruitingPeriod(recruitingPeriod) .salary(new Salary( entity.getPayInfo().getTrainPay(), entity.getPayInfo().getPay() )) .workingHours(entity.getWorkingHours()) + .flexibleWorking(entity.isFlexibleWorking()) .requiredGrade(entity.getRequiredGrade()) .requiredLicenses(entity.getRequiredLicenses()) .submitDocument(entity.getSubmitDocument()) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryMyAllRecruitmentsVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryMyAllRecruitmentsVO.java new file mode 100644 index 000000000..61c84b1c6 --- /dev/null +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryMyAllRecruitmentsVO.java @@ -0,0 +1,21 @@ +package team.retum.jobis.domain.recruitment.persistence.repository.vo; + +import com.querydsl.core.annotations.QueryProjection; +import lombok.Getter; +import lombok.NoArgsConstructor; +import team.retum.jobis.domain.code.persistence.entity.CodeEntity; +import team.retum.jobis.domain.recruitment.spi.vo.MyAllRecruitmentsVO; +import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentAreaElement; + +import java.time.LocalDateTime; +import java.util.List; + +@Getter +@NoArgsConstructor +public class QueryMyAllRecruitmentsVO extends MyAllRecruitmentsVO { + + @QueryProjection + public QueryMyAllRecruitmentsVO(Long id, List codes, int hiredCount, LocalDateTime createdAt) { + super(id, new RecruitmentAreaElement(codes.stream().map(CodeEntity::getKeyword).toList(), hiredCount), createdAt); + } +} diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentDetailVO.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentDetailVO.java index 2eafc1f32..cc5036648 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentDetailVO.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/repository/vo/QueryRecruitmentDetailVO.java @@ -5,19 +5,18 @@ import team.retum.jobis.domain.recruitment.spi.vo.RecruitmentDetailVO; import java.time.LocalDate; -import java.time.LocalTime; import java.util.List; public class QueryRecruitmentDetailVO extends RecruitmentDetailVO { @QueryProjection public QueryRecruitmentDetailVO(Long recruitmentId, Long companyId, String companyProfileUrl, String companyName, - Integer requiredGrade, String workingHours, List requiredLicenses, + Integer requiredGrade, String workingHours, boolean flexibleWorking, List requiredLicenses, List hiringProgress, Integer trainPay, String pay, String benefits, Boolean military, String submitDocument, LocalDate startDate, LocalDate endDate, String etc, String companyBizNo, boolean winterIntern, boolean isBookmarked) { super(recruitmentId, companyId, companyProfileUrl, companyName, - requiredGrade, workingHours, requiredLicenses, + requiredGrade, workingHours, flexibleWorking, requiredLicenses, hiringProgress, trainPay, pay, benefits, military, submitDocument, startDate, endDate, etc, companyBizNo, winterIntern, isBookmarked); } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/type/RecruitDate.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/type/RecruitDate.java index 8859a066e..768d5feaf 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/type/RecruitDate.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/persistence/type/RecruitDate.java @@ -15,23 +15,14 @@ @Embeddable public class RecruitDate { - @NotNull @Column(columnDefinition = "DATE") private LocalDate startDate; - @NotNull @Column(columnDefinition = "DATE") private LocalDate finishDate; public RecruitDate(LocalDate startDate, LocalDate finishDate) { - validateDateRage(startDate, finishDate); this.startDate = startDate; this.finishDate = finishDate; } - - private void validateDateRage(LocalDate start, LocalDate end) { - if (start.isAfter(end)) { - throw InvalidDateException.EXCEPTION; - } - } } diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java index 628f4f581..31e8e633e 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/RecruitmentWebAdapter.java @@ -22,6 +22,7 @@ import team.retum.jobis.common.dto.response.TotalPageCountResponse; import team.retum.jobis.common.util.StringUtil; import team.retum.jobis.domain.recruitment.dto.response.QueryMyRecruitmentResponse; +import team.retum.jobis.domain.recruitment.dto.response.QueryMyRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.QueryRecruitmentDetailResponse; import team.retum.jobis.domain.recruitment.dto.response.StudentQueryRecruitmentsResponse; import team.retum.jobis.domain.recruitment.dto.response.TeacherQueryRecruitmentsResponse; @@ -35,6 +36,7 @@ import team.retum.jobis.domain.recruitment.usecase.DeleteRecruitAreaUseCase; import team.retum.jobis.domain.recruitment.usecase.DeleteRecruitmentUseCase; import team.retum.jobis.domain.recruitment.usecase.QueryMyRecruitmentUseCase; +import team.retum.jobis.domain.recruitment.usecase.QueryMyRecruitmentsUseCase; import team.retum.jobis.domain.recruitment.usecase.QueryRecruitmentDetailUseCase; import team.retum.jobis.domain.recruitment.usecase.StudentQueryRecruitmentsUseCase; import team.retum.jobis.domain.recruitment.usecase.TeacherChangeRecruitmentStatusUseCase; @@ -67,6 +69,7 @@ public class RecruitmentWebAdapter { private final QueryMyRecruitmentUseCase queryMyRecruitmentUseCase; private final DeleteRecruitmentUseCase deleteRecruitmentUseCase; private final DeleteRecruitAreaUseCase deleteRecruitAreaUseCase; + private final QueryMyRecruitmentsUseCase queryMyRecruitmentsUseCase; @CacheEvict(allEntries = true) @ResponseStatus(HttpStatus.CREATED) @@ -179,7 +182,7 @@ public QueryRecruitmentDetailResponse queryRecruitmentDetail( return queryRecruitmentDetailUseCase.execute(recruitmentId); } - @GetMapping("/my") + @GetMapping("/my/recent") public QueryMyRecruitmentResponse queryMyRecruitment() { return queryMyRecruitmentUseCase.execute(); } @@ -198,6 +201,11 @@ public void deleteRecruitArea(@PathVariable("recruit-area-id") Long recruitAreaI deleteRecruitAreaUseCase.execute(recruitAreaId); } + @GetMapping("/my") + public QueryMyRecruitmentsResponse getAllMyRecruitments() { + return queryMyRecruitmentsUseCase.execute(); + } + private List parseCodes(String jobCode, String techCodes) { List codes = new ArrayList<>(StringUtil.divideString(techCodes, ",")); if (jobCode != null && !jobCode.isBlank()) codes.add(jobCode); diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java index 19a406cca..ce643d944 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/ApplyRecruitmentWebRequest.java @@ -9,10 +9,11 @@ import team.retum.jobis.domain.recruitment.dto.request.ApplyRecruitmentRequest; import team.retum.jobis.domain.recruitment.model.ProgressType; import team.retum.jobis.global.annotation.ValidListElements; +import team.retum.jobis.global.exception.BadRequestException; import java.time.LocalDate; -import java.time.LocalTime; import java.util.List; +import java.util.regex.Pattern; @Getter @NoArgsConstructor @@ -27,13 +28,16 @@ public class ApplyRecruitmentWebRequest { @NotBlank private String workingHours; + @NotNull + private Boolean flexibleWorking; + private List<@NotNull String> requiredLicenses; @ValidListElements private List hiringProgress; @NotNull - private int trainPay; + private Integer trainPay; private String pay; @@ -41,10 +45,10 @@ public class ApplyRecruitmentWebRequest { private String benefits; @NotNull - private boolean militarySupport; + private Boolean militarySupport; @NotNull - private boolean personalContact; + private Boolean personalContact; @Size(max = 100) @NotNull @@ -55,17 +59,18 @@ public class ApplyRecruitmentWebRequest { private LocalDate endDate; @NotNull - private boolean winterIntern; + private Boolean winterIntern; @Size(max = 350) private String etc; public ApplyRecruitmentRequest toDomainRequest() { + if (!flexibleWorking && !Pattern.matches("^([01][0-9]|2[0-3]):([0-5][0-9]) ~ ([01][0-9]|2[0-3]):([0-5][0-9])$", workingHours)) { + throw BadRequestException.EXCEPTION; + } + return ApplyRecruitmentRequest.builder() - .areas( - this.areas.stream() - .map(RecruitAreaWebRequest::toDomainRequest).toList() - ) + .areas(this.areas.stream().map(RecruitAreaWebRequest::toDomainRequest).toList()) .requiredGrade(this.requiredGrade) .workingHours(this.workingHours) .requiredLicenses(this.requiredLicenses) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/RecruitAreaWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/RecruitAreaWebRequest.java index e3377563f..1f1b0a714 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/RecruitAreaWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/RecruitAreaWebRequest.java @@ -19,7 +19,7 @@ public class RecruitAreaWebRequest { private List techCodes; @NotNull - private int hiring; + private Integer hiring; @Size(max = 3500) @NotBlank diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/UpdateRecruitmentWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/UpdateRecruitmentWebRequest.java index 51b12f1c1..fad34dafa 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/UpdateRecruitmentWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/recruitment/presentation/dto/request/UpdateRecruitmentWebRequest.java @@ -20,13 +20,16 @@ public class UpdateRecruitmentWebRequest { @NotNull private String workingHours; + @NotNull + private Boolean flexibleWorking; + private List requiredLicenses; @NotNull private List hiringProgress; @NotNull - private int trainPay; + private Integer trainPay; private String pay; @@ -34,16 +37,14 @@ public class UpdateRecruitmentWebRequest { private String benefits; @NotNull - private boolean military; + private Boolean military; @Size(max = 100) @NotNull private String submitDocument; - @NotNull private LocalDate startDate; - @NotNull private LocalDate endDate; @Size(max = 350) @@ -53,6 +54,7 @@ public UpdateRecruitmentRequest toDomainRequest() { return UpdateRecruitmentRequest.builder() .requiredGrade(this.requiredGrade) .workingHours(this.workingHours) + .flexibleWorking(this.flexibleWorking) .requiredLicenses(this.requiredLicenses) .hiringProgress(this.hiringProgress) .trainPay(this.trainPay) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/StudentSignUpWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/StudentSignUpWebRequest.java index 35e5b2f8b..4db93073a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/StudentSignUpWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/student/presentation/dto/request/StudentSignUpWebRequest.java @@ -1,5 +1,6 @@ package team.retum.jobis.domain.student.presentation.dto.request; +import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; @@ -23,17 +24,17 @@ public class StudentSignUpWebRequest { private String password; @NotNull - private int grade; + private Integer grade; @Size(max = 10) @NotBlank private String name; @NotNull - private int classRoom; + private Integer classRoom; @NotNull - private int number; + private Integer number; @NotNull private Gender gender; diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityAdapter.java b/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityAdapter.java index 5f5ebd6e2..09ef16dcb 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityAdapter.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityAdapter.java @@ -12,7 +12,6 @@ import team.retum.jobis.domain.company.persistence.mapper.CompanyMapper; import team.retum.jobis.domain.student.model.Student; import team.retum.jobis.domain.student.persistence.mapper.StudentMapper; -import team.retum.jobis.domain.teacher.model.Teacher; import team.retum.jobis.domain.teacher.persistence.mapper.TeacherMapper; import team.retum.jobis.domain.user.model.User; import team.retum.jobis.domain.user.persistence.mapper.UserMapper; @@ -20,20 +19,19 @@ import team.retum.jobis.global.exception.InvalidTokenException; import team.retum.jobis.global.security.auth.company.CompanyDetails; import team.retum.jobis.global.security.auth.student.StudentDetails; -import team.retum.jobis.global.security.auth.teacher.TeacherDetails; @RequiredArgsConstructor @Component public class SecurityAdapter implements SecurityPort { - @Value("${auth-code}") - private String authCode; private final PasswordEncoder passwordEncoder; private final CompanyMapper companyMapper; private final StudentMapper studentMapper; private final TeacherMapper teacherMapper; private final UserMapper userMapper; private final UserJpaRepository userJpaRepository; + @Value("${auth-code}") + private String authCode; @Override public Long getCurrentUserId() { diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityConfig.java b/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityConfig.java index 3081235d2..297c0480a 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityConfig.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/global/security/SecurityConfig.java @@ -47,17 +47,18 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // recruitments .requestMatchers(HttpMethod.POST, "/recruitments").hasAnyAuthority(COMPANY.name()) .requestMatchers(HttpMethod.GET, "/recruitments/my").hasAuthority(COMPANY.name()) - .requestMatchers(HttpMethod.PATCH, "/recruitments/{recruitment-id}").hasAnyAuthority(TEACHER.name()) - .requestMatchers(HttpMethod.PATCH, "/recruitments/area/{recruit-area-id}").hasAnyAuthority(TEACHER.name()) - .requestMatchers(HttpMethod.POST, "/recruitments/{recruitment-id}/area").hasAnyAuthority(TEACHER.name()) + .requestMatchers(HttpMethod.GET, "/recruitments/my/recent").hasAuthority(COMPANY.name()) + .requestMatchers(HttpMethod.PATCH, "/recruitments/{recruitment-id}").hasAnyAuthority(TEACHER.name(), COMPANY.name()) + .requestMatchers(HttpMethod.PATCH, "/recruitments/area/{recruit-area-id}").hasAnyAuthority(TEACHER.name(), COMPANY.name()) + .requestMatchers(HttpMethod.POST, "/recruitments/{recruitment-id}/area").hasAnyAuthority(TEACHER.name(), COMPANY.name()) .requestMatchers(HttpMethod.GET, "/recruitments/student").hasAnyAuthority(STUDENT.name(), DEVELOPER.name()) .requestMatchers(HttpMethod.GET, "/recruitments/student/count").hasAnyAuthority(STUDENT.name(), DEVELOPER.name()) - .requestMatchers(HttpMethod.GET, "/recruitments/{recruitment-id}").hasAnyAuthority(STUDENT.name(), TEACHER.name()) + .requestMatchers(HttpMethod.GET, "/recruitments/{recruitment-id}").hasAnyAuthority(STUDENT.name(), TEACHER.name(), COMPANY.name()) .requestMatchers(HttpMethod.GET, "/recruitments/teacher").hasAuthority(TEACHER.name()) .requestMatchers(HttpMethod.GET, "/recruitments/teacher/count").hasAuthority(TEACHER.name()) .requestMatchers(HttpMethod.PATCH, "/recruitments/status").hasAuthority(TEACHER.name()) .requestMatchers(HttpMethod.DELETE, "/recruitments/{recruitment-id}").hasAnyAuthority(COMPANY.name(), TEACHER.name()) - .requestMatchers(HttpMethod.DELETE, "/recruitments/area/{recruit-area-id}").hasAnyAuthority(TEACHER.name()) + .requestMatchers(HttpMethod.DELETE, "/recruitments/area/{recruit-area-id}").hasAnyAuthority(TEACHER.name(), COMPANY.name()) // bugs .requestMatchers(HttpMethod.GET, "/bugs").hasAuthority(DEVELOPER.name()) @@ -149,7 +150,8 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .requestMatchers(HttpMethod.POST, "/notices").hasAuthority(TEACHER.name()) .requestMatchers(HttpMethod.PATCH, "/notices/{notice-id}").hasAuthority(TEACHER.name()) .requestMatchers(HttpMethod.DELETE, "/notices/{notice-id}").hasAuthority(TEACHER.name()) - .requestMatchers(HttpMethod.GET, "/notices/{notice-id}").permitAll() + .requestMatchers(HttpMethod.GET, "/notices").hasAnyAuthority(STUDENT.name(), TEACHER.name()) + .requestMatchers(HttpMethod.GET, "/notices/{notice-id}").hasAnyAuthority(STUDENT.name(), TEACHER.name()) // notification .requestMatchers(HttpMethod.GET, "/notifications").authenticated() diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/thirdparty/fcm/FirebaseConfig.java b/jobis-infrastructure/src/main/java/team/retum/jobis/thirdparty/fcm/FirebaseConfig.java index 4088eaa1d..3a7ad862f 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/thirdparty/fcm/FirebaseConfig.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/thirdparty/fcm/FirebaseConfig.java @@ -3,12 +3,15 @@ import com.google.auth.oauth2.GoogleCredentials; import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import team.retum.jobis.global.util.LogUtil; import javax.annotation.PostConstruct; import java.io.FileInputStream; +@Slf4j @Configuration public class FirebaseConfig { @@ -17,15 +20,14 @@ public class FirebaseConfig { @PostConstruct public void init() { - try { - FileInputStream account = new FileInputStream(path); + try (FileInputStream account = new FileInputStream(path)) { FirebaseOptions options = FirebaseOptions.builder() .setCredentials(GoogleCredentials.fromStream(account)) .build(); FirebaseApp.initializeApp(options); } catch (Exception e) { - e.printStackTrace(); + log.error(LogUtil.stackTraceToString(e)); } } } diff --git a/jobis-infrastructure/src/main/resources/application.yml b/jobis-infrastructure/src/main/resources/application.yml index e116c9915..72330a351 100644 --- a/jobis-infrastructure/src/main/resources/application.yml +++ b/jobis-infrastructure/src/main/resources/application.yml @@ -6,6 +6,7 @@ spring: password: ${DB_PASSWORD:11111111} flyway: baseline-on-migrate: true + baseline-version: 0 jpa: database-platform: team.retum.jobis.global.config.MysqlDialectConfig diff --git a/jobis-infrastructure/src/main/resources/db/migration/V2__modify_recruitment.sql b/jobis-infrastructure/src/main/resources/db/migration/V2__modify_recruitment.sql new file mode 100644 index 000000000..d5310a456 --- /dev/null +++ b/jobis-infrastructure/src/main/resources/db/migration/V2__modify_recruitment.sql @@ -0,0 +1 @@ +alter table tbl_recruitment add flexible_working tinyint(1) not null; \ No newline at end of file diff --git a/jobis-infrastructure/src/main/resources/db/migration/V3__modify_recruitment.sql b/jobis-infrastructure/src/main/resources/db/migration/V3__modify_recruitment.sql new file mode 100644 index 000000000..fef1f92f3 --- /dev/null +++ b/jobis-infrastructure/src/main/resources/db/migration/V3__modify_recruitment.sql @@ -0,0 +1,2 @@ +alter table tbl_recruitment modify start_date date null; +alter table tbl_recruitment modify finish_date date null; \ No newline at end of file