Files
bbs/main/api/schema.py
T
nikolark f0656b34e9 ✨ Register: Show list of active products
🛠 Generate apollo client typescript helpers from graphql schema
2021-10-30 17:29:16 +02:00

28 lines
498 B
Python

import strawberry
import strawberry_django
from strawberry_django import auto
from main import models
@strawberry_django.filters.filter(models.Product)
class ProductFilter:
id: auto
active: auto
@strawberry_django.type(models.Product, filters=ProductFilter)
class Product:
id: auto
name: auto
sale_price_int: auto
sale_price_ext: auto
@strawberry.type
class Query:
all_products: list[Product] = strawberry_django.field()
schema = strawberry.Schema(query=Query)