Skip to content

Commit

Permalink
Create route and controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozzey committed Dec 17, 2024
1 parent 52f0bd4 commit 9fce8fd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/controllers/return-logs.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'

const EditReturnLogService = require('../services/return-logs/edit-return-log.service.js')

/**
* Controller for /return-logs endpoints
* @module ReturnLogsController
*/

async function edit(request, h) {
const { returnLogId } = request.params

const pageData = EditReturnLogService.go(returnLogId)

return h.view('return-logs/edit.njk', { activeNavBar: 'search', ...pageData })
}

module.exports = {
edit
}
2 changes: 2 additions & 0 deletions app/plugins/router.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const NotificationsSetupRoutes = require('../routes/notifications-setup.routes.j
const JobRoutes = require('../routes/jobs.routes.js')
const LicenceRoutes = require('../routes/licence.routes.js')
const MonitoringStationRoutes = require('../routes/monitoring-station.routes.js')
const ReturnLogRoutes = require('../routes/return-logs.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')
Expand All @@ -48,6 +49,7 @@ const routes = [
...LicenceRoutes,
...JobRoutes,
...MonitoringStationRoutes,
...ReturnLogRoutes,
...ReturnVersionsRoutes,
...ReturnVersionsSetupRoutes,
...DataRoutes,
Expand Down
23 changes: 23 additions & 0 deletions app/routes/return-logs.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict'

const ReturnLogsController = require('../controllers/return-logs.controller.js')

const routes = [
{
method: 'GET',
path: '/return-logs/{returnLogId}/edit',
options: {
handler: ReturnLogsController.edit,
app: {
plainOutput: true
},
auth: {
access: {
scope: ['billing']
}
}
}
}
]

module.exports = routes

0 comments on commit 9fce8fd

Please sign in to comment.