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.
 
 

54 lines
1.4 KiB

package models
import "time"
// A Comment is a comment on a chapter.
type Comment struct {
ID string `bson:"_id"`
ChapterID string `bson:"chapterId"`
Subject string `bson:"subject"`
Author string `bson:"author"`
CharacterName string `bson:"characterName"`
CharacterID string `bson:"characterId"`
FictionalDate time.Time `bson:"fictionalDate"`
CreatedDate time.Time `bson:"createdDate"`
EditedDate time.Time `bson:"editedDate"`
Source string `bson:"source"`
}
func (comment *Comment) ApplyUpdate(update CommentUpdate) {
if update.Source != nil {
comment.Source = *update.Source
}
if update.CharacterName != nil {
comment.CharacterName = *update.CharacterName
}
if update.CharacterID != nil {
comment.CharacterID = *update.CharacterID
}
if update.Subject != nil {
comment.Subject = *update.Subject
}
if update.FictionalDate != nil {
comment.FictionalDate = *update.FictionalDate
}
}
// IsChangeObject is an interface implementation to identify it as a valid
// ChangeObject in GQL.
func (*Comment) IsChangeObject() {
panic("this method is a dummy, and so is its caller")
}
type CommentFilter struct {
ChapterID *string
Limit int
}
type CommentUpdate struct {
Source *string
CharacterName *string
CharacterID *string
Subject *string
FictionalDate *time.Time
}