Resolve "Сохранение статьи" #143

Merged
Yelisson merged 1 commits from 10-savePaper into master 2018-11-23 20:24:28 +04:00
2 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,11 @@ public class PaperController {
return new Response<>(paperService.findAllDto());
}
@GetMapping("/{paper-id}")
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId){
return new Response(paperService.findPaper(paperId));
}
@PostMapping
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
return new Response<>(paperService.create(paperDto));

View File

@ -130,6 +130,10 @@ public class PaperService {
return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new);
}
public PaperDto findPaper(int id){
return new PaperDto(paperRepository.getOne(id));
}
public void closeFailedPapers() {
List<Paper> papers = paperRepository.findAll()
.stream()