✨ Add basic graphql API using strawberry 🍓

✨ Add allProducts query
This commit is contained in:
nikolark committed 2021-10-30 16:54:28 +02:00
1 parent e2db9052bc
commit fa89353525
12 files changed
+215 -114

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
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)