Support updating collection only with monetization_pointer
This commit is contained in:
parent
b010484493
commit
2938bba15a
12
database.go
12
database.go
|
@ -875,7 +875,7 @@ func (db *datastore) UpdateCollection(c *SubmittedCollection, alias string) erro
|
||||||
// WHERE values
|
// WHERE values
|
||||||
q.Where("alias = ? AND owner_id = ?", alias, c.OwnerID)
|
q.Where("alias = ? AND owner_id = ?", alias, c.OwnerID)
|
||||||
|
|
||||||
if q.Updates == "" {
|
if q.Updates == "" && c.Monetization == nil {
|
||||||
return ErrPostNoUpdatableVals
|
return ErrPostNoUpdatableVals
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,10 +932,12 @@ func (db *datastore) UpdateCollection(c *SubmittedCollection, alias string) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update rest of the collection data
|
// Update rest of the collection data
|
||||||
res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...)
|
if q.Updates != "" {
|
||||||
if err != nil {
|
res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...)
|
||||||
log.Error("Unable to update collection: %v", err)
|
if err != nil {
|
||||||
return err
|
log.Error("Unable to update collection: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowsAffected, _ = res.RowsAffected()
|
rowsAffected, _ = res.RowsAffected()
|
||||||
|
|
Loading…
Reference in New Issue