Search in sources :

Example 1 with NewSnapshot

use of py.org.fundacionparaguaya.pspserver.surveys.dtos.NewSnapshot in project FP-PSP-SERVER by FundacionParaguaya.

the class SnapshotController method addSnapshot.

@PostMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@io.swagger.annotations.ApiOperation(value = "Create Snapshot", notes = "A `POST` request will create new snapshot for a particular survey.", response = Snapshot.class, tags = {})
@io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 201, message = "The created snapshot", response = Snapshot.class) })
public ResponseEntity addSnapshot(@AuthenticationPrincipal UserDetailsDTO details, @ApiParam(value = "The snapshot", required = true) @RequestBody NewSnapshot snapshot) throws NotFoundException, URISyntaxException {
    LOG.debug("REST request to add Snapshot : {}", snapshot);
    Snapshot data = snapshotService.addSurveySnapshot(details, snapshot);
    URI surveyLocation = new URI("/snapshots/" + data.getSurveyId());
    return ResponseEntity.created(surveyLocation).body(data);
}
Also used : Snapshot(py.org.fundacionparaguaya.pspserver.surveys.dtos.Snapshot) NewSnapshot(py.org.fundacionparaguaya.pspserver.surveys.dtos.NewSnapshot) URI(java.net.URI) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

URI (java.net.URI)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 NewSnapshot (py.org.fundacionparaguaya.pspserver.surveys.dtos.NewSnapshot)1 Snapshot (py.org.fundacionparaguaya.pspserver.surveys.dtos.Snapshot)1