feat: update DiscoveryMessage struct and add API documentation

This commit is contained in:
2026-01-14 14:49:57 +01:00
parent 2f9bd6316b
commit 152d5b82cd
2 changed files with 1027 additions and 3 deletions

1024
API.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,8 @@ import (
// DiscoveryMessage represents the JSON payload from a device discovery message
type DiscoveryMessage struct {
MACAddress string `json:"mac_address"`
Device DiscoveryDevicePayload `json:"device"`
MACAddress string `json:"mac_address"`
Device DiscoveryDevicePayload `json:"device"`
Sensors []DiscoverySensorPayload `json:"sensors"`
Actors []DiscoveryActorPayload `json:"actors"`
}
@@ -162,7 +162,7 @@ func (h *Handler) updateExistingDevice(msg DiscoveryMessage, previousStatusID in
return nil
}
// getDeviceSensors retrieves existing sensors for a device
// getDeviceSensors retrieves existing sensors for a device<
func getDeviceSensors(tx *sql.Tx, deviceID string) (map[string]DiscoverySensorPayload, error) {
rows, err := tx.Query(
"SELECT BIN_TO_UUID(id), name, type, data_type_id FROM sensors WHERE device_id = UUID_TO_BIN(?) ORDER BY id",