Project files

This commit is contained in:
2023-11-09 18:47:11 +01:00
parent 695abe054b
commit c415135aae
8554 changed files with 858111 additions and 0 deletions

View File

View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class GraphqlapiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'graphqlapi'

View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,39 @@
import graphene
from receipe.models import Purchase, Article
from graphene_django.types import DjangoObjectType
# api-movie-model
class ArticleType(DjangoObjectType):
class Meta:
model = Article
fields = ("RowId",
"name")
class PurchaseType(DjangoObjectType):
class Meta:
model = Purchase
fields = ("purchase_date",
"payment_type",
"total_price",
"articles",
"created",
"modified")
class Query(graphene.ObjectType):
purchase = graphene.List(PurchaseType)
article = graphene.List(ArticleType)
def resolve_purchase(root, info):
return Purchase.objects.all()
def resolve_article(root, info):
return Article.objects.all()
schema = graphene.Schema(query=Query)

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.