pokeapi/graphql/examples/best_poison_grass_pokemon.gql
2021-03-23 19:43:58 +01:00

35 lines
727 B
GraphQL

"""
Returns the strongest 3 grass and poison pokemon. It uses thier stats to compute their strenght.
"""
query best_grass_poison_pokemons {
pokemon: pokemon_v2_pokemon(
where: {
_and: [
{
pokemon_v2_pokemontypes: {
pokemon_v2_type: { name: { _eq: "grass" } }
}
}
{
pokemon_v2_pokemontypes: {
pokemon_v2_type: { name: { _eq: "poison" } }
}
}
]
}
order_by: {
pokemon_v2_pokemonstats_aggregate: { sum: { base_stat: desc } }
}
limit: 3
) {
name
stats: pokemon_v2_pokemonstats_aggregate(order_by: {}) {
aggregate {
sum {
base_stat
}
}
}
}
}