Skip to content

Commit

Permalink
[LAS-56] fix: 모집글 상세 조회시 모집글 없을 경우 예외 처리 관련 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongho0805 committed Jun 26, 2023
1 parent e367b3f commit d5df2ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public Slice<RecruitmentListDto> getList(RecruitmentSearchCondition searchCondit

@Override
public RecruitmentDetailDto getDetail(Long recruitmentId) {
RecruitmentDetailDto recruitmentDetailDto = recruitmentRepository.getDetailDto(recruitmentId).orElseThrow(RecruitmentNotFoundException::new);
Recruitment recruitment = recruitmentRepository.getDetail(recruitmentId).orElseThrow(RecruitmentNotFoundException::new);
RecruitmentDetailDto recruitmentDetailDto = RecruitmentDetailDto.toDto(recruitment);
recruitmentDetailDto.setSbdDto(sbdRepository.findLatestRecordByMemberId(recruitmentDetailDto.getMemberId()));
return recruitmentDetailDto;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.lastone.core.repository.recruitment;

import com.lastone.core.domain.recruitment.Recruitment;
import com.lastone.core.dto.recruitment.RecruitmentDetailDto;
import com.lastone.core.dto.recruitment.RecruitmentListDto;
import com.lastone.core.dto.recruitment.RecruitmentSearchCondition;
import org.springframework.data.domain.Slice;
Expand All @@ -12,7 +11,7 @@ public interface RecruitmentRepositoryCustom {

Slice<RecruitmentListDto> getListDto(RecruitmentSearchCondition searchCondition);

Optional<RecruitmentDetailDto> getDetailDto(Long recruitmentId);
Optional<Recruitment> getDetail(Long recruitmentId);

List<RecruitmentListDto> getListDtoInMainPage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class RecruitmentRepositoryImpl implements RecruitmentRepositoryCustom{
private static final int DEFAULT_MAIN_PAGE_SIZE = 9;

@Override
public Optional<RecruitmentDetailDto> getDetailDto(Long recruitmentId) {
public Optional<Recruitment> getDetail(Long recruitmentId) {

Recruitment findRecruitment = queryFactory
.selectFrom(recruitment)
Expand All @@ -48,7 +48,7 @@ public Optional<RecruitmentDetailDto> getDetailDto(Long recruitmentId) {
)
.fetchOne();

return Optional.of(RecruitmentDetailDto.toDto(findRecruitment));
return Optional.ofNullable(findRecruitment);
}

@Override
Expand Down

0 comments on commit d5df2ba

Please sign in to comment.