Skip to content

Commit

Permalink
[LAS-67] feat: 모집글 상세에서 회원의 신청 상태 여부 체크를 위한 서비스 레이어 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongho0805 committed Jul 2, 2023
1 parent e7a6a30 commit 7f0f873
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.lastone.apiserver.service.recruitment;

import com.lastone.core.dto.recruitment.RecruitmentRequestDto;
import com.lastone.core.dto.recruitment.RecruitmentDetailDto;
import com.lastone.core.dto.recruitment.RecruitmentListDto;
import com.lastone.core.dto.recruitment.RecruitmentSearchCondition;
import com.lastone.core.dto.recruitment.*;
import org.springframework.data.domain.Slice;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
Expand All @@ -22,4 +19,6 @@ public interface RecruitmentService {
void updateRecruitment(Long recruitmentId, Long memberId, RecruitmentRequestDto recruitment, List<MultipartFile> imgFiles) throws IOException;

void deleteRecruitment(Long recruitmentId, Long id);

RecruitmentApplyStatusForMember isAlreadyApplyRecruitment(Long recruitmentId, Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import com.lastone.core.domain.recruitment.Recruitment;
import com.lastone.core.domain.recruitment_img.RecruitmentImg;
import com.lastone.core.dto.gym.GymDto;
import com.lastone.core.dto.recruitment.RecruitmentDetailDto;
import com.lastone.core.dto.recruitment.RecruitmentListDto;
import com.lastone.core.dto.recruitment.RecruitmentRequestDto;
import com.lastone.core.dto.recruitment.RecruitmentSearchCondition;
import com.lastone.core.dto.recruitment.*;
import com.lastone.core.util.mapper.GymMapper;
import com.lastone.core.repository.gym.GymRepository;
import com.lastone.core.repository.member.MemberRepository;
Expand Down Expand Up @@ -113,6 +110,14 @@ public void deleteRecruitment(Long recruitmentId, Long memberId) {
recruitment.delete();
}

@Override
public RecruitmentApplyStatusForMember isAlreadyApplyRecruitment(Long recruitmentId, Long memberId) {
Recruitment recruitment = recruitmentRepository.findById(recruitmentId).orElseThrow(RecruitmentNotFoundException::new);
boolean result = recruitment.getApplications().stream()
.anyMatch(application -> application.getApplicant().getId().equals(memberId));
return new RecruitmentApplyStatusForMember(result);
}

private void updateImgFiles(Recruitment recruitment, List<MultipartFile> imgFiles) throws IOException {
if (imgFileIsExist(imgFiles)) {
return;
Expand Down

0 comments on commit 7f0f873

Please sign in to comment.