sklad: proper validations on container update
This commit is contained in:
parent
88560a8fbf
commit
81927e9017
@ -205,6 +205,13 @@ func dbContainerCreate(c *Container) error {
|
||||
}
|
||||
|
||||
func dbContainerUpdate(c *Container, updated Container) error {
|
||||
if _, ok := indexSeries[updated.Series]; !ok {
|
||||
return errNoSuchSeries
|
||||
}
|
||||
if updated.Parent != "" && indexContainer[updated.Parent] == nil {
|
||||
return errNoSuchContainer
|
||||
}
|
||||
|
||||
newID := updated.Id()
|
||||
if updated.Series != c.Series && len(c.Children()) > 0 {
|
||||
return errCannotChangeSeriesNotEmpty
|
||||
|
Loading…
Reference in New Issue
Block a user