GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
813 B

  1. package models
  2. import "time"
  3. // A Chapter is a part of a story.
  4. type Chapter struct {
  5. ID string `bson:"_id"`
  6. StoryID string `bson:"storyId"`
  7. Title string `bson:"title"`
  8. Author string `bson:"author"`
  9. Source string `bson:"source"`
  10. CreatedDate time.Time `bson:"createdDate"`
  11. FictionalDate time.Time `bson:"fictionalDate,omitempty"`
  12. EditedDate time.Time `bson:"editedDate"`
  13. CommentMode ChapterCommentMode `bson:"commentMode"`
  14. CommentsLocked bool `bson:"commentsLocked"`
  15. }
  16. // CanComment returns true if the chapter can be commented to.
  17. func (chapter *Chapter) CanComment() bool {
  18. return !chapter.CommentsLocked && chapter.CommentMode.IsEnabled()
  19. }