diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruit/controller/RecruitController.java b/src/main/java/com/ssafy/ssafsound/domain/recruit/controller/RecruitController.java index d728f44a..3f1ee7bb 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruit/controller/RecruitController.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruit/controller/RecruitController.java @@ -81,7 +81,7 @@ public EnvelopeResponse getMemberJoinedRecruits(GetMemberJoi @GetMapping("/applied") public EnvelopeResponse getMemberAppliedRecruits(GetMemberAppliedRecruitsReqDto recruitsReqDto, @Authentication AuthenticatedMember memberInfo) { return EnvelopeResponse.builder() - .data(recruitService.getMemberAppliedRecruits(recruitsReqDto, 1L)) + .data(recruitService.getMemberAppliedRecruits(recruitsReqDto, memberInfo.getMemberId())) .build(); } } diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruit/dto/PostRecruitReqDto.java b/src/main/java/com/ssafy/ssafsound/domain/recruit/dto/PostRecruitReqDto.java index f96a655c..0d7342ea 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruit/dto/PostRecruitReqDto.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruit/dto/PostRecruitReqDto.java @@ -18,6 +18,8 @@ import java.util.List; import java.util.stream.Collectors; +import org.springframework.util.StringUtils; + @Getter @NoArgsConstructor @AllArgsConstructor @@ -68,7 +70,9 @@ public Recruit to() { private void setRecruitQuestions (Recruit recruit) { if(questions == null) return; - List recruitQuestions = questions.stream().map((question)-> RecruitQuestion.builder() + List recruitQuestions = questions.stream() + .filter(StringUtils::hasText) + .map((question)-> RecruitQuestion.builder() .recruit(recruit) .content(question) .build() diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java b/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java index dd4de2fd..d815ee2e 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruit/repository/RecruitDynamicQueryRepositoryImpl.java @@ -77,7 +77,7 @@ public Slice findRecruitByGetRecruitsReqDto(GetRecruitsReqDto dto, Page // recruit types limitation List recruitTypes = dto.getRecruitTypes(); - if(dto.getCategory().toUpperCase().equals(Category.PROJECT.name()) && recruitTypes!=null && !recruitTypes.isEmpty()) { + if(dto.getCategory() != null && dto.getCategory().toUpperCase().equals(Category.PROJECT.name()) && recruitTypes!=null && !recruitTypes.isEmpty()) { String metaDataType = MetaDataType.RECRUIT_TYPE.name(); List containRecruitTypes = recruitTypes.stream() .map(recruitType->metaDataConsumer.getMetaData(metaDataType, recruitType)) diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruit/service/RecruitService.java b/src/main/java/com/ssafy/ssafsound/domain/recruit/service/RecruitService.java index e276bc79..1cb4baa5 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruit/service/RecruitService.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruit/service/RecruitService.java @@ -161,7 +161,8 @@ public void expiredRecruit(Long recruitId, Long memberId) { public GetRecruitsResDto getMemberJoinRecruits(GetMemberJoinRecruitsReqDto recruitsReqDto, Long loginMemberId) { Long memberId = recruitsReqDto.getMemberId(); Member member = memberRepository.findById(memberId).orElseThrow(()->new ResourceNotFoundException(GlobalErrorInfo.NOT_FOUND)); - if(!member.getPublicProfile()) { + + if(!memberId.equals(loginMemberId) && !member.getPublicProfile()) { throw new MemberException(MemberErrorInfo.MEMBER_PROFILE_SECRET); } diff --git a/src/main/java/com/ssafy/ssafsound/domain/recruitapplication/service/RecruitApplicationService.java b/src/main/java/com/ssafy/ssafsound/domain/recruitapplication/service/RecruitApplicationService.java index 992b6ff5..47d3f922 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/recruitapplication/service/RecruitApplicationService.java +++ b/src/main/java/com/ssafy/ssafsound/domain/recruitapplication/service/RecruitApplicationService.java @@ -66,7 +66,10 @@ public PatchRecruitApplicationStatusResDto saveRecruitApplication(Long recruitId metaDataConsumer.getMetaData(MetaDataType.RECRUIT_TYPE.name(), recruitType)); List participantAnswers = makeRecruitQuestionReplies(postRecruitApplicationReqDto, recruit, recruitApplication); recruitApplicationRepository.save(recruitApplication); - recruitQuestionReplyRepository.saveAll(participantAnswers); + + if(participantAnswers.size() != 0) { + recruitQuestionReplyRepository.saveAll(participantAnswers); + } return new PatchRecruitApplicationStatusResDto(recruitApplication.getId(), MatchStatus.PENDING.name()); } @@ -211,7 +214,7 @@ private List makeRecruitQuestionReplies(PostRecruitApplic List answers = dto.getContents(); int len = recruitQuestion.size(); - if(answers.size() != len) { + if(len!=0 && answers.size() != len) { throw new RecruitException(RecruitErrorInfo.NOT_SAME_LENGTH_RECRUIT_QUESTION_ANSWER); } @@ -224,7 +227,7 @@ private List makeRecruitQuestionReplies(PostRecruitApplic RecruitQuestionReply.builder() .application(recruitApplication) .question(recruitQuestion.get(i)) - .content(dto.getContents().get(i)) + .content(answers.get(i)) .build() ); }