Skip to content

Commit

Permalink
[feat & refactor] 특정폴더 조회 API with h2 success #29
Browse files Browse the repository at this point in the history
  • Loading branch information
gdakate committed Mar 26, 2023
1 parent 1a4a03a commit b95d06d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -29,8 +30,9 @@ private ApiResponse createFolder(@RequestBody FolderRequestDto folderRequestDto)
return ApiResponse.successCode(Success.GET_FOLDER_SUCCESS,response);
}

// @GetMapping("/folder")
// private Folder getFolder(){
// return folderService.getFolder();
// }
@GetMapping("/folder/{folder_id}")
private ApiResponse getOneFolder(@PathVariable Long folder_id){
FolderResponseDto response = folderService.viewOneFolder(folder_id);
return ApiResponse.successCode(Success.GET_FOLDER_SUCCESS,response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -63,6 +64,12 @@ public FolderViewResponseDto viewFolder() {
return FolderViewResponseDto.of(folderNames);
}

public FolderResponseDto viewOneFolder(Long folder_id) {
Optional<Folder> folder = folderRepository.findById(folder_id);
if(folder.isPresent()){
String folderName = folder.get().getName();
}
return FolderResponseDto.from(folder_id,folder.get().getName());


}
}

0 comments on commit b95d06d

Please sign in to comment.