-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into Jiayu_fix_bug_manual_add_lost_volunte…
…er_time
- Loading branch information
Showing
64 changed files
with
6,544 additions
and
4,332 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,9 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
# GetUser | ||
|
||
> ## Positive case | ||
1. ❌ Receives a POST request in the **/api/userProfile** route | ||
2. ✅ Returns **200**, with the requestor body |
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,21 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
# login | ||
|
||
> ## Positive case | ||
1. ❌ Receives a POST request in the **/api/userProfile** route | ||
2. ✅ Returns 200, if the user is a new user and there is a password match | ||
3. ✅ Returns 200, if the user already exists and the password is a match | ||
|
||
## Negative case | ||
|
||
1. ✅ Returns error 400 if there is no email or password | ||
2. ✅ Returns error 403 if there is no user | ||
3. ✅ Returns error 403 if the user exists but is not active | ||
4. ✅ Returns error 403 if the password is not a match and if the user already exists - in progress | ||
|
||
## Edge case | ||
|
||
1. ✅ Returns the error if the try block fails - in progress |
11 changes: 11 additions & 0 deletions
11
requirements/mouseoverTextController/createMouseoverText.md
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,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 |
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,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
12
requirements/mouseoverTextController/updateMouseoverText.md
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,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 |
15 changes: 15 additions & 0 deletions
15
requirements/notificationController/creatUserNotification.md
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,15 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# Create User Notification | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 403 if requestor role is not Admin or Owner | ||
2. ✅ Returns error 400 if message and recipient are missing from request | ||
3. ✅ Returns error 500 if there is an internal error while fetching unread notifications. | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 when notification is successfully created with sender, recipient and message |
14 changes: 14 additions & 0 deletions
14
requirements/notificationController/deleteUserNotification.md
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,14 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# Delete User Notification | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 403 if requestor role is not Admin or Owner. | ||
2. ✅ Returns error 500 if there is an internal error while deleting notification. | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 when notification is successfully deleted. |
14 changes: 14 additions & 0 deletions
14
requirements/notificationController/getSentNotifications.md
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,14 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# GET Sent Notifications | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 Successful Data Retrieval | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 403 if requestor role is not Admin or Owner | ||
2. ✅ Returns error 500 if there is an internal error while fetching notifications. |
15 changes: 15 additions & 0 deletions
15
requirements/notificationController/getUnreadUserNotifications.md
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,15 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# GET Unread User Notifications | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 403 if userId does not match requestorId. | ||
2. ✅ Returns error 400 if the userId is missing from the request. | ||
3. ✅ Returns error 500 if there is an internal error while fetching unread notifications. | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 with notification data when a valid userId is provided by an Administrator or Owner querying another user's notifications. |
15 changes: 15 additions & 0 deletions
15
requirements/notificationController/getUserNotifications.md
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,15 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# GET User Notifications | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 403 if userId does not match requestorId. | ||
2. ✅ Returns error 400 if the userId is missing from the request. | ||
3. ✅ Returns error 500 if there is an internal error while fetching notifications. | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 with notification data when a valid userId is provided by an Administrator or Owner querying another user's notifications. |
14 changes: 14 additions & 0 deletions
14
requirements/notificationController/markNotificationAsRead.md
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,14 @@ | ||
Check mark: ✅ | ||
Cross Mark: ❌ | ||
|
||
|
||
# Mark Notification as Read | ||
|
||
## Negative Cases | ||
|
||
1. ✅ Returns error 400 if recipientId is missing. | ||
2. ✅ Returns error 500 if there is an internal error while reading notification. | ||
|
||
## Positive Cases | ||
|
||
1. ✅ Returns status 200 when notification is successfully read. |
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,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 |
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,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 |
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,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 |
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,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 |
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,67 @@ | ||
const BlueSquareEmailAssignmentController = function (BlueSquareEmailAssignment, userProfile) { | ||
const getBlueSquareEmailAssignment = async function (req, res) { | ||
try { | ||
const assignments = await BlueSquareEmailAssignment.find().populate('assignedTo').exec() | ||
res.status(200).send(assignments); | ||
} catch (error) { | ||
console.log(error) | ||
res.status(500).send(error); | ||
} | ||
}; | ||
|
||
const setBlueSquareEmailAssignment = async function (req, res) { | ||
try { | ||
const { email } = req.body; | ||
|
||
if (!email) { | ||
res.status(400).send('bad request'); | ||
return; | ||
} | ||
|
||
const user = await userProfile.findOne({ email }); | ||
if (!userProfile) { | ||
return res.status(400).send('User profile not found'); | ||
} | ||
|
||
const newAssignment = new BlueSquareEmailAssignment({ | ||
email, | ||
assignedTo: user._id, | ||
}); | ||
await newAssignment.save(); | ||
const assignment = await BlueSquareEmailAssignment.find({email}).populate('assignedTo').exec() | ||
|
||
res.status(200).send(assignment[0]); | ||
} catch (error) { | ||
res.status(500).send(error); | ||
} | ||
}; | ||
|
||
const deleteBlueSquareEmailAssignment = async function (req, res) { | ||
try { | ||
const { id } = req.params; | ||
|
||
if (!id) { | ||
res.status(400).send('bad request'); | ||
return; | ||
} | ||
|
||
const deletedAssignment = await BlueSquareEmailAssignment.findOneAndDelete({ _id: id }); | ||
if (!deletedAssignment) { | ||
res.status(404).send('Assignment not found'); | ||
return; | ||
} | ||
|
||
res.status(200).send({id}); | ||
} catch (error) { | ||
res.status(500).send(error); | ||
} | ||
}; | ||
|
||
return { | ||
getBlueSquareEmailAssignment, | ||
setBlueSquareEmailAssignment, | ||
deleteBlueSquareEmailAssignment, | ||
}; | ||
}; | ||
|
||
module.exports = BlueSquareEmailAssignmentController; |
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.