Skip to content

Commit

Permalink
add required quests (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
morphy2k committed Mar 13, 2023
1 parent 42563a4 commit 09497da
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions model/hideout/production/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Production struct {
ID objectID `json:"_id" bson:"_id"`
Module objectID `json:"module" bson:"module"`
RequiredModules []ModuleRef `json:"requiredMods" bson:"requiredMods"`
RequiredQuests []Quest `json:"requiredQuests" bson:"requiredQuests"`
Materials []ItemRef `json:"materials" bson:"materials"`
Tools []ItemRef `json:"tools" bson:"tools"`
Outcome []ItemRef `json:"outcome" bson:"outcome"`
Expand Down Expand Up @@ -101,6 +102,20 @@ func (i ItemRef) Validate() error {
return nil
}

// Quest describes a quest requirement of a production
type Quest struct {
Name string `json:"name" bson:"name"`
}

// Validate validates the fields of a quest requirement
func (q Quest) Validate() error {
if len(q.Name) < 3 {
return errors.New("name is too short or not set")
}

return nil
}

// Collection indicates the MongoDB production collection
const Collection = "production"

Expand Down

0 comments on commit 09497da

Please sign in to comment.