Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] post에 recruiting이 안붙어있어도 오류가 안뜨게 수정 #49

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/main/java/com/likelion/innerjoin/post/service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,18 @@ public PostDetailResponseDTO getPostById(Long postId) {

// Recruiting 엔티티 조회
List<Recruiting> recruitingList = recruitingRepository.findByPostId(postId);
if (recruitingList == null || recruitingList.isEmpty()) {
throw new RecruitingNotFoundException("Recruiting not found with post_id: " + postId);
List<PostDetailResponseDTO.RecruitingDTO> recruitingDTOList = null;
if (!(recruitingList == null) && !recruitingList.isEmpty()) {
// Recruiting 리스트를 변환
recruitingDTOList = recruitingList.stream()
.map(recruiting -> PostDetailResponseDTO.RecruitingDTO.builder()
.recruitingId(recruiting.getId())
.formId(recruiting.getForm().getId())
.jobTitle(recruiting.getJobTitle())
.build())
.collect(Collectors.toList());
}

// Recruiting 리스트를 변환
List<PostDetailResponseDTO.RecruitingDTO> recruitingDTOList = recruitingList.stream()
.map(recruiting -> PostDetailResponseDTO.RecruitingDTO.builder()
.recruitingId(recruiting.getId())
.formId(recruiting.getForm().getId())
.jobTitle(recruiting.getJobTitle())
.build())
.collect(Collectors.toList());

// D-Day 계산
int dDay = calculateDDay(post.getEndTime());

Expand Down
Loading