fix(graphql): n+1 on single dossier loading
This commit is contained in:
parent
9db84cfd25
commit
b5c189de63
1 changed files with 2 additions and 1 deletions
|
@ -38,11 +38,12 @@ module Types
|
|||
end
|
||||
|
||||
def dossier(number:)
|
||||
if context.internal_use?
|
||||
dossier = if context.internal_use?
|
||||
Dossier.state_not_brouillon.for_api_v2.find(number)
|
||||
else
|
||||
Dossier.visible_by_administration.for_api_v2.find(number)
|
||||
end
|
||||
DossierPreloader.load_one(dossier)
|
||||
rescue => e
|
||||
raise GraphQL::ExecutionError.new(e.message, extensions: { code: :not_found })
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue