diff --git a/src/main/java/it/inaf/oats/vospace/CollectionsController.java b/src/main/java/it/inaf/oats/vospace/CollectionsController.java index 3c50a24727d1a1e7bc8ad7b7e1a14876b059596b..b28ce23d63a39df82c22590863d1d1457bbda48b 100644 --- a/src/main/java/it/inaf/oats/vospace/CollectionsController.java +++ b/src/main/java/it/inaf/oats/vospace/CollectionsController.java @@ -6,6 +6,7 @@ package it.inaf.oats.vospace; import it.inaf.ia2.aa.data.User; +import it.inaf.oats.vospace.datamodel.collections.NodeCollection; import it.inaf.oats.vospace.datamodel.collections.NodeCollectionsWrapper; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -47,11 +49,11 @@ public class CollectionsController { // create a new collection with specified title @PutMapping(value = "/collections") public ResponseEntity<String> createCollection( - @RequestBody String collectionName, User principal) { + @RequestBody NodeCollection nc, User principal) { LOG.debug("create collection called with name {} called for user {}", - collectionName, principal.getName()); + nc.getTitle(), principal.getName()); - collectionsService.createNewCollection(collectionName, principal.getName()); + collectionsService.createNewCollection(nc.getTitle(), principal.getName()); return ResponseEntity.ok("Collection created"); } @@ -59,11 +61,11 @@ public class CollectionsController { // delete collection by id @DeleteMapping(value = "/collections") public ResponseEntity<String> deleteCollection( - @RequestBody Long collectionId, User principal) { + @RequestParam("id") Long id, User principal) { LOG.debug("delete collection called with id {} for user {}", - collectionId, principal.getName()); + id, principal.getName()); - collectionsService.deleteCollectionById(collectionId, principal.getName()); + collectionsService.deleteCollectionById(id, principal.getName()); return ResponseEntity.ok("Collection deleted");