[GraphQL] expose dossier pdf, geojson and attestation
This commit is contained in:
parent
e3f2421741
commit
0aa06d0197
8 changed files with 129 additions and 3 deletions
26
app/controllers/api/v2/dossiers_controller.rb
Normal file
26
app/controllers/api/v2/dossiers_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
class API::V2::DossiersController < API::V2::BaseController
|
||||
before_action :ensure_dossier_present
|
||||
|
||||
def pdf
|
||||
@include_infos_administration = true
|
||||
render(file: 'dossiers/show', formats: [:pdf])
|
||||
end
|
||||
|
||||
def geojson
|
||||
send_data dossier.to_feature_collection.to_json,
|
||||
type: 'application/json',
|
||||
filename: "dossier-#{dossier.id}-features.json"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_dossier_present
|
||||
if dossier.blank?
|
||||
head :unauthorized
|
||||
end
|
||||
end
|
||||
|
||||
def dossier
|
||||
@dossier ||= GlobalID::Locator.locate_signed(params[:id].to_s, for: 'api_v2')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue