Skip to content

Commit

Permalink
Merge pull request #80 from NSWC-Crane/CHRIS_DEV
Browse files Browse the repository at this point in the history
Reference pull request for full details.
  • Loading branch information
crodriguez6497 authored Jul 8, 2024
2 parents 759338e + aec4eee commit 619f8ac
Show file tree
Hide file tree
Showing 418 changed files with 569,316 additions and 14,711 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

node_modules/
/.vs
.vs
.nx
.angular
.vscode
.env
*.log
*.tmp
*.swp
**/README.md
**/.env
**/dist
/.vs
client/.angular
client/.nx
14 changes: 7 additions & 7 deletions api/Controllers/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const assetService = require('../Services/assetService')

module.exports.getAssets = async function getAssets(req, res, next) {
try {
var assets = await assetService.getAssets(req, res, next);
const assets = await assetService.getAssets(req, res, next);
res.status(200).json(assets);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
Expand All @@ -21,7 +21,7 @@ module.exports.getAssets = async function getAssets(req, res, next) {

module.exports.getAsset = async function getAsset(req, res, next) {
try {
var asset = await assetService.getAsset(req, res, next);
const asset = await assetService.getAsset(req, res, next);
res.status(200).json(asset);
} catch (error) {
if (error.status === 400) {
Expand All @@ -34,7 +34,7 @@ module.exports.getAsset = async function getAsset(req, res, next) {

module.exports.getAssetByName = async function getAssetByName(req, res, next) {
try {
var asset = await assetService.getAssetByName(req, res, next);
const asset = await assetService.getAssetByName(req, res, next);
res.status(200).json(asset);
} catch (error) {
if (error.status === 400) {
Expand All @@ -47,8 +47,8 @@ module.exports.getAssetByName = async function getAssetByName(req, res, next) {

module.exports.getAssetsByCollection = async function getAssetsByCollection(req, res, next) {
try {
var response = await assetService.getAssetsByCollection(req, res, next);
var assets = response.assets;
const response = await assetService.getAssetsByCollection(req, res, next);
const assets = response.assets;
res.status(200).json(assets);
} catch (error) {
if (error.message === 'Collection ID is required') {
Expand All @@ -61,7 +61,7 @@ module.exports.getAssetsByCollection = async function getAssetsByCollection(req,

module.exports.postAsset = async function postAsset(req, res, next) {
try {
var asset = await assetService.postAsset(req, res, next);
const asset = await assetService.postAsset(req, res, next);
res.status(201).json(asset);
} catch (error) {
if (error.status === 400) {
Expand All @@ -74,7 +74,7 @@ module.exports.postAsset = async function postAsset(req, res, next) {

module.exports.putAsset = async function putAsset(req, res, next) {
try {
var asset = await assetService.putAsset(req, res, next);
const asset = await assetService.putAsset(req, res, next);
res.status(200).json(asset);
} catch (error) {
if (error.status === 400) {
Expand Down
54 changes: 54 additions & 0 deletions api/Controllers/Marketplace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
!#######################################################################
! 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 marketplaceService = require('../Services/marketplaceService');

module.exports.getAllThemes = async function getAllThemes(req, res, next) {
try {
const themes = await marketplaceService.getAllThemes();
res.status(200).json(themes);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};

module.exports.purchaseTheme = async function purchaseTheme(req, res, next) {
try {
const { userId, themeId } = req.body;
const result = await marketplaceService.purchaseTheme(userId, themeId);
if (result.success) {
res.status(200).json(result.message);
} else {
res.status(400).json(result.message);
}
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};

module.exports.getUserThemes = async function getUserThemes(req, res, next) {
try {
const userId = req.params.userId;
const themes = await marketplaceService.getUserThemes(userId);
res.status(200).json(themes);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};

module.exports.getUserPoints = async function getUserPoints(req, res, next) {
try {
const userId = req.params.userId;
const points = await marketplaceService.getUserPoints(userId);
res.status(200).json(points);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};
12 changes: 6 additions & 6 deletions api/Controllers/PoamApprover.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const poamApproverService = require('../Services/poamApproverService')

module.exports.getPoamApprovers = async function getPoamApprovers(req, res, next) {
try {
var poamApprovers = await poamApproverService.getPoamApprovers(req, res, next);
const poamApprovers = await poamApproverService.getPoamApprovers(req, res, next);
res.status(200).json(poamApprovers);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -21,7 +21,7 @@ module.exports.getPoamApprovers = async function getPoamApprovers(req, res, next

module.exports.getPoamApproversByCollection = async function getPoamApproversByCollection(req, res, next) {
try {
var poamApprovers = await poamApproverService.getPoamApproversByCollection(req, res, next);
const poamApprovers = await poamApproverService.getPoamApproversByCollection(req, res, next);
res.status(200).json(poamApprovers);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -30,7 +30,7 @@ module.exports.getPoamApproversByCollection = async function getPoamApproversByC

module.exports.getPoamApproversByCollectionUser = async function getPoamApproversByCollectionUser(req, res, next) {
try {
var poamApprovers = await poamApproverService.getPoamApproversByCollectionUser(req, res, next);
const poamApprovers = await poamApproverService.getPoamApproversByCollectionUser(req, res, next);
res.status(200).json(poamApprovers);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -39,7 +39,7 @@ module.exports.getPoamApproversByCollectionUser = async function getPoamApprover

module.exports.getPoamApproversByUserId = async function getPoamApproversByUserId(req, res, next) {
try {
var poamApprovers = await poamApproverService.getPoamApproversByUserId(req, res, next);
const poamApprovers = await poamApproverService.getPoamApproversByUserId(req, res, next);
res.status(200).json(poamApprovers);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -48,7 +48,7 @@ module.exports.getPoamApproversByUserId = async function getPoamApproversByUserI

module.exports.postPoamApprover = async function postPoamApprover(req, res, next) {
try {
var poamApprover = await poamApproverService.postPoamApprover(req, res, next);
const poamApprover = await poamApproverService.postPoamApprover(req, res, next);
if (poamApprover === null) {
res.status(400).json({ error: 'Failed to create Poam Approver' });
} else {
Expand All @@ -61,7 +61,7 @@ module.exports.postPoamApprover = async function postPoamApprover(req, res, next

module.exports.putPoamApprover = async function putPoamApprover(req, res, next) {
try {
var poamApprover = await poamApproverService.putPoamApprover(req, res, next);
const poamApprover = await poamApproverService.putPoamApprover(req, res, next);
if (poamApprover === null) {
res.status(400).json({ error: 'Failed to update Poam Approver' });
} else {
Expand Down
8 changes: 4 additions & 4 deletions api/Controllers/PoamAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const poamAssetService = require('../Services/poamAssetService')

module.exports.getPoamAssets = async function getPoamAssets(req, res, next) {
try {
var poamAssets = await poamAssetService.getPoamAssets(req, res, next);
const poamAssets = await poamAssetService.getPoamAssets(req, res, next);
res.status(200).json(poamAssets);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -21,7 +21,7 @@ module.exports.getPoamAssets = async function getPoamAssets(req, res, next) {

module.exports.getPoamAssetsByPoamId = async function getPoamAssetsByPoamId(req, res, next) {
try {
var poamAssets = await poamAssetService.getPoamAssetsByPoamId(req, res, next);
const poamAssets = await poamAssetService.getPoamAssetsByPoamId(req, res, next);
res.status(200).json(poamAssets);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -39,7 +39,7 @@ module.exports.deletePoamAssetByPoamId = async function deletePoamAssetByPoamId(

module.exports.getPoamAssetsByAssetId = async function getPoamAssetsByAssetId(req, res, next) {
try {
var poamAssets = await poamAssetService.getPoamAssetsByAssetId(req, res, next);
const poamAssets = await poamAssetService.getPoamAssetsByAssetId(req, res, next);
res.status(200).json(poamAssets);
} catch (error) {
res.status(400).json({ error: error.message });
Expand All @@ -48,7 +48,7 @@ module.exports.getPoamAssetsByAssetId = async function getPoamAssetsByAssetId(re

module.exports.postPoamAsset = async function postPoamAsset(req, res, next) {
try {
var poamAsset = await poamAssetService.postPoamAsset(req, res, next);
const poamAsset = await poamAssetService.postPoamAsset(req, res, next);
if (poamAsset === null) {
res.status(400).json({ error: 'Failed to create PoamAsset' });
} else {
Expand Down
12 changes: 6 additions & 6 deletions api/Controllers/PoamExtensionMilestones.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const poamExtensionMilestoneService = require('../Services/poamExtensionMileston
module.exports.getPoamExtensionMilestones = async function getPoamExtensionMilestones(req, res, next) {
try {
const { poamId } = req.params;
var poamExtensionMilestones = await poamExtensionMilestoneService.getPoamExtensionMilestones(poamId);
const poamExtensionMilestones = await poamExtensionMilestoneService.getPoamExtensionMilestones(poamId);
res.status(200).json(poamExtensionMilestones);
} catch (error) {
if (error.message === 'POAM ID is required') {
Expand All @@ -27,7 +27,7 @@ module.exports.getPoamExtensionMilestones = async function getPoamExtensionMiles
module.exports.postPoamExtensionMilestone = async function postPoamExtensionMilestone(req, res, next) {
try {
const { poamId } = req.params;
var poamExtensionMilestone = await poamExtensionMilestoneService.postPoamExtensionMilestone(poamId, req.body);
const poamExtensionMilestone = await poamExtensionMilestoneService.postPoamExtensionMilestone(poamId, req.body);
res.status(201).json(poamExtensionMilestone);
} catch (error) {
if (error.status === 400) {
Expand All @@ -40,8 +40,8 @@ module.exports.postPoamExtensionMilestone = async function postPoamExtensionMile

module.exports.putPoamExtensionMilestone = async function putPoamExtensionMilestone(req, res, next) {
try {
const { poamId, ExtensionMilestoneId } = req.params;
var poamExtensionMilestone = await poamExtensionMilestoneService.putPoamExtensionMilestone(poamId, ExtensionMilestoneId, req.body);
const { poamId, extensionMilestoneId } = req.params;
const poamExtensionMilestone = await poamExtensionMilestoneService.putPoamExtensionMilestone(poamId, extensionMilestoneId, req.body);
res.status(200).json(poamExtensionMilestone);
} catch (error) {
if (error.status === 400) {
Expand All @@ -54,8 +54,8 @@ module.exports.putPoamExtensionMilestone = async function putPoamExtensionMilest

module.exports.deletePoamExtensionMilestone = async function deletePoamExtensionMilestone(req, res, next) {
try {
const { poamId, ExtensionMilestoneId } = req.params;
await poamExtensionMilestoneService.deletePoamExtensionMilestone(poamId, ExtensionMilestoneId, req.body);
const { poamId, extensionMilestoneId } = req.params;
await poamExtensionMilestoneService.deletePoamExtensionMilestone(poamId, extensionMilestoneId, req.body);
res.status(204).send();
} catch (error) {
if (error.status === 400) {
Expand Down
12 changes: 6 additions & 6 deletions api/Controllers/PoamLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const poamLabelService = require('../Services/poamLabelService')
module.exports.getPoamLabels = async function getPoamLabels(req, res, next) {
try {
const { collectionId } = req.params;
var poamLabels = await poamLabelService.getPoamLabels(collectionId);
const poamLabels = await poamLabelService.getPoamLabels(collectionId);
res.status(200).json(poamLabels);
} catch (error) {
if (error.message === 'Collection ID is required') {
Expand All @@ -26,7 +26,7 @@ module.exports.getPoamLabels = async function getPoamLabels(req, res, next) {

module.exports.getAvailablePoamLabels = async function getAvailablePoamLabels(req, res, next) {
try {
var poamLabels = await poamLabelService.getAvailablePoamLabels(req, res, next);
const poamLabels = await poamLabelService.getAvailablePoamLabels(req, res, next);
res.status(200).json(poamLabels);
} catch (error) {
if (error.message === 'User ID is required') {
Expand All @@ -40,7 +40,7 @@ module.exports.getAvailablePoamLabels = async function getAvailablePoamLabels(re
module.exports.getPoamLabelsByPoam = async function getPoamLabelsByPoam(req, res, next) {
try {
const { poamId } = req.params;
var poamLabels = await poamLabelService.getPoamLabelsByPoam(poamId);
const poamLabels = await poamLabelService.getPoamLabelsByPoam(poamId);
res.status(200).json(poamLabels);
} catch (error) {
if (error.message === 'POAM ID is required') {
Expand All @@ -54,7 +54,7 @@ module.exports.getPoamLabelsByPoam = async function getPoamLabelsByPoam(req, res
module.exports.getPoamLabelByLabel = async function getPoamLabelByLabel(req, res, next) {
try {
const { labelId } = req.params;
var poamLabels = await poamLabelService.getPoamLabelsByLabel(labelId);
const poamLabels = await poamLabelService.getPoamLabelsByLabel(labelId);
res.status(200).json(poamLabels);
} catch (error) {
if (error.message === 'Label ID is required') {
Expand All @@ -68,7 +68,7 @@ module.exports.getPoamLabelByLabel = async function getPoamLabelByLabel(req, res
module.exports.getPoamLabel = async function getPoamLabel(req, res, next) {
try {
const { poamId, labelId } = req.params;
var poamLabel = await poamLabelService.getPoamLabel(poamId, labelId);
const poamLabel = await poamLabelService.getPoamLabel(poamId, labelId);
res.status(200).json(poamLabel);
} catch (error) {
if (error.message === 'POAM ID and Label ID are required') {
Expand All @@ -81,7 +81,7 @@ module.exports.getPoamLabel = async function getPoamLabel(req, res, next) {

module.exports.postPoamLabel = async function postPoamLabel(req, res, next) {
try {
var poamLabel = await poamLabelService.postPoamLabel(req, res, next);
const poamLabel = await poamLabelService.postPoamLabel(req, res, next);
res.status(201).json(poamLabel);
} catch (error) {
if (error.status === 400) {
Expand Down
2 changes: 1 addition & 1 deletion api/Controllers/PoamLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const poamLogService = require('../Services/poamLogService')
module.exports.getPoamLogByPoamId = async function getPoamLogByPoamId(req, res, next) {
try {
const { poamId } = req.params;
var poamLog = await poamLogService.getPoamLogByPoamId(poamId);
const poamLog = await poamLogService.getPoamLogByPoamId(poamId);
res.status(200).json(poamLog);
} catch (error) {
if (error.message === 'POAM ID is required') {
Expand Down
6 changes: 3 additions & 3 deletions api/Controllers/PoamMilestones.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const poamMilestoneService = require('../Services/poamMilestoneService')
module.exports.getPoamMilestones = async function getPoamMilestones(req, res, next) {
try {
const { poamId } = req.params;
var poamMilestones = await poamMilestoneService.getPoamMilestones(poamId);
const poamMilestones = await poamMilestoneService.getPoamMilestones(poamId);
res.status(200).json(poamMilestones);
} catch (error) {
if (error.message === 'POAM ID is required') {
Expand All @@ -27,7 +27,7 @@ module.exports.getPoamMilestones = async function getPoamMilestones(req, res, ne
module.exports.postPoamMilestone = async function postPoamMilestone(req, res, next) {
try {
const { poamId } = req.params;
var poamMilestone = await poamMilestoneService.postPoamMilestone(poamId, req.body);
const poamMilestone = await poamMilestoneService.postPoamMilestone(poamId, req.body);
res.status(201).json(poamMilestone);
} catch (error) {
if (error.status === 400) {
Expand All @@ -41,7 +41,7 @@ module.exports.postPoamMilestone = async function postPoamMilestone(req, res, ne
module.exports.putPoamMilestone = async function putPoamMilestone(req, res, next) {
try {
const { poamId, milestoneId } = req.params;
var poamMilestone = await poamMilestoneService.putPoamMilestone(poamId, milestoneId, req.body);
const poamMilestone = await poamMilestoneService.putPoamMilestone(poamId, milestoneId, req.body);
res.status(200).json(poamMilestone);
} catch (error) {
if (error.status === 400) {
Expand Down
26 changes: 26 additions & 0 deletions api/Controllers/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,32 @@ module.exports.updateUser = async function updateUser(req, res, next) {
}
};

module.exports.updateUserTheme = async function updateUserTheme(req, res, next) {
try {
const result = await userService.updateUserTheme(req, res, next);
if (result.success) {
res.status(200).json(result.message);
} else {
res.status(400).json(result.message);
}
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};

module.exports.updateUserPoints = async function updateUserPoints(req, res, next) {
try {
const result = await userService.updateUserPoints(req, res, next);
if (result.success) {
res.status(200).json(result.message);
} else {
res.status(400).json(result.message);
}
} catch (error) {
res.status(500).json({ error: 'Internal Server Error', detail: error.message });
}
};

module.exports.deleteUser = async function deleteUser(req, res, next) {
try {
const userId = req.params.userId;
Expand Down
Loading

0 comments on commit 619f8ac

Please sign in to comment.