Skip to content

Commit

Permalink
수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JONG-KYEONG committed Nov 30, 2023
1 parent 353a6be commit f01c6a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ public class SidebarDto {
private Long categoryId;
private String categoryName;
private Boolean isPrCategory;
private Boolean isMyPage;
private List<PostTitleDto> postTitleDtos = new ArrayList<>(); //TODO 일급 컬렉션으로 수정

public SidebarDto(Category category, List<Post> posts, Boolean isMyPages){
public SidebarDto(Category category, List<Post> posts){
categoryId = category.getId();
categoryName = category.getCategoryName();
isPrCategory = category.getIsPrcategory();
isMyPage = isMyPages;
for(Post post : posts){
postTitleDtos.add(PostTitleDto.of(post));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package com.project.Glog.dto.response.category;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter @Setter
@AllArgsConstructor
@NoArgsConstructor
public class SidebarDtos {
private List<SidebarDto> sidebarDtos = new ArrayList<>();
private Boolean isMyPage;

public SidebarDtos(List<SidebarDto> sidebarDtoList){
for(SidebarDto sidebarDto : sidebarDtoList){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ public SidebarDtos getSideBarByBlog(UserPrincipal userPrincipal, Long blogId) {
List<SidebarDto> sidebarDtos = new ArrayList<>();
for(Category category : categories){
List<Post> posts = postRepository.findAllByCategoryId(category.getId());
sidebarDtos.add(new SidebarDto(category, posts,isMyPage));
sidebarDtos.add(new SidebarDto(category, posts));
}

return new SidebarDtos(sidebarDtos);

return new SidebarDtos(sidebarDtos,isMyPage);
}

public void deletePosts(Long id, List<Long> postsIds) throws Exception{
Expand Down

0 comments on commit f01c6a4

Please sign in to comment.