Merge pull request #8636 from tchak/fix-graphql-demarche-lien

fix(graphql): fix demarcheUrl
This commit is contained in:
Paul Chavard 2023-02-21 12:28:28 +01:00 committed by GitHub
commit 0416ea0453
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -288,6 +288,7 @@ class API::V2::StoredQuery
dateFermeture dateFermeture
notice { url } notice { url }
deliberation { url } deliberation { url }
demarcheUrl
cadreJuridiqueUrl cadreJuridiqueUrl
service @include(if: $includeService) { service @include(if: $includeService) {
...ServiceFragment ...ServiceFragment

View file

@ -75,7 +75,11 @@ Cela évite laccès récursif aux dossiers."
delegate :description, :opendata, :tags, to: :procedure delegate :description, :opendata, :tags, to: :procedure
def demarche_url 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 end
def dpo_url def dpo_url

View file

@ -138,6 +138,7 @@ describe API::V2::GraphqlController do
it { it {
expect(gql_errors).to be_nil expect(gql_errors).to be_nil
expect(gql_data[:demarcheDescriptor][:id]).to eq(procedure.to_typed_id) expect(gql_data[:demarcheDescriptor][:id]).to eq(procedure.to_typed_id)
expect(gql_data[:demarcheDescriptor][:demarcheUrl]).to match("commencer/#{procedure.path}")
} }
end end

View file

@ -17,7 +17,7 @@ describe DemarchesPubliquesExportService do
typeOrganisme: "association" typeOrganisme: "association"
}, },
cadreJuridiqueUrl: "un cadre juridique important", cadreJuridiqueUrl: "un cadre juridique important",
demarcheUrl: nil, demarcheUrl: Rails.application.routes.url_helpers.commencer_url(path: procedure.path),
dpoUrl: nil, dpoUrl: nil,
noticeUrl: nil, noticeUrl: nil,
siteWebUrl: "https://mon-site.gouv", siteWebUrl: "https://mon-site.gouv",