|
@@ -39,6 +39,16 @@ public class NewsController {
|
|
|
return this.ns.findAll().delayElements(Duration.ofMillis(500));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("publisher/{publisher}")
|
|
|
+ public Flux<Document> getByPublisher(@PathVariable("publisher") String publisher) {
|
|
|
+ return this.ns.findByPublisher(publisher).delayElements(Duration.ofMillis(500));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("author/{author}")
|
|
|
+ public Flux<Document> getByAuthor(@PathVariable("author") String author) {
|
|
|
+ return this.ns.findByAuthor(author).delayElements(Duration.ofMillis(500));
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping()
|
|
|
public Mono<Document> insert(@RequestBody Document n){
|
|
|
n.setDateAdd(new SimpleDateFormat("dd-MM-yyyy").format(new Date()));
|
|
@@ -52,8 +62,7 @@ public class NewsController {
|
|
|
|
|
|
@DeleteMapping("{id}")
|
|
|
public Mono<Integer> delete(@PathVariable("id") Integer id){
|
|
|
- return this.ns.deleteById(id).then(Mono.just(id));
|
|
|
-
|
|
|
+ return this.ns.deleteById(id).then(Mono.just(id));
|
|
|
}
|
|
|
|
|
|
}
|