Add attachments field to one

This commit is contained in:
Bel LaPointe
2020-07-24 11:21:16 -06:00
parent ed3006d359
commit 99fb3bb1c3
5 changed files with 72 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ package view
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"local/dndex/storage"
"local/dndex/storage/entity"
@@ -176,7 +177,7 @@ func whoPatch(namespace string, g storage.Graph, w http.ResponseWriter, r *http.
return err
}
one.Relationship = relationship
if err := g.Update(r.Context(), namespace, entity.One{Name: id}, operator.Set{Key: "connections." + one.Name, Value: one.Peer()}); err != nil {
if err := g.Update(r.Context(), namespace, entity.One{Name: id}, operator.Set{Key: fmt.Sprintf("%s.%s", entity.Connections, one.Name), Value: one.Peer()}); err != nil {
return err
}