Minor refactor

This commit is contained in:
Ian Gulliver
2022-03-22 06:04:56 +00:00
parent 590b59998e
commit 56c7cb604d

16
api.go
View File

@@ -51,13 +51,7 @@ func update(obj storebus.Object, patch storebus.Object) error {
switch o := obj.(type) {
case *Template:
p := patch.(*Template)
if p.Title != "" {
o.Title = p.Title
}
return nil
return updateTemplate(o, patch.(*Template))
default:
return fmt.Errorf("Unsupported type: %s", obj.GetType())
@@ -65,6 +59,14 @@ func update(obj storebus.Object, patch storebus.Object) error {
}
}
func updateTemplate(template *Template, patch *Template) error {
if patch.Title != "" {
template.Title = patch.Title
}
return nil
}
func mayCreate(obj storebus.Object, r *http.Request) error {
return nil
}