Make names case insensitive for API

This commit is contained in:
breel
2020-07-25 13:58:02 -06:00
parent 34075cf19a
commit ee4f23a9f4
6 changed files with 75 additions and 32 deletions

View File

@@ -58,7 +58,7 @@ func whoGet(namespace string, g storage.Graph, w http.ResponseWriter, r *http.Re
return json.NewEncoder(w).Encode(entity.One{})
}
if len(ones) > 1 {
return errors.New("more than one result found matching " + id)
return fmt.Errorf("more than one result found matching %q: %+v", id, ones)
}
one := ones[0]
@@ -151,7 +151,7 @@ func whoDelete(namespace string, g storage.Graph, w http.ResponseWriter, r *http
return json.NewEncoder(w).Encode(map[string]string{"error": err.Error()})
}
if err := g.Delete(r.Context(), namespace, entity.One{Name: id}); err != nil {
if err := g.Delete(r.Context(), namespace, operator.CaseInsensitive{Key: entity.Name, Value: id}); err != nil {
return err
}