diff --git a/quads-loader/src/main/java/fr/vcity/converg/controllers/QuadImportController.java b/quads-loader/src/main/java/fr/vcity/converg/controllers/QuadImportController.java index f6d465c..44ac1b9 100644 --- a/quads-loader/src/main/java/fr/vcity/converg/controllers/QuadImportController.java +++ b/quads-loader/src/main/java/fr/vcity/converg/controllers/QuadImportController.java @@ -32,9 +32,14 @@ public QuadImportController(QuadImportService quadImportService) { @ApiResponse(responseCode = "200", description = "The quads were added to a new version"), @ApiResponse(responseCode = "400", description = "Invalid content")} ) - @PostMapping(value = {"/version"}) + @PostMapping(value = {"/version"}, consumes = "multipart/form-data") ResponseEntity importModel( - @Parameter(description = "The file containing all the triple/quads to import as valid in a new version", name = "file") + @Parameter( + description = "The file containing all the triple/quads to import as valid in a new version", + name = "file", + required = true, + content = @Content(mediaType = "multipart/form-data", schema = @Schema(type = "string", format = "binary")) + ) @RequestParam("file") MultipartFile file ) { try { @@ -55,9 +60,13 @@ ResponseEntity importModel( @ApiResponse(responseCode = "200", description = "The triple were added to a new metadata"), @ApiResponse(responseCode = "400", description = "Invalid content")} ) - @PostMapping(value = {"/metadata"}) + @PostMapping(value = {"/metadata"}, consumes = "multipart/form-data") ResponseEntity importMetadata( - @Parameter(description = "The file containing all the triple to import as valid in a new metadata", name = "file") + @Parameter(description = "The file containing all the triple to import as valid in a new metadata", + name = "file", + required = true, + content = @Content(mediaType = "multipart/form-data", schema = @Schema(type = "string", format = "binary")) + ) @RequestParam("file") MultipartFile file ) { try { diff --git a/quads-loader/src/main/java/fr/vcity/converg/controllers/QueryController.java b/quads-loader/src/main/java/fr/vcity/converg/controllers/QueryController.java deleted file mode 100644 index 377e10f..0000000 --- a/quads-loader/src/main/java/fr/vcity/converg/controllers/QueryController.java +++ /dev/null @@ -1,96 +0,0 @@ -package fr.vcity.converg.controllers; - -import fr.vcity.converg.dto.CompleteVersionedQuad; -import fr.vcity.converg.dto.VersionAncestry; -import fr.vcity.converg.dto.Workspace; -import fr.vcity.converg.services.QueryService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -@RestController -@Tag(name = "Query API") -@RequestMapping("/query") -public class QueryController { - QueryService queryService; - - public QueryController(QueryService queryService) { - this.queryService = queryService; - } - - @Operation( - summary = "Search by validity", - description = "Search all quads filtered by a given validity and returns the result" - ) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The query filtered result", - content = { - @Content(mediaType = "application/json", - array = @ArraySchema( - schema = @Schema(implementation = CompleteVersionedQuad.class) - ) - )}), - @ApiResponse(responseCode = "400", description = "Invalid validity", - content = @Content), - @ApiResponse(responseCode = "404", description = "Nothing found", - content = @Content)} - ) - @GetMapping(value = "/validity/{pattern}") - ResponseEntity> queryRequestedValidity( - @Parameter(description = "The validity string (in bit string format)", name = "pattern", example = "110") - @PathVariable("pattern") String requestedValidity - ) { - return ResponseEntity.ok(queryService.queryRequestedValidity(requestedValidity)); - } - - @Operation( - summary = "Search by version", - description = "Find all quads filtered by a given version and returns the result" - ) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The query filtered result", - content = {@Content(mediaType = "application/json", - array = @ArraySchema( - schema = @Schema(implementation = CompleteVersionedQuad.class) - ) - )}), - @ApiResponse(responseCode = "400", description = "Invalid version", - content = @Content), - @ApiResponse(responseCode = "404", description = "Nothing found", - content = @Content)} - ) - @GetMapping("/version/{idVersion}") - ResponseEntity> queryRequestedVersion( - @Parameter(description = "The version number", name = "idVersion", example = "3") - @PathVariable("idVersion") Integer requestedVersion - ) { - return ResponseEntity.ok(queryService.queryRequestedVersion(requestedVersion)); - } - - @Operation( - summary = "Get version tree", - description = "Gets all versions and their ancestry" - ) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "The version tree", - content = {@Content(mediaType = "application/json", - array = @ArraySchema( - schema = @Schema(implementation = VersionAncestry.class) - ) - )})} - ) - @GetMapping("/versions") - ResponseEntity getGraphVersion() { - return ResponseEntity.ok(queryService.getGraphVersion()); - } -}