Skip to content

Commit

Permalink
πŸš€ :: 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tedsoftj1123 committed Mar 14, 2024
2 parents 8d6d660 + 5832b91 commit 6289826
Show file tree
Hide file tree
Showing 63 changed files with 444 additions and 108 deletions.
6 changes: 3 additions & 3 deletions jobis-application/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.bytebuddy.utility.RandomString;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -24,15 +23,4 @@ public static List<String> 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);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,4 +33,12 @@ public Code changeAccessible(boolean isPublic) {
.isPublic(isPublic)
.build();
}

public static Map<CodeType, List<Long>> combineCodesWithType(List<Long> jobCode, List<Long> techCode) {
Map<CodeType, List<Long>> codeIds = new HashMap<>();
codeIds.put(JOB, jobCode);
codeIds.put(TECH, techCode);

return codeIds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import lombok.Builder;

import java.util.List;

@Builder
public record UpdateCompanyDetailsRequest(
String companyIntroduce,
Expand All @@ -21,6 +23,9 @@ public record UpdateCompanyDetailsRequest(
double take,
String companyProfileUrl,
String serviceName,
String representativePhoneNo
String representativePhoneNo,
Long businessAreaCode,
String bizRegistrationUrl,
List<String> attachmentUrls
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import team.retum.jobis.domain.company.model.CompanyType;

import java.time.LocalDate;
import java.util.List;

@Getter
@Builder
Expand All @@ -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;
Expand All @@ -35,6 +37,7 @@ public class CompanyMyPageResponse {
private final String serviceName;
private final String businessArea;
private final String bizRegistrationUrl;
private final List<String> attachmentUrls;

public static CompanyMyPageResponse from(Company company) {
return CompanyMyPageResponse.builder()
Expand All @@ -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())
Expand All @@ -63,6 +67,7 @@ public static CompanyMyPageResponse from(Company company) {
.serviceName(company.getServiceName())
.businessArea(company.getBusinessArea())
.bizRegistrationUrl(company.getBizRegistrationUrl())
.attachmentUrls(company.getAttachmentUrls())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Company {
private final AddressInfo addressInfo;

private final String representative;

private final String representativePhoneNo;

private final LocalDate foundedAt;
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()));
}
}
Original file line number Diff line number Diff line change
@@ -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<NoticeVO> notices;

}
Original file line number Diff line number Diff line change
@@ -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<Notice> queryNoticeById(Long noticeId);

List<NoticeVO> queryNotices();

}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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<NoticeVO> noticeVOs = queryNoticePort.queryNotices();

return new QueryNoticesResponse(noticeVOs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public record ApplyRecruitmentRequest(
List<CreateRecruitAreaRequest> areas,
Integer requiredGrade,
String workingHours,
boolean flexibleWorking,
List<String> requiredLicenses,
List<ProgressType> hiringProgress,
int trainPay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public record UpdateRecruitmentRequest(
Integer requiredGrade,
String workingHours,
boolean flexibleWorking,
List<String> requiredLicenses,
List<ProgressType> hiringProgress,
Integer trainPay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class QueryMyRecruitmentResponse {
private final List<RecruitAreaResponse> areas;
private final Integer requiredGrade;
private final String workingHours;
private final boolean flexibleWorking;
private final List<String> requiredLicenses;
private final List<ProgressType> hiringProgress;
private final Integer trainPay;
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
@@ -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<MyAllRecruitmentsVO> myRecruitments;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class QueryRecruitmentDetailResponse {
private final List<RecruitAreaResponse> areas;
private final Integer requiredGrade;
private final String workingHours;
private final boolean flexibleWorking;
private final List<String> requiredLicenses;
private final List<ProgressType> hiringProgress;
private final Integer trainPay;
Expand All @@ -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())
Expand Down
Loading

0 comments on commit 6289826

Please sign in to comment.