aboutsummaryrefslogtreecommitdiff
path: root/cmd/sklad/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/sklad/db.go')
-rw-r--r--cmd/sklad/db.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/sklad/db.go b/cmd/sklad/db.go
index b58a5f2..fc79f0f 100644
--- a/cmd/sklad/db.go
+++ b/cmd/sklad/db.go
@@ -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