Merge pull request #8636 from tchak/fix-graphql-demarche-lien
fix(graphql): fix demarcheUrl
This commit is contained in:
commit
0416ea0453
4 changed files with 8 additions and 2 deletions
|
@ -288,6 +288,7 @@ class API::V2::StoredQuery
|
|||
dateFermeture
|
||||
notice { url }
|
||||
deliberation { url }
|
||||
demarcheUrl
|
||||
cadreJuridiqueUrl
|
||||
service @include(if: $includeService) {
|
||||
...ServiceFragment
|
||||
|
|
|
@ -75,7 +75,11 @@ Cela évite l’accès récursif aux dossiers."
|
|||
delegate :description, :opendata, :tags, to: :procedure
|
||||
|
||||
def demarche_url
|
||||
procedure.lien_demarche
|
||||
if procedure.brouillon?
|
||||
Rails.application.routes.url_helpers.commencer_test_url(path: procedure.path)
|
||||
else
|
||||
Rails.application.routes.url_helpers.commencer_url(path: procedure.path)
|
||||
end
|
||||
end
|
||||
|
||||
def dpo_url
|
||||
|
|
|
@ -138,6 +138,7 @@ describe API::V2::GraphqlController do
|
|||
it {
|
||||
expect(gql_errors).to be_nil
|
||||
expect(gql_data[:demarcheDescriptor][:id]).to eq(procedure.to_typed_id)
|
||||
expect(gql_data[:demarcheDescriptor][:demarcheUrl]).to match("commencer/#{procedure.path}")
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe DemarchesPubliquesExportService do
|
|||
typeOrganisme: "association"
|
||||
},
|
||||
cadreJuridiqueUrl: "un cadre juridique important",
|
||||
demarcheUrl: nil,
|
||||
demarcheUrl: Rails.application.routes.url_helpers.commencer_url(path: procedure.path),
|
||||
dpoUrl: nil,
|
||||
noticeUrl: nil,
|
||||
siteWebUrl: "https://mon-site.gouv",
|
||||
|
|
Loading…
Reference in a new issue