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.
 
 

68 lines
1.6 KiB

package models
import "time"
// Log is the header/session for a log file.
type Log struct {
ID string `bson:"_id"`
ShortID string `bson:"shortId"`
Date time.Time `bson:"date"`
ChannelName string `bson:"channel"`
EventName string `bson:"event,omitempty"`
Title string `bson:"title,omitempty"`
Description string `bson:"description,omitempty"`
Open bool `bson:"open"`
CharacterIDs []string `bson:"characterIds"`
}
func (log *Log) ApplyUpdate(update LogUpdate) {
if update.Open != nil {
log.Open = *update.Open
}
if update.EventName != nil {
log.EventName = *update.EventName
}
if update.Title != nil {
log.Title = *update.Title
}
if update.Description != nil {
log.Description = *update.Description
}
if update.CharacterIDs != nil {
log.CharacterIDs = update.CharacterIDs
}
}
// A LogSuggestion is a suggestion for a log.
type LogSuggestion struct {
Log *Log
Characters []*Character
HasChannel bool
HasEvent bool
}
// IsChangeObject is an interface implementation to identify it as a valid
// ChangeObject in GQL.
func (*Log) IsChangeObject() {
panic("this method is a dummy, and so is its caller")
}
// A LogFilter is a filter that can be used to list logs.
type LogFilter struct {
Open *bool
Characters []string
Channels []string
Events []string
MinDate *time.Time
MaxDate *time.Time
Search *string
Limit int
}
type LogUpdate struct {
Title *string
EventName *string
Description *string
Open *bool
CharacterIDs []string
}