From 12689fb4b11709becbdc2bda9cf6a40e54b8d41e Mon Sep 17 00:00:00 2001 From: Markus Wiegand Date: Fri, 8 Jul 2022 13:37:48 +0200 Subject: [PATCH] add tools to hideout production (#116) --- model/hideout/production/production.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/model/hideout/production/production.go b/model/hideout/production/production.go index 04db283..917a78d 100644 --- a/model/hideout/production/production.go +++ b/model/hideout/production/production.go @@ -27,6 +27,7 @@ type Production struct { Module objectID `json:"module" bson:"module"` RequiredModules []ModuleRef `json:"requiredMods" bson:"requiredMods"` Materials []ItemRef `json:"materials" bson:"materials"` + Tools []ItemRef `json:"tools" bson:"tools"` Outcome []ItemRef `json:"outcome" bson:"outcome"` Duration int64 `json:"duration" bson:"duration"` Modified timestamp `json:"_modified" bson:"_modified"` @@ -41,6 +42,12 @@ func (p Production) Validate() error { return errors.New("outcome missing") } + for i, v := range p.Tools { + if err := v.Validate(); err != nil { + return fmt.Errorf("validation error in tools index \"%v\": %s", i, err) + } + } + for i, v := range p.Materials { if err := v.Validate(); err != nil { return fmt.Errorf("validation error in materials index \"%v\": %s", i, err)