generated from bcgov/vue-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into pdf-generation
- Loading branch information
Showing
21 changed files
with
582 additions
and
88 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -73,7 +73,7 @@ async function getChangeRequest(req, res) { | |
log.info('get changeRequest called'); | ||
|
||
try { | ||
let operation = `ccof_change_requests(${req.params.changeRequestId})?$expand=ccof_change_action_change_request($select=ccof_change_actionid,statuscode,ccof_changetype)`; | ||
let operation = `ccof_change_requests(${req.params.changeRequestId})?$expand=ccof_change_action_change_request($select=ccof_change_actionid,statuscode,ccof_changetype,createdon)`; | ||
let changeRequest = await getOperation(operation); | ||
changeRequest = await mapChangeRequestObjectForFront(changeRequest); | ||
changeRequest.providerType = getLabelFromValue(changeRequest.providerType , ORGANIZATION_PROVIDER_TYPES); | ||
|
@@ -139,6 +139,36 @@ async function createChangeRequest(req, res) { | |
} | ||
} | ||
|
||
async function createChangeAction(req, res, changeType) { | ||
log.info('createChangeAction called'); | ||
try { | ||
const payload = { | ||
ccof_changetype: changeType, | ||
'[email protected]': `ccof_change_requests(${req.params.changeRequestId})` | ||
}; | ||
const changeActionId = await postOperation('ccof_change_actions', payload); | ||
return res.status(HttpStatus.CREATED).json({ | ||
changeRequestId: req.params.changeRequestId, | ||
changeActionId: changeActionId, | ||
changeType: changeType | ||
}); | ||
} catch (e) { | ||
log.error('error', e); | ||
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); | ||
} | ||
} | ||
|
||
async function deleteChangeAction(req, res) { | ||
log.info('deleteChangeAction called - changeActionId = ' + req.params.changeActionId); | ||
try { | ||
await deleteOperationWithObjectId('ccof_change_actions', req.params.changeActionId); | ||
return res.status(HttpStatus.OK).end(); | ||
} catch (e) { | ||
log.error('error', e); | ||
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(e.data ? e.data : e?.status); | ||
} | ||
} | ||
|
||
function buildNewFacilityPayload(req) { | ||
let facility = req.body; | ||
|
||
|
@@ -253,5 +283,7 @@ module.exports = { | |
deleteChangeRequest, | ||
getChangeRequestDocs, | ||
saveChangeRequestDocs, | ||
updateChangeRequest | ||
updateChangeRequest, | ||
createChangeAction, | ||
deleteChangeAction, | ||
}; |
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.