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
notice { url }
deliberation { url }
demarcheUrl
cadreJuridiqueUrl
service @include(if: $includeService) {
...ServiceFragment

View file

@ -75,7 +75,11 @@ Cela évite laccè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

View file

@ -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

View file

@ -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",