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):
exclude_fields = ("password")
interfaces = (relay.Node, )
class UserConnections(relay.Connection):
class Meta:
node = User
class Application(SQLAlchemyObjectType):
class Meta:
model = ApplicationModel
interfaces = (relay.Node, )
class ApplicationConnections(relay.Connection):
class Meta:
node = Application
class Role(SQLAlchemyObjectType):
class Meta:
model = RoleModel
interfaces = (relay.Node, )
class RoleConnections(relay.Connection):
class Meta:
node = Role
class Query(graphene.ObjectType):
node = relay.Node.Field()
all_users = SQLAlchemyConnectionField(UserConnections)
all_application = SQLAlchemyConnectionField(ApplicationConnections)
all_roles = SQLAlchemyConnectionField(RoleConnections)
all_users = SQLAlchemyConnectionField(User)
find_user = graphene.Field(User,username=graphene.String())
def resolve_find_user(root, info, username):
query = User.get_query(info)
return query.filter(UserModel.username == username).first()
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