diff --git a/bootstrap/service.go b/bootstrap/service.go index e152ee64b0..d2493cb06a 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -12,16 +12,13 @@ import ( "github.com/absmach/magistrala" "github.com/absmach/magistrala/auth" + "github.com/absmach/magistrala/pkg/clients" "github.com/absmach/magistrala/pkg/errors" repoerr "github.com/absmach/magistrala/pkg/errors/repository" svcerr "github.com/absmach/magistrala/pkg/errors/service" mgsdk "github.com/absmach/magistrala/pkg/sdk/go" ) -const ( - allConn = "all_connected" -) - var ( // ErrThings indicates failure to communicate with Magistrala Things service. // It can be due to networking error or invalid/unauthenticated request. @@ -476,14 +473,14 @@ func (bs bootstrapService) ConnectThingHandler(ctx context.Context, channelID, t } ch := bs.toIDList(channels) resp, err := bs.tauth.VerifyConnections(ctx, &magistrala.VerifyConnectionsReq{ - ThingsId: []string{thingID}, - GroupsId: ch, + ThingIds: []string{thingID}, + GroupIds: ch, }) if err != nil { return err } - if resp.Status == allConn { + if resp.Status == clients.AllConnectedState.String() { if err := bs.configs.ConnectThing(ctx, channelID, thingID); err != nil { return errors.Wrap(errConnectThing, err) } @@ -499,13 +496,13 @@ func (bs bootstrapService) DisconnectThingHandler(ctx context.Context, channelID } ch := bs.toIDList(channels) resp, err := bs.tauth.VerifyConnections(ctx, &magistrala.VerifyConnectionsReq{ - ThingsId: []string{thingID}, - GroupsId: ch, + ThingIds: []string{thingID}, + GroupIds: ch, }) if err != nil { return err } - if resp.Status != allConn { + if resp.Status != clients.AllConnectedState.String() { if err := bs.configs.DisconnectThing(ctx, channelID, thingID); err != nil { return errors.Wrap(errDisconnectThing, err) }