Service for accessing devices metrics and events.
Ensure that PostgreSql is accessible before running the service.
Postrges access url is specified in application.properties for spring.datasource.url
sudo ./gradlew build buildDocker -x test -x test_integration
sudo docker run -p 8080:8080 -t com.metric.assessor
./gradlew bootRun
Ensure, that local PostgreSql is accessible, before running tests.
./gradlew check
GET /api/v1/sensors/{uuid}/events to get all events of the sensor.
Where:
uuid
is the sensor's uuid.
Reply:
{
"sensorUuid" : "<uuid>",
"events" :
[
{
"type" : "<Type>",
"at" : "<Date>",
"temperature" : <Temperature>
}
]
}
Where:
uuid
is sensor's uuid String.
Type
is the event's type String (TEMPERATURE_EXCEEDED).
at
is a date of event in ISO_OFFSET_DATE_TIME format.
temperature
is the temperature on the moment event was fired. It is double.
GET /api/v1/sensors/{uuid}/measurements to get sensor's statistics.
Where:
uuid
is the sensor's uuid.
Reply:
{
"sensorUuid" : "<uuid>",
"averageLastHour" : <avg1h>
"averageLast7Days" : <avg7d>
"maxLast30Days" : <max30d>
}
Where:
uuid
is sensor's uuid String.
avg1h
is an average temperature for last hour.
avg7d
is an average temperature for last 7 days.
max30d
is a maximum temperature for last 30 days.