diff options
Diffstat (limited to 'app/init.go')
| -rw-r--r-- | app/init.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/init.go b/app/init.go index b88cb00..581944b 100644 --- a/app/init.go +++ b/app/init.go @@ -2,8 +2,10 @@ package app import ( "context" + "fmt" "net/http" "os" + "strings" v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" "github.com/authzed/authzed-go/v1" @@ -83,7 +85,7 @@ func init() { ioc.MustResolve[*event.TypedAggregator[*domain.Sparkle]](c).SubscribeTo("after.create", func(item *domain.Sparkle) { client := ioc.MustResolve[*authzed.Client](c) - client.WriteRelationships(context.Background(), &v1.WriteRelationshipsRequest{ + response, err := client.WriteRelationships(context.Background(), &v1.WriteRelationshipsRequest{ Updates: []*v1.RelationshipUpdate{ &v1.RelationshipUpdate{ Operation: v1.RelationshipUpdate_OPERATION_CREATE, @@ -101,7 +103,7 @@ func init() { Subject: &v1.SubjectReference{ Object: &v1.ObjectReference{ ObjectType: "user", - ObjectId: item.Sparklee, + ObjectId: strings.TrimPrefix(item.Sparklee, "@"), }, }, }, @@ -121,5 +123,9 @@ func init() { }, }, }) + if err != nil { + fmt.Printf("%v\n", err) + } + fmt.Printf("%v\n", response) }) } |
