package stories import ( "time" "git.aiterp.net/rpdata/api/models" ) // Add creates a new story. func Add(name, author string, category models.StoryCategory, listed, open bool, tags []models.Tag, createdDate, fictionalDate time.Time) (models.Story, error) { story := models.Story{ ID: makeStoryID(), Name: name, Author: author, Category: category, Listed: listed, Open: open, Tags: tags, CreatedDate: createdDate, FictionalDate: fictionalDate, UpdatedDate: createdDate, } err := collection.Insert(story) if err != nil { return models.Story{}, err } return story, nil }