Skip to content

Commit

Permalink
Merge pull request #1121 from OneCommunityGlobal/development
Browse files Browse the repository at this point in the history
Backend Release to Main [2.01]
  • Loading branch information
one-community authored Oct 1, 2024
2 parents 4320629 + b2b81ad commit 1afa0bd
Show file tree
Hide file tree
Showing 32 changed files with 2,733 additions and 353 deletions.
524 changes: 243 additions & 281 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions requirements/taskController/deleteTask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Check mark: ✅
Cross Mark: ❌

# deleteTask Function

> ## Positive case
1. ✅ Returns status 200 on successful deletion.

> ## Negative case
1. ✅ Returns status 400 if either no record is found in Task collection or some error occurs while saving the tasks.

2. ✅ Returns status 403 if the request.body.requestor does not have `deleteTask` permission.


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

# deleteTaskByWBS Function

> ## Positive case
1. ✅ Returns status 200 on successful deletion.

> ## Negative case
1. ✅ Returns status 400 if either no record is found in Task collection or some error occurs while saving the tasks.

2. ✅ Returns status 403 if the request.body.requestor does not have `deleteTask` permission.


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

# updateAllParents Function

> ## Positive case
1. ✅ Returns status 200 on without performing an operation.

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

# getTaskById Function

> ## Positive case
1. ✅ Returns status 200 on successfully getting a taskById.

> ## Negative case
1. ✅ Returns status 400 if either req.params.id is missing or is `undefined` or if no task is found in Task collection.

2. ✅ Returns status 500 if some error occurs.

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

# getTasks Function

> ## Positive case
1. ✅ Returns status 200 on successfully querying the Task collection.

> ## Negative case
1. ✅ Returns status 404 if any error occurs while querying the Task collection.

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

# getTasksByUserId Function

> ## Positive case
1. ✅ Returns status 200 on successfully getting the tasks.

> ## Negative case
1. ✅ Returns status 400 if some error occurs.

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

# getTasksForTeamsByUser Function

> ## Positive case
1. ✅ Returns status 200 on successfully fetching teams data.

> ## Negative case
1. ✅ Returns status 400 if some error occurs.

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

# getWBSId Function

> ## Positive case
1. ✅ Returns status 200 on successfully querying the WBS collection.

> ## Negative case
1. ✅ Returns status 404 if any error occurs while querying the WBS collection.

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

# importTask Function

> ## Positive case
1. ✅ Returns status 201 on successfully creating and saving the new Task.

> ## Negative case
1. ✅ Returns status 400 if any error occurs while saving the Task.

2. ✅ Returns status 403 if request.body.requestor is missing permission for importTask.

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

# updateNum Function

> ## Positive case
1. ✅ Returns status 200 on successful updation.

> ## Negative case
1. ✅ Returns status 400 if either request.body.fromNum request.body.toNum is missing or some error occurs while saving the tasks.


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

# postTask Function

> ## Positive case
1. ✅ Returns status 201 on successfully posting the new task.

> ## Negative case
1. ✅ Returns status 400 if either request.body.taskName is missing or request.body.isActive is missing or some error occurs while saving task or Wbs or project.

2. ✅ Returns status 403 if request.body.requestor is missing permission `postTask`.

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

# sendReviewReq Function

> ## Positive case
1. ✅ Returns status 200 on successful operation.

> ## Negative case
1. ✅ Returns status 500 if some error occurs.

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

# swap Function

> ## Positive case
1. ✅ Returns status 201 on successfully updating.

> ## Negative case
1. ✅ Returns status 400 if either request.body.taskId1 is missing or request.body.taskId2 is missing or there is error while executing findById in Task or some error occurs while saving task.

2. ✅ Returns status 403 if request.body.requestor is missing `swapTask` permission.

3. ✅ Returns status 404 if some error occurs while executing find operation on Task collection.

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

# updateAllParents Function

> ## Positive case
1. ✅ Returns status 200 on successful updation.

> ## Negative case
1. ✅ Returns status 400 if some error occurs. - Not possible to check as per current structure

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

# updateNum Function

> ## Positive case
1. ✅ Returns status 200 on successfully updating.

> ## Negative case
1. ✅ Returns status 400 if either request.body.nums is missing or some error occurs while saving child task.

2. ✅ Returns status 403 if request.body.requestor is missing `updateNum` permission.

3. ✅ Returns status 404 if some error occurs while processing the child tasks.

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

# updateTask Function

> ## Positive case
1. ✅ Returns status 201 on successfully updating.

> ## Negative case
1. ✅ Returns status 400 if either request.body.nums is missing or some error occurs while saving child task.

2. ✅ Returns status 403 if request.body.requestor is missing `updateTask` permission.

3. ✅ Returns status 404 if some error occurs while executing findOneAndUpdate operation on Task collection.

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

# updateTaskStatus Function

> ## Positive case
1. ✅ Returns status 201 on successful update operation.

> ## Negative case
1. ✅ Returns status 404 if some error occurs.

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

# Get Time Zone

> ## Positive case
1. ✅ Returns status code 200 and response data as follows:
i. current location
ii. timezone

> ## Negative case
1. ✅ Returns status code 403, if the user is not authorised.
2. ✅ Returns status code 401, if the API key is missing.
3. ✅ Returns status code 400, if the location is missing.
4. ✅ Returns status code 404, if geocodeAPIEndpoint returns no results.
5. ✅ Returns status code 500, if any other error occurs.

> ## Edge case
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Check mark: ✅
Cross Mark: ❌

# Get Time Zone

> ## Positive case
1. ✅ Returns status code 200 and response data as follows:
i. current location
ii. timezone

> ## Negative case
1. ✅ Returns status code 400, if the token is missing in the request body.
2. ✅ Returns status code 403, if the no document exists in ProfileInitialSetupToken database with requested token.
3. ✅ Returns status code 400, if the location is missing.
4. ✅ Returns status code 404, if geocodeAPIEndpoint returns no results.
5. ✅ Returns status code 500, if any other error occurs.

> ## Edge case
11 changes: 10 additions & 1 deletion src/controllers/projectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,17 @@ const projectController = function (Project) {
res.status(400).send('Invalid request');
return;
}
const getId = await hasPermission(req.body.requestor, 'getProjectMembers');

const getProjMembers = await hasPermission(req.body.requestor, 'getProjectMembers');

// If a user has permission to post, edit, or suggest tasks, they also have the ability to assign resources to those tasks.
// Therefore, the _id field must be included when retrieving the user profile for project members (resources).
const postTask = await hasPermission(req.body.requestor, 'postTask');
const updateTask = await hasPermission(req.body.requestor, 'updateTask');
const suggestTask = await hasPermission(req.body.requestor, 'suggestTask');

const getId = (getProjMembers || postTask || updateTask || suggestTask);

userProfile
.find(
{ projects: projectId },
Expand Down
Loading

0 comments on commit 1afa0bd

Please sign in to comment.