added author
This commit is contained in:
parent
0b732b8205
commit
652e6ea553
@ -36,6 +36,22 @@ func createShema(repo repo.Repo) graphql.Schema {
|
||||
"score": &graphql.Field{
|
||||
Type: graphql.NewNonNull(graphql.Int),
|
||||
},
|
||||
"author": &graphql.Field{
|
||||
Type: graphql.NewNonNull(player),
|
||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||
game, ok := p.Source.(*model.Game)
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
player, err := repo.GetPlayer(game.Author)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return player, nil
|
||||
},
|
||||
},
|
||||
"team0player0": &graphql.Field{
|
||||
Type: graphql.NewNonNull(player),
|
||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||
@ -170,7 +186,7 @@ func createShema(repo repo.Repo) graphql.Schema {
|
||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||
id, ok := p.Args["id"].(string)
|
||||
if !ok {
|
||||
log.Println("Failed to parse ID at player: %v", p.Args["id"])
|
||||
log.Println("Failed to parse ID at player: %v", p.Args["id"])
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@ -193,7 +209,7 @@ func createShema(repo repo.Repo) graphql.Schema {
|
||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||
id, ok := p.Args["id"].(string)
|
||||
if !ok {
|
||||
log.Println("Failed to parse ID at game: %v", p.Args["id"])
|
||||
log.Println("Failed to parse ID at game: %v", p.Args["id"])
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@ -216,7 +232,7 @@ func createShema(repo repo.Repo) graphql.Schema {
|
||||
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
|
||||
id, ok := p.Args["id"].(string)
|
||||
if !ok {
|
||||
log.Println("Failed to parse ID at gameResult: %v", p.Args["id"])
|
||||
log.Println("Failed to parse ID at gameResult: %v", p.Args["id"])
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user