Skip to content

Commit

Permalink
Merge pull request #73 from Gongjakso/feat/postModified
Browse files Browse the repository at this point in the history
fixed: applyRes DTO 수정
  • Loading branch information
yumzen authored Feb 18, 2024
2 parents 972db42 + ff14d0a commit c4316b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ public record ApplyRes(
LocalDateTime finishDate,
Long max_person,
int current_person,
Boolean postType
Boolean postType,
List<String> category,
List<String> 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<String> category, List<String> stackName){
return new ApplyRes(post.getTitle(),post.getStartDate(),post.getFinishDate(),post.getMaxPerson(),current_person,post.isPostType(), category, stackName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Category> categoryList = categoryRepository.findCategoryByPost(post);
List<String> 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<StackName> stackNameList = stackNameRepository.findStackNameByPost(post);
List<String> 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;
}
}
Expand Down Expand Up @@ -194,7 +212,7 @@ public ApplicationRes findApplication(Long apply_id,Long post_id){
List<String> 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);
Expand All @@ -203,7 +221,7 @@ public ApplicationRes findApplication(Long apply_id,Long post_id){
List<String> 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);
Expand Down

0 comments on commit c4316b2

Please sign in to comment.