Cleaning
This commit is contained in:
@@ -28,9 +28,9 @@ module GraphQL
|
|||||||
if SCALAR_TYPES[type]
|
if SCALAR_TYPES[type]
|
||||||
:scalar
|
:scalar
|
||||||
elsif type.class == Class
|
elsif type.class == Class
|
||||||
:simple_association
|
:singular_association
|
||||||
elsif type.class == Array
|
elsif type.class == Array
|
||||||
:paginated_association
|
:multiple_association
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,11 +47,11 @@ module GraphQL
|
|||||||
case ApiTypesCreator.type_kind(field_type)
|
case ApiTypesCreator.type_kind(field_type)
|
||||||
when :scalar
|
when :scalar
|
||||||
field(field_name, SCALAR_TYPES[field_type])
|
field(field_name, SCALAR_TYPES[field_type])
|
||||||
when :simple_association
|
when :singular_association
|
||||||
field(field_name, -> { api_types_creator.created_types[field_type] }) do
|
field(field_name, -> { api_types_creator.created_types[field_type] }) do
|
||||||
resolve -> (object, arguments, context) { field_type.public_for_api.find(object) }
|
resolve -> (object, arguments, context) { field_type.public_for_api.find_by(id: object.id) }
|
||||||
end
|
end
|
||||||
when :paginated_association
|
when :multiple_association
|
||||||
field_type = field_type.first
|
field_type = field_type.first
|
||||||
connection(field_name, -> { api_types_creator.created_types[field_type].connection_type }) do
|
connection(field_name, -> { api_types_creator.created_types[field_type].connection_type }) do
|
||||||
resolve -> (object, arguments, context) { field_type.public_for_api }
|
resolve -> (object, arguments, context) { field_type.public_for_api }
|
||||||
|
|||||||
Reference in New Issue
Block a user