Commit dd17a4a4 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '144-remove-dataset-api' into 'master'

Resolve "Remove dataset API"

Closes #144

See merge request !135
parents 83505ccf 0a5dd013
......@@ -33,6 +33,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -89,7 +90,6 @@ public class DatasetController {
return datasetService.updateDataset(dataset);
}
@PreAuthorize("isAuthenticated()")
@PostMapping(value = "/upsertaccessions/{UUID},{version}")
public Dataset upsertAccessions(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version,
@RequestBody final Set<AccessionIdentifier> accessionIdentifiers) throws NotFoundElement {
......@@ -117,7 +117,6 @@ public class DatasetController {
return datasetService.unpublishDataset(dataset);
}
@PreAuthorize("isAuthenticated()")
@PostMapping(value = "/add-descriptors/{UUID},{version}")
public Dataset addDescriptors(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version, @RequestBody final Set<UUID> descriptorUuids) {
final Dataset dataset = datasetService.loadDataset(uuid, version);
......@@ -125,7 +124,6 @@ public class DatasetController {
return datasetService.addDescriptors(dataset, descriptors.toArray(new Descriptor[] {}));
}
@PreAuthorize("isAuthenticated()")
@PostMapping(value = "/remove-descriptors/{UUID},{version}")
public Dataset removeDescriptors(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version, @RequestBody final Set<UUID> descriptorUuids) {
final Dataset dataset = datasetService.loadDataset(uuid, version);
......@@ -133,4 +131,11 @@ public class DatasetController {
return datasetService.removeDescriptors(dataset, descriptors.toArray(new Descriptor[] {}));
}
@DeleteMapping("/{UUID},{version}")
public Dataset deleteDataset(@PathVariable("UUID") final UUID uuid, @PathVariable("version") final int version) throws Exception {
final Dataset dataset = datasetService.removeDataset(datasetService.loadDataset(uuid, version));
dataset.setId(null);
return dataset;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment