diff --git a/api/src/prescription/campaign/application/campaign-controller.js b/api/src/prescription/campaign/application/campaign-controller.js index f3eeeeadccb..62c5eae96ba 100644 --- a/api/src/prescription/campaign/application/campaign-controller.js +++ b/api/src/prescription/campaign/application/campaign-controller.js @@ -23,7 +23,7 @@ const getGroups = async function (request) { const getAnalysis = async function (request, h, dependencies = { campaignAnalysisSerializer }) { const { userId } = request.auth.credentials; - const campaignId = request.params.id; + const { campaignId } = request.params; const locale = extractLocaleFromRequest(request); const campaignAnalysis = await usecases.computeCampaignAnalysis({ userId, campaignId, locale }); return dependencies.campaignAnalysisSerializer.serialize(campaignAnalysis); diff --git a/api/src/prescription/campaign/application/campaign-route.js b/api/src/prescription/campaign/application/campaign-route.js index 2e72d600119..97d62a5c9f8 100644 --- a/api/src/prescription/campaign/application/campaign-route.js +++ b/api/src/prescription/campaign/application/campaign-route.js @@ -42,11 +42,11 @@ const register = async function (server) { }, { method: 'GET', - path: '/api/campaigns/{id}/analyses', + path: '/api/campaigns/{campaignId}/analyses', config: { validate: { params: Joi.object({ - id: identifiersType.campaignId, + campaignId: identifiersType.campaignId, }), }, handler: campaignController.getAnalysis, diff --git a/api/tests/acceptance/application/campaigns/campaign-controller_test.js b/api/tests/acceptance/application/campaigns/campaign-controller_test.js index 8d2a0b95011..9c436b77238 100644 --- a/api/tests/acceptance/application/campaigns/campaign-controller_test.js +++ b/api/tests/acceptance/application/campaigns/campaign-controller_test.js @@ -12,7 +12,7 @@ describe('Acceptance | API | Campaign Controller', function () { server = await createServer(); }); - describe('PATCH /api/campaigns/{id}', function () { + describe('PATCH /api/campaigns/{campaignId}', function () { it('should return 200 when user is admin but not owner of the campaign', async function () { // given const organization = databaseBuilder.factory.buildOrganization(); diff --git a/api/tests/prescription/campaign/acceptance/application/campaign-route_test.js b/api/tests/prescription/campaign/acceptance/application/campaign-route_test.js index 63d85c76196..f5693bec6e6 100644 --- a/api/tests/prescription/campaign/acceptance/application/campaign-route_test.js +++ b/api/tests/prescription/campaign/acceptance/application/campaign-route_test.js @@ -64,7 +64,7 @@ describe('Acceptance | API | Campaign Route', function () { }); }); - describe('GET /api/campaigns/{id}/analyses', function () { + describe('GET /api/campaigns/{campaignId}/analyses', function () { let userId, organization, campaign; describe('skill Ids provide by the campaign', function () { diff --git a/api/tests/prescription/campaign/unit/application/campaign-controller_test.js b/api/tests/prescription/campaign/unit/application/campaign-controller_test.js index a9e84832df3..685d2138265 100644 --- a/api/tests/prescription/campaign/unit/application/campaign-controller_test.js +++ b/api/tests/prescription/campaign/unit/application/campaign-controller_test.js @@ -29,7 +29,7 @@ describe('Unit | Application | Controller | Campaign', function () { const request = { auth: { credentials: { userId } }, - params: { id: campaignId }, + params: { campaignId }, headers: { 'accept-language': locale }, }; @@ -46,7 +46,7 @@ describe('Unit | Application | Controller | Campaign', function () { // given const error = new UserNotAuthorizedToAccessEntityError('User does not have access to this campaign'); const request = { - params: { id: campaignId }, + params: { campaignId }, auth: { credentials: { userId }, }, diff --git a/api/tests/prescription/campaign/unit/application/campaign-route_test.js b/api/tests/prescription/campaign/unit/application/campaign-route_test.js index 235521d7e14..00af63752c1 100644 --- a/api/tests/prescription/campaign/unit/application/campaign-route_test.js +++ b/api/tests/prescription/campaign/unit/application/campaign-route_test.js @@ -57,7 +57,7 @@ describe('Unit | Application | Router | campaign-router ', function () { }); }); - describe('GET /api/campaigns/{id}/analyses', function () { + describe('GET /api/campaigns/{campaignId}/analyses', function () { it('should return 200', async function () { // given sinon.stub(campaignController, 'getAnalysis').callsFake((request, h) => h.response('ok').code(200));