Files
bbs/main/api/schema.py
T
nikolark fa89353525 ✨ Add basic graphql API using strawberry 🍓
✨ Add allProducts query
2021-10-30 16:54:28 +02:00

21 lines
347 B
Python

import strawberry
from strawberry_django import auto
from main import models
@strawberry.django.type(models.Product)
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)