-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
General updates. Reference pull request for full details.
- Loading branch information
1 parent
768e1b7
commit 87c5d90
Showing
20 changed files
with
744 additions
and
138 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
!####################################################################### | ||
! C-PATTM SOFTWARE | ||
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file | ||
! crane_C_PAT.1_license.txt, which is part of this software package. BY | ||
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND | ||
! CONDITIONS OF THE LICENSE. | ||
!######################################################################## | ||
*/ | ||
|
||
const poamExtensionService = require('../Services/mysql/poamExtensionService'); | ||
|
||
module.exports.getPoamExtension = async function getPoamExtension(req, res, next) { | ||
try { | ||
const poamExtensions = await poamExtensionService.getPoamExtension(req.params.poamId); | ||
res.status(200).json(poamExtensions); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
|
||
module.exports.putPoamExtension = async function putPoamExtension(req, res, next) { | ||
try { | ||
const updatedPoamExtension = await poamExtensionService.putPoamExtension(req.body); | ||
res.status(200).json(updatedPoamExtension); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
|
||
module.exports.deletePoamExtension = async function deletePoamExtension(req, res, next) { | ||
try { | ||
await poamExtensionService.deletePoamExtension(req.params.poamId); | ||
res.status(200).json({ message: "Poam extension deleted successfully" }); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; |
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,44 @@ | ||
/* | ||
!####################################################################### | ||
! C-PATTM SOFTWARE | ||
! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file | ||
! crane_C_PAT.1_license.txt, which is part of this software package. BY | ||
! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND | ||
! CONDITIONS OF THE LICENSE. | ||
!######################################################################## | ||
*/ | ||
|
||
'use strict'; | ||
const dbUtils = require('./utils'); | ||
|
||
exports.getPoamExtension = async function (poamId) { | ||
let connection; | ||
try { | ||
connection = await dbUtils.pool.getConnection(); | ||
let sql = "SELECT poamId, extensionTimeAllowed, extensionJustification, extensionMilestones, scheduledCompletionDate FROM poamtracking.poam WHERE poamId = ?"; | ||
let [poamExtensions] = await connection.query(sql, [poamId]); | ||
|
||
return poamExtensions; | ||
|
||
} catch (error) { | ||
console.error("Error in getPoamExtension:", error); | ||
throw error; | ||
} finally { | ||
if (connection) await connection.release(); | ||
} | ||
}; | ||
|
||
exports.putPoamExtension = async function (extensionData) { | ||
let connection = await dbUtils.pool.getConnection(); | ||
let sql = "UPDATE poamtracking.poam SET extensionTimeAllowed = ?, extensionJustification = ?, extensionMilestones = ? WHERE poamId = ?"; | ||
await connection.query(sql, [extensionData.extensionTimeAllowed, extensionData.extensionJustification, extensionData.extensionMilestones, extensionData.poamId]); | ||
await connection.release(); | ||
return extensionData; | ||
}; | ||
|
||
exports.deletePoamExtension = async function ({ poamId }) { | ||
let connection = await dbUtils.pool.getConnection(); | ||
let sql = "UPDATE poamtracking.poam SET extensionTimeAllowed = '', extensionJustification = '', extensionMilestones = '' WHERE poamId = ?"; | ||
await connection.query(sql, [poamId]); | ||
await connection.release(); | ||
}; |
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.