Merge branch '97-fix-sensor' into 'dev'

fix

Closes #97

See merge request sa4-2020/the-sanmarinoes/backend!206
This commit is contained in:
Matteo Omenetti 2020-05-27 18:31:13 +02:00
commit 8f3df8e96f
4 changed files with 4 additions and 19 deletions

View file

@ -64,8 +64,8 @@ public class SensorController {
@PutMapping("/{id}/simulation") @PutMapping("/{id}/simulation")
public Sensor updateSimulation( public Sensor updateSimulation(
@PathVariable("id") Long sensorId, @PathVariable("id") Long sensorId,
@RequestParam("error") BigDecimal error, @RequestBody BigDecimal error,
@RequestParam("typical") BigDecimal typical, @RequestBody BigDecimal typical,
final Principal principal) final Principal principal)
throws NotFoundException { throws NotFoundException {
return sensorService.updateSimulationFromSensor( return sensorService.updateSimulationFromSensor(

View file

@ -20,10 +20,6 @@ public class SensorSaveRequest {
@NotNull private BigDecimal value; @NotNull private BigDecimal value;
private BigDecimal error;
private BigDecimal typical;
/** /**
* The room this device belongs in, as a foreign key id. To use when updating and inserting from * The room this device belongs in, as a foreign key id. To use when updating and inserting from
* a REST call. * a REST call.

View file

@ -69,12 +69,7 @@ public class SensorControllerTests {
final SensorSaveRequest toSend = final SensorSaveRequest toSend =
new SensorSaveRequest( new SensorSaveRequest(
Sensor.SensorType.TEMPERATURE, Sensor.SensorType.TEMPERATURE, BigDecimal.ZERO, 42L, "Test sensor");
BigDecimal.ZERO,
BigDecimal.ZERO,
BigDecimal.ZERO,
42L,
"Test sensor");
final Sensor created = sensorController.create(toSend, mockPrincipal); final Sensor created = sensorController.create(toSend, mockPrincipal);
checkSensorAgainstRequest(created, toSend); checkSensorAgainstRequest(created, toSend);

View file

@ -30,13 +30,7 @@ public class SensorSaveRequestTests {
@DisplayName("test constructor") @DisplayName("test constructor")
public void testConstructorNotEmpty() { public void testConstructorNotEmpty() {
SensorSaveRequest newSaveRequest = SensorSaveRequest newSaveRequest =
new SensorSaveRequest( new SensorSaveRequest(Sensor.SensorType.HUMIDITY, new BigDecimal(12), 12L, "name");
Sensor.SensorType.HUMIDITY,
new BigDecimal(12),
BigDecimal.ZERO,
BigDecimal.ZERO,
12L,
"name");
assertNotNull(newSaveRequest.getSensor()); assertNotNull(newSaveRequest.getSensor());
assertNotNull(newSaveRequest.getName()); assertNotNull(newSaveRequest.getName());
assertNotNull(newSaveRequest.getRoomId()); assertNotNull(newSaveRequest.getRoomId());