Add POST endpoint for measurement creation

This commit is contained in:
Dek Dalier
2026-08-17 20:25:59 +02:00
parent c99c9937b1
commit d1eb762dca

View File

@@ -10,6 +10,10 @@ import dev.deklab.model.Measurement;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@RestController @RestController
public class MeasurementController { public class MeasurementController {
@@ -33,5 +37,11 @@ public class MeasurementController {
} }
throw new ResponseStatusException(HttpStatus.NOT_FOUND); throw new ResponseStatusException(HttpStatus.NOT_FOUND);
} }
@PostMapping("/measurements")
@ResponseStatus(HttpStatus.CREATED)
public Measurement postMeasurement(@RequestBody Measurement measurement) {
return measurement;
}
} }