feat: update DiscoveryMessage struct and add API documentation
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
// DiscoveryMessage represents the JSON payload from a device discovery message
|
// DiscoveryMessage represents the JSON payload from a device discovery message
|
||||||
type DiscoveryMessage struct {
|
type DiscoveryMessage struct {
|
||||||
MACAddress string `json:"mac_address"`
|
MACAddress string `json:"mac_address"`
|
||||||
Device DiscoveryDevicePayload `json:"device"`
|
Device DiscoveryDevicePayload `json:"device"`
|
||||||
Sensors []DiscoverySensorPayload `json:"sensors"`
|
Sensors []DiscoverySensorPayload `json:"sensors"`
|
||||||
Actors []DiscoveryActorPayload `json:"actors"`
|
Actors []DiscoveryActorPayload `json:"actors"`
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ func (h *Handler) updateExistingDevice(msg DiscoveryMessage, previousStatusID in
|
|||||||
return nil
|
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) {
|
func getDeviceSensors(tx *sql.Tx, deviceID string) (map[string]DiscoverySensorPayload, error) {
|
||||||
rows, err := tx.Query(
|
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",
|
"SELECT BIN_TO_UUID(id), name, type, data_type_id FROM sensors WHERE device_id = UUID_TO_BIN(?) ORDER BY id",
|
||||||
|
|||||||
Reference in New Issue
Block a user