-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REFACTOR] 일급컬렉션 사용 및 테스트 코드 전반 수정 (#355)
* [FIX] 테스트 코드 수정(토큰 변경, 빠진 로직 추가) * [REFACTOR] List 객체 일급컬렉션 사용
- Loading branch information
Showing
12 changed files
with
109 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...nk/meeteam/domain/recruitment/recruitment_applicant/service/vo/RecruitmentApplicants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package synk.meeteam.domain.recruitment.recruitment_applicant.service.vo; | ||
|
||
import static synk.meeteam.domain.recruitment.recruitment_applicant.exception.RecruitmentApplicantExceptionType.INVALID_REQUEST; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
import synk.meeteam.domain.recruitment.recruitment_applicant.entity.RecruitmentApplicant; | ||
import synk.meeteam.domain.recruitment.recruitment_applicant.exception.RecruitmentApplicantException; | ||
|
||
public class RecruitmentApplicants { | ||
private final List<RecruitmentApplicant> recruitmentApplicants; | ||
|
||
public RecruitmentApplicants(List<RecruitmentApplicant> recruitmentApplicants, List<Long> requestApplicantIds, | ||
Long writerId) { | ||
validateApplicants(recruitmentApplicants, requestApplicantIds); | ||
validateCanProcess(recruitmentApplicants, writerId); | ||
this.recruitmentApplicants = recruitmentApplicants; | ||
} | ||
|
||
public List<Long> getRecruitmentApplicantIds() { | ||
return recruitmentApplicants.stream() | ||
.map(RecruitmentApplicant::getId) | ||
.toList(); | ||
} | ||
|
||
private void validateApplicants(List<RecruitmentApplicant> recruitmentApplicants, List<Long> requestApplicantIds) { | ||
if (recruitmentApplicants.size() != requestApplicantIds.size()) { | ||
throw new RecruitmentApplicantException(INVALID_REQUEST); | ||
} | ||
|
||
List<Long> actualApplicantIds = recruitmentApplicants.stream() | ||
.map(RecruitmentApplicant::getId) | ||
.toList(); | ||
|
||
for (Long id : requestApplicantIds) { | ||
if (!actualApplicantIds.contains(id)) { | ||
throw new RecruitmentApplicantException(INVALID_REQUEST); | ||
} | ||
} | ||
} | ||
|
||
private void validateCanProcess(List<RecruitmentApplicant> applicants, Long userId) { | ||
// applicants 검증로직 | ||
// 호출한 사용자가 구인글 작성자인지 확인 | ||
// status가 다 NONE인지 확인 | ||
|
||
applicants.stream() | ||
.forEach(applicant -> applicant.validateCanApprove(userId)); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters