Skip to content

Commit

Permalink
format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-goebel committed Jul 18, 2023
1 parent d0995e1 commit fdfa02d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
1 change: 0 additions & 1 deletion apiservices/api_configuration_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (s *ConfigurationApiService) GetConfigurations(ctx context.Context) (apiser
}
return apiserver.Response(http.StatusOK, configs), nil


}

// PostConfiguration - Creates an example configuration
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_spaces_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"context"
//"errors"
"net/http"
"thingdust/conf"
"thingdust/apiserver"
"thingdust/conf"
)

// SpacesApiService is a service that implements the logic for the SpacesApiServicer
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_version_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"context"
"github.com/eliona-smart-building-assistant/go-utils/common"
"github.com/eliona-smart-building-assistant/go-utils/log"
"gopkg.in/yaml.v3"
"net/http"
"os"
"thingdust/apiserver"
"gopkg.in/yaml.v3"
)

// VersionApiService is a service that implements the logic for the VersionApiServicer
Expand Down
8 changes: 4 additions & 4 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ package conf

import (
"context"
"thingdust/apiserver"
dbthingdust "thingdust/db/thingdust"
"github.com/eliona-smart-building-assistant/go-utils/common"
"github.com/eliona-smart-building-assistant/go-utils/db"
"github.com/volatiletech/null/v8"
"github.com/volatiletech/sqlboiler/v4/boil"
"github.com/volatiletech/sqlboiler/v4/queries/qm"
"github.com/volatiletech/null/v8"
"thingdust/apiserver"
dbthingdust "thingdust/db/thingdust"
)

func GetSpaces(ctx context.Context, configId int64) ([]apiserver.Space, error) {
Expand Down Expand Up @@ -56,7 +56,7 @@ func GetSpace(ctx context.Context, configId int64, projectId string, spaceName s
if err != nil {
return nil, err
}
if len(dbSpaces)!= 1 {
if len(dbSpaces) != 1 {
return nil, nil
}
return apiSpacesFromDbSpaces(dbSpaces[0]), nil
Expand Down
1 change: 0 additions & 1 deletion eliona/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func ThingdustDashboard(projectId string) (api.Dashboard, error) {
dashboard := api.Dashboard{}
dashboard.Name = "Thingdust Spaces"
dashboard.ProjectId = projectId


dashboard.Widgets = []api.Widget{}

Expand Down
8 changes: 3 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// until all services are finished.
func main() {
log.Info("main", "Starting the app.")

database := db.Database(app.AppName())
defer database.Close()
boil.SetDB(database)
Expand All @@ -51,15 +51,13 @@ func main() {
common.Loop(CheckConfigsandSetActiveState, time.Second),
listenApiRequests,
)

// At the end set all configuration inactive
_, err := conf.SetAllConfigsInactive(context.Background())
if err != nil {
log.Error("conf", "setting all configs inactive: %v", err)
}

log.Info("main", "Terminate the app.")

}


12 changes: 4 additions & 8 deletions thingdust/types.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package thingdust

import (

)

import ()

type Spaces map[string]Space


type Space struct {
Humidity float64 `json:"humidity"`
Occupancy string `json:"occupancy"`
Humidity float64 `json:"humidity"`
Occupancy string `json:"occupancy"`
Temperature float64 `json:"temperature"`
}
}

0 comments on commit fdfa02d

Please sign in to comment.