pokeapi/graphql/examples/best_poison_grass_pokemon.gql

36 lines
727 B
Text
Raw Normal View History

2021-03-21 20:31:22 +00:00
"""
Returns the strongest 3 grass and poison pokemon. It uses thier stats to compute their strenght.
"""
2021-03-19 18:10:13 +00:00
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
}
}
}
}
}