Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename return-requirements route return-versions #1431

Merged
merged 6 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/controllers/licences.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @module LicencesController
*/

const InitiateSessionService = require('../services/return-requirements/setup/initiate-session.service.js')
const InitiateSessionService = require('../services/return-versions/setup/initiate-session.service.js')
const LicenceSupplementaryProcessBillingFlagService = require('../services/licences/supplementary/process-billing-flag.service.js')
const MarkedForSupplementaryBillingService = require('../services/licences/supplementary/marked-for-supplementary-billing.service.js')
const MarkForSupplementaryBillingService = require('../services/licences/supplementary/mark-for-supplementary-billing.service.js')
Expand Down Expand Up @@ -50,15 +50,15 @@ async function noReturnsRequired (request, h) {

const session = await InitiateSessionService.go(id, 'no-returns-required')

return h.redirect(`/system/return-requirements/setup/${session.id}/start-date`)
return h.redirect(`/system/return-versions/setup/${session.id}/start-date`)
}

async function returnsRequired (request, h) {
const { id } = request.params

const session = await InitiateSessionService.go(id, 'returns-required')

return h.redirect(`/system/return-requirements/setup/${session.id}/start-date`)
return h.redirect(`/system/return-versions/setup/${session.id}/start-date`)
}

async function submitMarkForSupplementaryBilling (request, h) {
Expand Down
21 changes: 0 additions & 21 deletions app/controllers/return-requirements.controller.js

This file was deleted.

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions app/controllers/return-versions.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

/**
* Controller for /return-versions endpoints
* @module ReturnVersionsController
*/

const ViewService = require('../services/return-versions/view.service.js')

async function view (request, h) {
const { id } = request.params
const pageData = await ViewService.go(id)

return h.view('return-versions/view.njk', {
...pageData
})
}

module.exports = {
view
}
8 changes: 4 additions & 4 deletions app/plugins/router.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const ImportRoutes = require('../routes/import.routes.js')
const JobRoutes = require('../routes/jobs.routes.js')
const LicenceRoutes = require('../routes/licence.routes.js')
const MonitoringStationRoutes = require('../routes/monitoring-station.routes.js')
const ReturnRequirementsRoutes = require('../routes/return-requirements.routes.js')
const ReturnRequirementsSetupRoutes = require('../routes/return-requirements-setup.routes.js')
const ReturnVersionsSetupRoutes = require('../routes/return-versions-setup.routes.js')
const ReturnVersionsRoutes = require('../routes/return-versions.routes.js')
const RootRoutes = require('../routes/root.routes.js')

const AirbrakeConfig = require('../../config/airbrake.config.js')
Expand All @@ -44,8 +44,8 @@ const routes = [
...LicenceRoutes,
...JobRoutes,
...MonitoringStationRoutes,
...ReturnRequirementsRoutes,
...ReturnRequirementsSetupRoutes,
...ReturnVersionsRoutes,
...ReturnVersionsSetupRoutes,
...DataRoutes,
...ImportRoutes
]
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/licences/view-licence-history.presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function _returnVersionEntries (licence) {
dateCreated: formatLongDate(createdAt),
displayNote: notes.length > 0,
notes,
link: `/system/return-requirements/${returnVersion.id}`,
link: `/system/return-versions/${returnVersion.id}`,
reason: mappedReason ?? reason,
type: { index: 2, name: 'Return version' }
}
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/licences/view-licence-set-up.presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function _returnVersions (returnVersions = [{}]) {
return {
action: [{
text: 'View',
link: `/system/return-requirements/${returnVersion.id}`
link: `/system/return-versions/${returnVersion.id}`
}],
endDate: returnVersion.endDate ? formatLongDate(returnVersion.endDate) : '',
reason: _reason(returnVersion),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/abstraction-period` page
* Formats data for the `/return-versions/setup/{sessionId}/abstraction-period` page
* @module AbstractionPeriodPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/abstraction-period` page
* Formats data for the `/return-versions/setup/{sessionId}/abstraction-period` page
*
* @param {module:SessionModel} session - The returns requirements session instance
* @param {string} requirementIndex - The index of the requirement being added or changed
Expand All @@ -30,10 +30,10 @@ function _backLink (session, requirementIndex) {
const { checkPageVisited, id } = session

if (checkPageVisited) {
return `/system/return-requirements/setup/${id}/check`
return `/system/return-versions/setup/${id}/check`
}

return `/system/return-requirements/setup/${id}/points/${requirementIndex}`
return `/system/return-versions/setup/${id}/points/${requirementIndex}`
}

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/additional-submission-options` page
* Formats data for the `/return-versions/setup/{sessionId}/additional-submission-options` page
* @module AdditionalSubmissionOptionsPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/additional-submission-options` page
* Formats data for the `/return-versions/setup/{sessionId}/additional-submission-options` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand All @@ -16,7 +16,7 @@ function go (session) {
const { id: sessionId, licence: { id: licenceId, licenceRef }, additionalSubmissionOptions } = session
const data = {
additionalSubmissionOptions: additionalSubmissionOptions ?? [],
backLink: `/system/return-requirements/setup/${sessionId}/check`,
backLink: `/system/return-versions/setup/${sessionId}/check`,
licenceId,
licenceRef,
sessionId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/agreements-exceptions` page
* Formats data for the `/return-versions/setup/{sessionId}/agreements-exceptions` page
* @module AgreementsExceptionsPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/agreements-exceptions` page
* Formats data for the `/return-versions/setup/{sessionId}/agreements-exceptions` page
*
* @param {module:SessionModel} session - The returns requirements session instance
* @param {string} requirementIndex - The index of the requirement being added or changed
Expand All @@ -30,10 +30,10 @@ function _backLink (session, requirementIndex) {
const { checkPageVisited, id } = session

if (checkPageVisited) {
return `/system/return-requirements/setup/${id}/check`
return `/system/return-versions/setup/${id}/check`
}

return `/system/return-requirements/setup/${id}/frequency-reported/${requirementIndex}`
return `/system/return-versions/setup/${id}/frequency-reported/${requirementIndex}`
}

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/cancel` page
* Formats data for the `/return-versions/setup/{sessionId}/cancel` page
* @module CancelRequirementsPresenter
*/

const { formatLongDate } = require('../../base.presenter.js')
const { returnRequirementFrequencies, returnRequirementReasons } = require('../../../lib/static-lookups.lib.js')

/**
* Formats data for the `/return-requirements/setup/{sessionId}/cancel` page
* Formats data for the `/return-versions/setup/{sessionId}/cancel` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand All @@ -19,7 +19,7 @@ function go (session) {
const { id: sessionId, journey, licence, reason, requirements } = session

return {
backLink: `/system/return-requirements/setup/${sessionId}/check`,
backLink: `/system/return-versions/setup/${sessionId}/check`,
licenceId: licence.id,
licenceRef: licence.licenceRef,
reason: returnRequirementReasons[reason],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/check` page
* Formats data for the `/return-versions/setup/{sessionId}/check` page
* @module CheckPresenter
*/

const { formatLongDate } = require('../../../base.presenter.js')
const { returnRequirementReasons } = require('../../../../lib/static-lookups.lib.js')

/**
* Formats data for the `/return-requirements/setup/{sessionId}/check` page
* Formats data for the `/return-versions/setup/{sessionId}/check` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand Down Expand Up @@ -53,10 +53,10 @@ function _note (note) {

function _reasonLink (sessionId, returnsRequired) {
if (returnsRequired) {
return `/system/return-requirements/setup/${sessionId}/reason`
return `/system/return-versions/setup/${sessionId}/reason`
}

return `/system/return-requirements/setup/${sessionId}/no-returns-required`
return `/system/return-versions/setup/${sessionId}/no-returns-required`
}

function _startDate (session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/**
* Formats return requirements data for the `/return-requirements/setup/{sessionId}/check` page
* Formats return requirements data for the `/return-versions/setup/{sessionId}/check` page
* @module ReturnRequirementsPresenter
*/

Expand All @@ -17,7 +17,7 @@ const AGREEMENTS_EXCEPTIONS = {
}

/**
* Formats return requirements data for the `/return-requirements/setup/{sessionId}/check` page
* Formats return requirements data for the `/return-versions/setup/{sessionId}/check` page
*
* @param {object[]} requirements - The existing return requirements in the current session
* @param {module:PointModel[]} points - All points linked to the licence version purposes linked to the current licence
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/existing` page
* Formats data for the `/return-versions/setup/{sessionId}/existing` page
* @module ExistingPresenter
*/

const { formatLongDate } = require('../../base.presenter.js')
const { returnRequirementReasons } = require('../../../lib/static-lookups.lib.js')

/**
* Formats data for the `/return-requirements/setup/{sessionId}/existing` page
* Formats data for the `/return-versions/setup/{sessionId}/existing` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/frequency-collected` page
* Formats data for the `/return-versions/setup/{sessionId}/frequency-collected` page
* @module FrequencyCollectedPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/frequency-collected` page
* Formats data for the `/return-versions/setup/{sessionId}/frequency-collected` page
*
* @param {module:SessionModel} session - The returns requirements session instance
* @param {string} requirementIndex - The index of the requirement being added or changed
Expand All @@ -30,10 +30,10 @@ function _backLink (session, requirementIndex) {
const { checkPageVisited, id } = session

if (checkPageVisited) {
return `/system/return-requirements/setup/${id}/check`
return `/system/return-versions/setup/${id}/check`
}

return `/system/return-requirements/setup/${id}/site-description/${requirementIndex}`
return `/system/return-versions/setup/${id}/site-description/${requirementIndex}`
}

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/frequency-reported` page
* Formats data for the `/return-versions/setup/{sessionId}/frequency-reported` page
* @module FrequencyReportedPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/frequency-reported` page
* Formats data for the `/return-versions/setup/{sessionId}/frequency-reported` page
*
* @param {module:SessionModel} session - The returns requirements session instance
* @param {string} requirementIndex - The index of the requirement being added or changed
Expand All @@ -30,10 +30,10 @@ function _backLink (session, requirementIndex) {
const { checkPageVisited, id } = session

if (checkPageVisited) {
return `/system/return-requirements/setup/${id}/check`
return `/system/return-versions/setup/${id}/check`
}

return `/system/return-requirements/setup/${id}/frequency-collected/${requirementIndex}`
return `/system/return-versions/setup/${id}/frequency-collected/${requirementIndex}`
}

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/method` page
* Formats data for the `/return-versions/setup/{sessionId}/method` page
* @module MethodPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/method` page
* Formats data for the `/return-versions/setup/{sessionId}/method` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand All @@ -16,7 +16,7 @@ function go (session) {
const { id: sessionId, licence, method } = session

return {
backLink: `/system/return-requirements/setup/${sessionId}/reason`,
backLink: `/system/return-versions/setup/${sessionId}/reason`,
displayCopyExisting: licence.returnVersions.length > 0,
licenceRef: licence.licenceRef,
method: method ?? null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

/**
* Formats data for the `/return-requirements/setup/{sessionId}/no-returns-required` page
* Formats data for the `/return-versions/setup/{sessionId}/no-returns-required` page
* @module NoReturnsRequiredPresenter
*/

/**
* Formats data for the `/return-requirements/setup/{sessionId}/no-returns-required` page
* Formats data for the `/return-versions/setup/{sessionId}/no-returns-required` page
*
* @param {module:SessionModel} session - The returns requirements session instance
*
Expand All @@ -27,10 +27,10 @@ function _backLink (session) {
const { checkPageVisited, id } = session

if (checkPageVisited) {
return `/system/return-requirements/setup/${id}/check`
return `/system/return-versions/setup/${id}/check`
}

return `/system/return-requirements/setup/${id}/start-date`
return `/system/return-versions/setup/${id}/start-date`
}

module.exports = {
Expand Down
Loading
Loading