added author

This commit is contained in:
Niklas Kapelle 2025-01-10 17:03:12 +01:00
parent 0b732b8205
commit 652e6ea553
Signed by: niklas
GPG Key ID: 4EB651B36D841D16

View File

@ -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) {