Revision f0a91d3f
Added by Timo Goebel about 5 years ago
app/graphql/resolvers/domain/subnets.rb | ||
---|---|---|
includes = [:domains]
|
||
includes << { taxable_taxonomies: :taxonomy } if args[:location]
|
||
|
||
scope = ::Subnet.includes(includes)
|
||
.where(domains: { id: object.id })
|
||
.try { |query| args[:location] ? query.where(taxonomies: { type: 'Location', name: args[:location] }) : query }
|
||
.try { |query| args[:type] ? query.where(type: args[:type]) : query }
|
||
scope = lambda do |scope|
|
||
scope.includes(includes)
|
||
.where(domains: { id: object.id })
|
||
.try { |query| args[:location] ? query.where(taxonomies: { type: 'Location', name: args[:location] }) : query }
|
||
.try { |query| args[:type] ? query.where(type: args[:type]) : query }
|
||
end
|
||
|
||
CollectionLoader.for(object.class, :subnets, scope).load(object)
|
||
end
|
Also available in: Unified diff
fixes #26495 - graphql: properly auth resources