fix(db): set time interval for influx limitations

Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-05-18 12:33:41 +02:00
parent abf19fb4e2
commit 56c6299417

View File

@@ -111,7 +111,7 @@ func (g *RestGateway) getRoomCurrent(c *gin.Context) {
roomID := c.Param("room-id") roomID := c.Param("room-id")
// Get the last record for the specific room // Get the last record for the specific room
query := fmt.Sprintf(`SELECT * FROM "%s" WHERE "room" = '%s' ORDER BY time DESC LIMIT 1`, g.measurementName, roomID) query := fmt.Sprintf(`SELECT * FROM "%s" WHERE "room" = '%s' AND time > now() - INTERVAL '1 days' ORDER BY time DESC LIMIT 1`, g.measurementName, roomID)
// Using context.Background() as seen in working snippet // Using context.Background() as seen in working snippet
it, err := g.influxGateway.Query(context.Background(), query) it, err := g.influxGateway.Query(context.Background(), query)