Skip to content
Snippets Groups Projects
Verified Commit ae2aeec8 authored by Mark's avatar Mark
Browse files

Simplify schema

parent 6d87c732
No related branches found
No related tags found
No related merge requests found
...@@ -11,38 +11,24 @@ class User(SQLAlchemyObjectType): ...@@ -11,38 +11,24 @@ class User(SQLAlchemyObjectType):
exclude_fields = ("password") exclude_fields = ("password")
interfaces = (relay.Node, ) interfaces = (relay.Node, )
class UserConnections(relay.Connection):
class Meta:
node = User
class Application(SQLAlchemyObjectType): class Application(SQLAlchemyObjectType):
class Meta: class Meta:
model = ApplicationModel model = ApplicationModel
interfaces = (relay.Node, ) interfaces = (relay.Node, )
class ApplicationConnections(relay.Connection):
class Meta:
node = Application
class Role(SQLAlchemyObjectType): class Role(SQLAlchemyObjectType):
class Meta: class Meta:
model = RoleModel model = RoleModel
interfaces = (relay.Node, ) interfaces = (relay.Node, )
class RoleConnections(relay.Connection):
class Meta:
node = Role
class Query(graphene.ObjectType): class Query(graphene.ObjectType):
node = relay.Node.Field() node = relay.Node.Field()
all_users = SQLAlchemyConnectionField(UserConnections) all_users = SQLAlchemyConnectionField(User)
all_application = SQLAlchemyConnectionField(ApplicationConnections) find_user = graphene.Field(User,username=graphene.String())
all_roles = SQLAlchemyConnectionField(RoleConnections)
def resolve_find_user(root, info, username):
query = User.get_query(info)
return query.filter(UserModel.username == username).first()
schema = graphene.Schema(query=Query) schema = graphene.Schema(query=Query)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment