Skip to content

Commit

Permalink
add publish subscribe
Browse files Browse the repository at this point in the history
Signed-off-by: Arvindh <[email protected]>
  • Loading branch information
arvindh123 committed Nov 4, 2024
1 parent 749861b commit 8e93849
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
22 changes: 12 additions & 10 deletions channels/mocks/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions channels/private/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (svc service) Authorize(ctx context.Context, req channels.AuthzReq) error {
if err := svc.repo.ThingAuthorize(ctx, channels.Connection{
ChannelID: req.ChannelID,
ThingID: req.ClientID,
Type: req.Type,
}); err != nil {
return errors.Wrap(svcerr.ErrAuthorization, err)
}
Expand Down
2 changes: 2 additions & 0 deletions things/api/grpc/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func addConnectionsEndpoint(svc pThings.Service) endpoint.Endpoint {
ThingID: c.thingID,
ChannelID: c.channelID,
DomainID: c.domainID,
Type: c.connType,
})
}
if err := svc.AddConnections(ctx, conns); err != nil {
Expand All @@ -98,6 +99,7 @@ func removeConnectionsEndpoint(svc pThings.Service) endpoint.Endpoint {
ThingID: c.thingID,
ChannelID: c.channelID,
DomainID: c.domainID,
Type: c.connType,
})
}
if err := svc.RemoveConnections(ctx, conns); err != nil {
Expand Down
1 change: 0 additions & 1 deletion things/postgres/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func (repo *clientsRepo) AddConnections(ctx context.Context, conns []things.Conn

dbConns := toDBConnections(conns)

fmt.Printf("%+v\n", dbConns)
q := `INSERT INTO connections (channel_id, domain_id, thing_id, type)
VALUES (:channel_id, :domain_id, :thing_id, :type);`

Expand Down

0 comments on commit 8e93849

Please sign in to comment.