Agregue nuevas queries, como consultar datos por sexo y por id

parent 3921d99d
import graphene
from graphene_django import DjangoObjectType
from graphene_django import DjangoListField, DjangoObjectType
from .models import Datos_personales, Estudios, Antecedentes, Autoevaluacion_salud, Percepcion, Personalidad, Estatus_economico, Nutricion, Actividad_fisica, Informacion_salud, Observaciones, Antropometria, Laboratorio, Bioimpedancia
......@@ -117,7 +117,10 @@ class BioimpedanciaType(DjangoObjectType):
class Query(graphene.ObjectType):
all_datos = graphene.List(Datos_personalesType)
all_estudios = graphene.List(EstudiosType)
datos = graphene.Field(Datos_personalesType,id=graphene.Int())
filter_sexo = graphene.List(Datos_personalesType, sex = graphene.String())
all_estudios = graphene.Field(EstudiosType, id=graphene.Int())
all_antecedentes = graphene.List(AntecedentesType)
all_autoevaluacion = graphene.List(Autoevaluacion_saludType)
all_percepcion = graphene.List(PercepcionType)
......@@ -131,11 +134,18 @@ class Query(graphene.ObjectType):
all_laboratorio = graphene.List(LaboratorioType)
all_bioimpedancia = graphene.List(BioimpedanciaType)
#Queries para Datos_personales
def resolve_all_datos(root,info):
return Datos_personales.objects.all()
def resolve_all_estudios(root,info):
return Estudios.objects.all()
def resolve_datos(root,info,id):
return Datos_personales.objects.get(pk=id)
def resolve_filter_sexo(root,info,sex):
return Datos_personales.objects.filter(sexo=sex)
#Queries para Estudios
def resolve_all_estudios(root,info,id):
return Estudios.objects.get(pk=id)
def resolve_all_antecedentes(root,info):
return Antecedentes.objects.all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment