|
@@ -1,5 +1,8 @@
|
|
|
package es.uv.garcosda.controllers;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -30,6 +33,7 @@ public class NewsController {
|
|
|
|
|
|
@PostMapping()
|
|
|
public Mono<Document> insert(@RequestBody Document n){
|
|
|
+ n.setDateAdd(new SimpleDateFormat("dd-MM-yyyy").format(new Date()));
|
|
|
return this.ns.insert(n);
|
|
|
}
|
|
|
|
|
@@ -39,8 +43,9 @@ public class NewsController {
|
|
|
}
|
|
|
|
|
|
@DeleteMapping("{id}")
|
|
|
- public Mono<Void> delete(@PathVariable("id") Integer id){
|
|
|
- return this.ns.deleteById(id);
|
|
|
+ public Mono<Integer> delete(@PathVariable("id") Integer id){
|
|
|
+ return this.ns.deleteById(id).then(Mono.just(id));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|