add nextLogs and prevLogs suggestions to log.
This commit is contained in:
@@ -164,6 +164,12 @@ func complexity() (cr graphcore.ComplexityRoot) {
|
||||
cr.Log.Posts = func(childComplexity int, kinds []string) int {
|
||||
return childComplexity + hugeSublistComplexity
|
||||
}
|
||||
cr.Log.NextLogs = func(childComplexity int) int {
|
||||
return childComplexity + (subListComplexity / 2)
|
||||
}
|
||||
cr.Log.PrevLogs = func(childComplexity int) int {
|
||||
return childComplexity + (subListComplexity / 2)
|
||||
}
|
||||
|
||||
cr.Story.Chapters = func(childComplexity int) int {
|
||||
return childComplexity + bigSublistComplexity
|
||||
|
||||
@@ -37,6 +37,8 @@ models:
|
||||
model: git.aiterp.net/rpdata/api/models.LogFilter
|
||||
LogImporter:
|
||||
model: git.aiterp.net/rpdata/api/models.LogImporter
|
||||
LogSuggestion:
|
||||
model: git.aiterp.net/rpdata/api/models.LogSuggestion
|
||||
Comment:
|
||||
model: git.aiterp.net/rpdata/api/models.Comment
|
||||
ChapterCommentMode:
|
||||
|
||||
@@ -34,6 +34,20 @@ type Log {
|
||||
|
||||
# The posts of the logfile, which can be filtered by kinds.
|
||||
posts(kinds:[String!]): [Post!]!
|
||||
|
||||
# Suggested next logs.
|
||||
nextLogs: [LogSuggestion!]!
|
||||
|
||||
# Suggested previous logs.
|
||||
prevLogs: [LogSuggestion!]!
|
||||
}
|
||||
|
||||
# Suggested log
|
||||
type LogSuggestion {
|
||||
log: Log!
|
||||
hasEvent: Boolean!
|
||||
hasChannel: Boolean!
|
||||
characters: [Character!]!
|
||||
}
|
||||
|
||||
# Filter for logs query
|
||||
|
||||
@@ -31,6 +31,14 @@ func (r *logResolver) Posts(ctx context.Context, log *models.Log, kinds []string
|
||||
return r.logs.ListPosts(ctx, &models.PostFilter{LogID: &log.ShortID})
|
||||
}
|
||||
|
||||
func (r *logResolver) NextLogs(ctx context.Context, obj *models.Log) ([]*models.LogSuggestion, error) {
|
||||
return r.logs.NextLogs(ctx, obj)
|
||||
}
|
||||
|
||||
func (r *logResolver) PrevLogs(ctx context.Context, obj *models.Log) ([]*models.LogSuggestion, error) {
|
||||
return r.logs.PrevLogs(ctx, obj)
|
||||
}
|
||||
|
||||
// LogResolver is a resolver
|
||||
func LogResolver(s *services.Bundle) *logResolver {
|
||||
return &logResolver{characters: s.Characters, logs: s.Logs, channels: s.Channels}
|
||||
|
||||
Reference in New Issue
Block a user