diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/ApplyRes.java b/src/main/java/com/gongjakso/server/domain/apply/dto/ApplyRes.java index 721f417d..1ca7be2c 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/ApplyRes.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/ApplyRes.java @@ -11,9 +11,11 @@ public record ApplyRes( LocalDateTime finishDate, Long max_person, int current_person, - Boolean postType + Boolean postType, + List category, + List stackName ) { - public static ApplyRes of(Post post, int current_person){ - return new ApplyRes(post.getTitle(),post.getStartDate(),post.getFinishDate(),post.getMaxPerson(),current_person,post.isPostType()); + public static ApplyRes of(Post post, int current_person, List category, List stackName){ + return new ApplyRes(post.getTitle(),post.getStartDate(),post.getFinishDate(),post.getMaxPerson(),current_person,post.isPostType(), category, stackName); } } diff --git a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java index 3386ea67..a0cdbd73 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java +++ b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java @@ -63,7 +63,25 @@ public ApplyRes findApply(Long post_id){ throw new ApplicationException(ErrorCode.NOT_FOUND_POST_EXCEPTION); }else{ int current_person = (int) applyRepository.countApplyByPost(post); - ApplyRes applyRes = ApplyRes.of(post,current_person); + List categoryList = categoryRepository.findCategoryByPost(post); + List list = new ArrayList<>(); + if(categoryList!=null) { + for (Category category : categoryList) { + list.add(String.valueOf(category.getCategoryType())); + } + }else { + throw new ApplicationException(ErrorCode.NOT_FOUND_CATEGORY_EXCEPTION); + } + List stackNameList = stackNameRepository.findStackNameByPost(post); + List stackList = new ArrayList<>(); + if(stackNameList!=null) { + for (StackName stackName : stackNameList) { + stackList.add(String.valueOf(stackName.getStackNameType())); + } + }else { + throw new ApplicationException(ErrorCode.NOT_FOUND_CATEGORY_EXCEPTION); + } + ApplyRes applyRes = ApplyRes.of(post,current_person, list, stackList); return applyRes; } } @@ -194,7 +212,7 @@ public ApplicationRes findApplication(Long apply_id,Long post_id){ List list = new ArrayList<>(); if(categoryList!=null) { for (Category category : categoryList) { - list.add(String.valueOf(category.getCategoryType())); + list.add(String.valueOf(category.getCategoryType())); } }else { throw new ApplicationException(ErrorCode.NOT_FOUND_CATEGORY_EXCEPTION); @@ -203,7 +221,7 @@ public ApplicationRes findApplication(Long apply_id,Long post_id){ List stackList = new ArrayList<>(); if(stackNameList!=null) { for (StackName stackName : stackNameList) { - stackList.add(String.valueOf(stackName.getStackNameType())); + stackList.add(String.valueOf(stackName.getStackNameType())); } }else { throw new ApplicationException(ErrorCode.NOT_FOUND_CATEGORY_EXCEPTION);