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