Skip to content

Commit

Permalink
add tools to hideout production (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
morphy2k committed Jul 8, 2022
1 parent d7b4443 commit 12689fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions model/hideout/production/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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)
Expand Down

0 comments on commit 12689fb

Please sign in to comment.