mirror of
https://github.com/rjNemo/federation
synced 2026-06-06 10:16:39 +00:00
21 lines
466 B
Python
21 lines
466 B
Python
from random import choice, randint
|
|
from string import ascii_letters
|
|
|
|
from ariadne import QueryType
|
|
|
|
from product.models.product import Product
|
|
|
|
query = QueryType()
|
|
|
|
|
|
@query.field("topProducts")
|
|
def resolve_top_products(*_, first: int):
|
|
return [
|
|
Product(
|
|
upc=choice(ascii_letters),
|
|
price=randint(0, first),
|
|
weight=randint(0, first),
|
|
name=choice(ascii_letters),
|
|
)
|
|
for _ in range(first)
|
|
]
|