read all sensors implemented

This commit is contained in:
Pedro Pérez 2025-10-09 16:56:23 +02:00
parent 8cf9219534
commit 92640d1ad0
2 changed files with 9 additions and 5 deletions

View File

@ -116,7 +116,14 @@ func (i *inMemory) ReadSensorValues(sensorID string, from time.Time, to time.Tim
} }
func (i *inMemory) ReadAllSensors() ([]Sensor, error) { func (i *inMemory) ReadAllSensors() ([]Sensor, error) {
panic("unimplemented") i.mu.Lock()
defer i.mu.Unlock()
sensors := make([]Sensor, 0, len(i.sensors))
for _, s := range i.sensors {
sensors = append(sensors, *s)
}
return sensors, nil
} }
type DecoratorRepo struct { type DecoratorRepo struct {

View File

@ -48,8 +48,5 @@ func (s *Service) GetValues(sensorID string, from, to time.Time) (Sensor, error)
} }
func (s *Service) ListSensors() ([]Sensor, error) { func (s *Service) ListSensors() ([]Sensor, error) {
return s.repo.ReadAllSensors()
s.repo.ReadAllSensors()
return []Sensor{}, nil
} }