Minor refactor
This commit is contained in:
16
api.go
16
api.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user