diff --git a/bridge b/bridge index 29113f2..f7c7b21 100755 Binary files a/bridge and b/bridge differ diff --git a/decoder b/decoder index 396c992..b6248de 100755 Binary files a/decoder and b/decoder differ diff --git a/internal/pkg/apiclient/data.go b/internal/pkg/apiclient/data.go index 5fe7f0d..0eb909e 100644 --- a/internal/pkg/apiclient/data.go +++ b/internal/pkg/apiclient/data.go @@ -54,6 +54,21 @@ func GetTrackerZones(token string, client *http.Client, cfg *config.Config) ([]m return i, nil } +func GetFloors(token string, client *http.Client, cfg *config.Config) ([]model.Floor, error) { + res, err := getRequest(token, "getFloors", client, cfg) + if err != nil { + return []model.Floor{}, err + } + + var i []model.Floor + err = json.NewDecoder(res.Body).Decode(&i) + if err != nil { + return []model.Floor{}, err + } + + return i, nil +} + func GetZones(token string, client *http.Client, cfg *config.Config) ([]model.Zone, error) { res, err := getRequest(token, "getZones", client, cfg) if err != nil { diff --git a/internal/pkg/apiclient/updatedb.go b/internal/pkg/apiclient/updatedb.go index 0964bc6..7e55eb7 100644 --- a/internal/pkg/apiclient/updatedb.go +++ b/internal/pkg/apiclient/updatedb.go @@ -52,6 +52,10 @@ func UpdateDB(db *gorm.DB, ctx context.Context, cfg *config.Config, writer *kafk syncTable(db, gateways) } + if floors, err := GetFloors(token, client, cfg); err == nil { + syncTable(db, floors) + } + if zones, err := GetZones(token, client, cfg); err == nil { syncTable(db, zones) } diff --git a/internal/pkg/model/floor.go b/internal/pkg/model/floor.go index beea49c..06020c3 100644 --- a/internal/pkg/model/floor.go +++ b/internal/pkg/model/floor.go @@ -1,11 +1,11 @@ package model type Floor struct { - ID string `gorm:"unique;primaryKey"` - Name string `json:"name"` - FloorNumber int `json:"floornumber"` - Image string `json:"image"` - Description string `json:"description"` - Scale int `json:"scale"` - Building string `json:"building"` + ID string `gorm:"unique;primaryKey"` + Name string `json:"name"` + FloorNumber int `json:"floornumber"` + Image string `json:"image"` + Description string `json:"description"` + Scale float32 `json:"scale"` + Building string `json:"building"` } diff --git a/location b/location index 87cc534..4a8ea01 100755 Binary files a/location and b/location differ diff --git a/scripts/config/settings.sh b/scripts/config/settings.sh index 50c8505..d086e75 100755 --- a/scripts/config/settings.sh +++ b/scripts/config/settings.sh @@ -7,7 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" curl -s -X PATCH "${BASE_URL}/reslevis/settings" \ -H "Content-Type: application/json" \ -d '{ - "current_algorithm": "ai", + "current_algorithm": "filter", "last_seen_threshold": 310, "beacon_metric_size": 100, "HA_send_interval": 60, diff --git a/server b/server index f1190b4..2d4436b 100755 Binary files a/server and b/server differ