@@ -14,33 +14,18 @@ class Meta:
14
14
interfaces = (relay .Node , )
15
15
16
16
17
- class DepartmentConnection (relay .Connection ):
18
- class Meta :
19
- node = Department
20
-
21
-
22
17
class Employee (SQLAlchemyObjectType ):
23
18
class Meta :
24
19
model = EmployeeModel
25
20
interfaces = (relay .Node , )
26
21
27
22
28
- class EmployeeConnection (relay .Connection ):
29
- class Meta :
30
- node = Employee
31
-
32
-
33
23
class Role (SQLAlchemyObjectType ):
34
24
class Meta :
35
25
model = RoleModel
36
26
interfaces = (relay .Node , )
37
27
38
28
39
- class RoleConnection (relay .Connection ):
40
- class Meta :
41
- node = Role
42
-
43
-
44
29
SortEnumEmployee = utils .sort_enum_for_model (EmployeeModel , 'SortEnumEmployee' ,
45
30
lambda c , d : c .upper () + ('_ASC' if d else '_DESC' ))
46
31
@@ -49,14 +34,14 @@ class Query(graphene.ObjectType):
49
34
node = relay .Node .Field ()
50
35
# Allow only single column sorting
51
36
all_employees = SQLAlchemyConnectionField (
52
- EmployeeConnection ,
37
+ Employee ,
53
38
sort = graphene .Argument (
54
39
SortEnumEmployee ,
55
40
default_value = utils .EnumValue ('id_asc' , EmployeeModel .id .asc ())))
56
41
# Allows sorting over multiple columns, by default over the primary key
57
- all_roles = SQLAlchemyConnectionField (RoleConnection )
42
+ all_roles = SQLAlchemyConnectionField (Role )
58
43
# Disable sorting over this field
59
- all_departments = SQLAlchemyConnectionField (DepartmentConnection , sort = None )
44
+ all_departments = SQLAlchemyConnectionField (Department , sort = None )
60
45
61
46
62
47
schema = graphene .Schema (query = Query , types = [Department , Employee , Role ])
0 commit comments