2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-31 10:37:40 +01:00
|
|
|
module Loaders
|
|
|
|
class Dossier < GraphQL::Batch::Loader
|
|
|
|
def load(key)
|
|
|
|
super(key.to_i)
|
|
|
|
end
|
|
|
|
|
|
|
|
def perform(keys)
|
|
|
|
query(keys).each { |record| fulfill(record.id, record) }
|
|
|
|
keys.each { |key| fulfill(key, nil) unless fulfilled?(key) }
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def query(keys)
|
2023-02-08 17:56:03 +01:00
|
|
|
::Dossier.visible_by_administration.for_api_v2.where(id: keys)
|
2022-10-31 10:37:40 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|