Resolve "Сохранение статьи" #143
@ -37,6 +37,11 @@ public class PaperController {
|
|||||||
return new Response<>(paperService.findAllDto());
|
return new Response<>(paperService.findAllDto());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{paper-id}")
|
||||||
|
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId){
|
||||||
|
return new Response(paperService.findPaper(paperId));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
||||||
return new Response<>(paperService.create(paperDto));
|
return new Response<>(paperService.create(paperDto));
|
||||||
|
@ -130,6 +130,10 @@ public class PaperService {
|
|||||||
return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new);
|
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() {
|
public void closeFailedPapers() {
|
||||||
List<Paper> papers = paperRepository.findAll()
|
List<Paper> papers = paperRepository.findAll()
|
||||||
.stream()
|
.stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user