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: applyRes DTO 수정 #73

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
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
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
Loading