This commit is contained in:
+19
-1
@@ -15,6 +15,24 @@ type Log struct {
|
||||
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
|
||||
@@ -31,13 +49,13 @@ func (*Log) IsChangeObject() {
|
||||
|
||||
// A LogFilter is a filter that can be used to list logs.
|
||||
type LogFilter struct {
|
||||
Search *string
|
||||
Open *bool
|
||||
Characters []string
|
||||
Channels []string
|
||||
Events []string
|
||||
MinDate *time.Time
|
||||
MaxDate *time.Time
|
||||
Search *string
|
||||
Limit int
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,21 @@ type Post struct {
|
||||
Position int `bson:"position"`
|
||||
}
|
||||
|
||||
func (post *Post) ApplyUpdate(update PostUpdate) {
|
||||
if update.Time != nil {
|
||||
post.Time = *update.Time
|
||||
}
|
||||
if update.Kind != nil {
|
||||
post.Kind = *update.Kind
|
||||
}
|
||||
if update.Nick != nil {
|
||||
post.Nick = *update.Nick
|
||||
}
|
||||
if update.Text != nil {
|
||||
post.Text = *update.Text
|
||||
}
|
||||
}
|
||||
|
||||
// IsChangeObject is an interface implementation to identify it as a valid
|
||||
// ChangeObject in GQL.
|
||||
func (*Post) IsChangeObject() {
|
||||
|
||||
Reference in New Issue
Block a user