add validation for sensor data and fix tests

This commit is contained in:
2025-10-09 23:11:37 +02:00
parent 9d86fd394c
commit b012db856c
3 changed files with 53 additions and 29 deletions
+9 -9
View File
@@ -15,18 +15,18 @@ const (
)
type Sensor struct {
SensorID string `json:"sensor_id"`
SensorType SType `json:"sensor_type"`
SamplingInterval *time.Duration `json:"sampling"`
ThresholdAbove *float64 `json:"thresoldabove"`
ThresholdBelow *float64 `json:"thresoldbelow"`
SensorData *[]SensorData `json:"sensor_data,omitempty"`
SensorID string `json:"sensor_id"`
SensorType SType `json:"sensor_type"`
SamplingInterval *time.Duration `json:"sampling"`
ThresholdAbove *float64 `json:"thresoldabove"`
ThresholdBelow *float64 `json:"thresoldbelow"`
SensorData *map[int]SensorData `json:"sensor_data,omitempty"`
}
type SensorData struct {
SensorID string `json:"sensor_id"`
Value float64 `json:"value"`
Timestamp time.Time `json:"timestamp"`
SensorID string `json:"sensor_id"`
Value *float64 `json:"value"`
Timestamp *time.Time `json:"timestamp"`
}
type SensorRequest struct {