-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move jobs to an explicit /jobs endpoint (#607)
https://eaflood.atlassian.net/browse/WATER-4270 This is indirectly related to WATER-4270, which is about getting a better understanding of what the 'jobs' in [water-abstraction-import](https://github.com/DEFRA/water-abstraction-import) are doing. One of the blockers to that has been simply finding them all in the code base! It's not always easy to find them, especially when the word 'job' in the legacy code base has two different uses and is often used for the same thing! 😱😂 To try and avoid that happening in our code base this change moves our existing 'jobs' to a `/jobs` endpoint and tidies up the underlying structure to match. We've briefly spoken about doing this as a team a while back. We also plan to arrange for the latest job to be added ([Remove licences with charge elements with approaching time limits from billing](#443)) to be set up in `production` as part of the next release. So, whilst we're reminded of this housekeeping task now seems a good time to do it.
- Loading branch information
1 parent
1cb3e97
commit 0c90329
Showing
33 changed files
with
124 additions
and
125 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict' | ||
|
||
/** | ||
* Controller for /jobs endpoints | ||
* @module JobsController | ||
*/ | ||
|
||
const ExportService = require('../services/jobs/export/export.service.js') | ||
const ProcessTimeLimitedLicencesService = require('../services/jobs/time-limited/process-time-limited-licences.service.js') | ||
|
||
/** | ||
* Triggers export of all relevant tables to CSV and then uploads them to S3 | ||
* | ||
* > Has to be called something other than 'export' because export is a reserved word | ||
*/ | ||
async function exportDb (_request, h) { | ||
ExportService.go() | ||
|
||
return h.response().code(204) | ||
} | ||
|
||
async function timeLimited (_request, h) { | ||
ProcessTimeLimitedLicencesService.go() | ||
|
||
return h.response().code(204) | ||
} | ||
|
||
module.exports = { | ||
exportDb, | ||
timeLimited | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict' | ||
|
||
const JobsController = require('../controllers/jobs.controller.js') | ||
|
||
const routes = [ | ||
{ | ||
method: 'GET', | ||
path: '/jobs/export', | ||
handler: JobsController.exportDb, | ||
options: { | ||
app: { | ||
plainOutput: true | ||
}, | ||
auth: false, | ||
description: 'Used to export the database and upload the file to our AWS S3 bucket' | ||
} | ||
}, | ||
{ | ||
method: 'POST', | ||
path: '/jobs/time-limited', | ||
handler: JobsController.timeLimited, | ||
options: { | ||
app: { | ||
plainOutput: true | ||
}, | ||
auth: false, | ||
description: 'Puts a licence into workflow when a charge element has a `timeLimitedEndDate` which is < 50 days away' | ||
} | ||
} | ||
] | ||
|
||
module.exports = routes |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.