graph, rpdata-server: Started on new GraphQL implementation.
the build failed

This commit is contained in:
2018-09-13 21:13:05 +02:00
parent 2e5162a29b
commit 9978d7380b
16 changed files with 482 additions and 14 deletions
+22
View File
@@ -0,0 +1,22 @@
package queries
import (
"context"
"errors"
"git.aiterp.net/rpdata/api/model/character"
)
func (r *resolver) Character(ctx context.Context, id *string, nick *string) (character.Character, error) {
if id != nil {
return character.FindID(*id)
} else if nick != nil {
return character.FindNick(*nick)
} else {
return character.Character{}, errors.New("You must specify either an ID or a nick")
}
}
func (r *resolver) Characters(ctx context.Context, filter *character.Filter) ([]character.Character, error) {
return character.List(filter)
}
+6
View File
@@ -0,0 +1,6 @@
package queries
type resolver struct{}
// Resolver has all the queries
var Resolver resolver
+11
View File
@@ -0,0 +1,11 @@
package queries
import (
"context"
"git.aiterp.net/rpdata/api/model/story"
)
func (r *resolver) Tags(ctx context.Context) ([]story.Tag, error) {
return story.ListTags()
}