Skip to content

Commit

Permalink
Merge pull request #986 from OneCommunityGlobal/development
Browse files Browse the repository at this point in the history
Backend Release to Main [1.78]
  • Loading branch information
one-community authored Jun 13, 2024
2 parents 4d4f1fc + 27fb760 commit 6fe988b
Show file tree
Hide file tree
Showing 31 changed files with 1,753 additions and 800 deletions.
11 changes: 11 additions & 0 deletions requirements/mouseoverTextController/createMouseoverText.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Check mark: ✅
Cross Mark: ❌

# createMouseoverText

> ## Positive case
1. ✅ Return 201 if create new mouseoverText successfully.

> ## Negative case
1. ✅ Returns error 500 if any error when saving the new mouseoverText
> ## Edge case
11 changes: 11 additions & 0 deletions requirements/mouseoverTextController/getMouseoverText.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Check mark: ✅
Cross Mark: ❌

# getMouseoverText

> ## Positive case
1. ✅ Return 200 if find mouseoverText successfully.

> ## Negative case
1. ✅ Returns error 404 if any error when finding the mouseoverText
> ## Edge case
12 changes: 12 additions & 0 deletions requirements/mouseoverTextController/updateMouseoverText.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Check mark: ✅
Cross Mark: ❌

# updateMouseoverText

> ## Positive case
1. ✅ Return 201 if updating mouseoverText successfully.

> ## Negative case
1. ✅ Returns error 500 if any error when finding the mouseoverText by Id
2. ✅ Returns error 400 if any error when saving the mouseoverText
> ## Edge case
18 changes: 18 additions & 0 deletions requirements/rolePresetsController/createNewPresets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Check mark: ✅
Cross Mark: ❌

# createNewPreset

> ## Positive case
1. ✅ Receives a POST request in the **/api/rolePreset** route
2. ✅ Return 201 if create New Presets successfully.

> ## Negative case
1. ✅ Returns error 403 if user doesn't have permissions for putRole
2. ✅ Returns 400 if missing presetName
3. ✅ Returns 400 if missing roleName
4. ✅ Returns 400 if missing premissions
5. ✅ Returns error 400 when saving new presets

> ## Edge case
17 changes: 17 additions & 0 deletions requirements/rolePresetsController/deletePresetById.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Check mark: ✅
Cross Mark: ❌

# deletePresetById

> ## Positive case
1. ✅ Return 200 if removing preset by id successfully.

> ## Negative case
1. ✅ Returns error 403 if user doesn't have permissions for putRole
2. ✅ Returns 400 if error in finding by id
3. ✅ Returns 400 if the route doesn't exist
4. ✅ Returns 400 if any error when removing results

> ## Edge case
15 changes: 15 additions & 0 deletions requirements/rolePresetsController/getPresetsByRole.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Check mark: ✅
Cross Mark: ❌

# getPresetsByRole

> ## Positive case
1. ✅ Receives a GET request in the **/api/rolePreset** route
2. ✅ Return 200 if get Presets by roleName successfully.

> ## Negative case
1. ✅ Returns error 403 if user doesn't have permissions for putRole
2. ✅ Returns 400 when catching any error in finding roleName

> ## Edge case
17 changes: 17 additions & 0 deletions requirements/rolePresetsController/updatePresetById.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Check mark: ✅
Cross Mark: ❌

# updatePresetById

> ## Positive case
1. ✅ Return 200 if update preset by id successfully.

> ## Negative case
1. ✅ Returns error 403 if user doesn't have permissions for putRole
2. ✅ Returns 400 if the router doesn't exist
3. ✅ Returns 400 if error in finding by id
3. ✅ Returns 400 if any error when saving results

> ## Edge case
6 changes: 4 additions & 2 deletions src/controllers/badgeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const badgeController = function (Badge) {
const cache = cacheClosure();

const getAllBadges = async function (req, res) {
if (!(await helper.hasPermission(req.body.requestor, 'seeBadges')) && !(await helper.hasPermission(req.body.requestor, 'assignBadges'))) {
console.log(req.body.requestor);
if (!(await helper.hasPermission(req.body.requestor, 'seeBadges'))) {
console.log('in if statement');
res.status(403).send('You are not authorized to view all badge data.');
return;
}
Expand All @@ -39,7 +41,7 @@ const badgeController = function (Badge) {
cache.setCache('allBadges', results);
res.status(200).send(results);
})
.catch(error => res.status(500).send(error));
.catch((error) => res.status(500).send(error));
};

/**
Expand Down
Loading

0 comments on commit 6fe988b

Please sign in to comment.