Skip to content

Commit

Permalink
#28 [update]
Browse files Browse the repository at this point in the history
BookmarkResponseDto 북마크 조회 정보 수정
  • Loading branch information
kokoa322 committed Jul 13, 2022
1 parent 519a1c0 commit bab4c66
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ public void folder (@RequestBody FolderRequestDto folderRequestDto){
folderService.folder(folderRequestDto);
}

/* 폴더 삭제 -> 삭제 시 안에 담긴 모든 북마크가 삭제됨 */
/** 폴더 삭제 -> 삭제 시 안에 담긴 모든 북마크가 삭제됨 */

@DeleteMapping("/folder/{folderId}")
public void folderDelete (@PathVariable int folderId){

folderService.folderDelete(folderId);
}

/* 폴더 명 변경 */

/** 폴더 명 변경 */
@PutMapping("/folderUpdate/{folderId}")
public void folderUpdate (@PathVariable int folderId, @RequestParam String newFolderName){
System.out.println(newFolderName);

folderService.folderUpdate(folderId, newFolderName);
}

/** 폴더 리스트 */
@PutMapping("/folderList/{userId}")
public List<FolderResponseDto> folderList (@PathVariable int userId){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.mpnp.baechelin.bookmark.domain.Bookmark;
import com.mpnp.baechelin.bookmark.domain.Folder;
import com.mpnp.baechelin.store.domain.StoreImage;
import lombok.*;

import java.util.ArrayList;
Expand All @@ -24,19 +25,39 @@ public FolderResponseDto(Folder folder) {
}

public static FolderResponseDto FolderDtoRes(Folder folder) {

/** 북마크의 정보를 담는 작업 */
List<List<String>> bookmarks = new ArrayList<>();

if(folder.getBookmarkList() != null) {
for (Bookmark bookmark : folder.getBookmarkList()) {
List<String> tempBookmarkList = new ArrayList<>();
tempBookmarkList.add(bookmark.getStoreId().getName());

String pointAvg = String.valueOf(bookmark.getStoreId().getPointAvg()); // 업장 별점
String name = bookmark.getStoreId().getName(); // 업장 이름
String address = bookmark.getStoreId().getAddress(); // 업장 주소
String category = bookmark.getStoreId().getCategory(); // 업장 카테고리
String PhoneNumber = bookmark.getStoreId().getPhoneNumber(); // 업장 전화번호

List<StoreImage> storeImageList = bookmark.getStoreId().getStoreImageList();// 업장 이미지 리스트
List<String> tempBookmarkList = new ArrayList<>(); // 정보를 담는 리스트

tempBookmarkList.add(name);
tempBookmarkList.add(pointAvg);
tempBookmarkList.add(address);
tempBookmarkList.add(category);
tempBookmarkList.add(PhoneNumber);
tempBookmarkList.add(storeImageList.get(0).getStoreImageUrl());

bookmarks.add(tempBookmarkList);

}
} else if(folder.getBookmarkList() == null) {

return FolderResponseDto.builder()
.folderName(folder.getFolderName())
.id(folder.getId())
.build();

}

return FolderResponseDto.builder()
Expand Down

0 comments on commit bab4c66

Please sign in to comment.