Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend Release to Main [2.00] #1109

Merged
merged 40 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a826659
test:getInformation-catcherror-404
20chen-7 Apr 10, 2024
5e535b4
add package-lock-json
20chen-7 Apr 10, 2024
8becad4
Delete package-lock.json
20chen-7 Apr 10, 2024
560dc7c
resolve conflict
20chen-7 Apr 25, 2024
b02536c
test: addInformation catch error
20chen-7 Apr 27, 2024
19acfa4
test: getInformation catch error
20chen-7 Apr 27, 2024
d09b158
test: modify 200
20chen-7 Apr 28, 2024
eb25d20
test: addInformation-md
20chen-7 Apr 29, 2024
6975d32
test: catch-error-ADGU
20chen-7 Apr 29, 2024
6c1c1e9
test: addInformation-duplicate-pass
20chen-7 Apr 29, 2024
dfcb82e
test: addnewInfo-201
20chen-7 Apr 30, 2024
842e132
test: getInfo-200
20chen-7 Apr 30, 2024
6c4c2cd
test: not change original controller
20chen-7 Jun 3, 2024
8bd6c61
test: postReason-4-case
20chen-7 Jun 7, 2024
01731d9
test: all postReasone-exceptEmailSender
20chen-7 Jun 11, 2024
a19f4a7
test: patchDelete-ignoreEmailSender
20chen-7 Jun 14, 2024
bd178eb
test: reason-router-post-reason-part1
20chen-7 Jun 22, 2024
89653a4
test: emailSender test
20chen-7 Jul 2, 2024
c3b05f2
chore: revise status code
20chen-7 Aug 24, 2024
03a0c58
test: mock correct
20chen-7 Aug 24, 2024
3a6c37b
Update teamController.js
Logeshwari-Renu Aug 24, 2024
a64755e
test: resolve all-unit test
20chen-7 Aug 27, 2024
39f1cb7
chore: router test
20chen-7 Aug 28, 2024
b30bbe8
test: router-test-except-timelimit
20chen-7 Aug 28, 2024
d9d24b4
test: post
20chen-7 Aug 29, 2024
491ee27
test: git merge
20chen-7 Aug 29, 2024
014e2e5
test: git merge
20chen-7 Aug 29, 2024
7074c53
test: typo
20chen-7 Aug 29, 2024
88c05d3
test: post-delete-route
20chen-7 Aug 30, 2024
f2c3362
test: post-delete-route
20chen-7 Sep 2, 2024
bdf1374
Merge pull request #1087 from OneCommunityGlobal/Logeshwari---Fix-for…
one-community Sep 13, 2024
9988587
chore: fix conflict
20chen-7 Sep 13, 2024
924178c
chore: fix conflict
20chen-7 Sep 13, 2024
7af8811
Merge pull request #1089 from OneCommunityGlobal/Ivy-reasonSche-unit-…
one-community Sep 13, 2024
5b06f43
Merge pull request #887 from OneCommunityGlobal/Ivy-InformationContro…
one-community Sep 13, 2024
c7da55c
chore: two-weeks
20chen-7 Sep 13, 2024
d94f537
chore:conflict
20chen-7 Sep 13, 2024
12e26a0
chore:conflict
20chen-7 Sep 13, 2024
c57c282
chore:conflict
20chen-7 Sep 13, 2024
2e737d6
Merge pull request #1102 from OneCommunityGlobal/Ivy-hotfix-isSet-two…
one-community Sep 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions requirements/informationController/addInformation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Check mark: ✅
Cross Mark: ❌

# Add Information

> ## Positive case
1. ✅ Returns 201 if adding new information successfullyn and no cache.
2. ✅ Returns if adding new information successfully and hascache.

> ## Negative case
1. ✅ Returns error 500 if if there are no information in the database and any error occurs when finding the infoName.
2. ✅ Returns error 400 if if there are duplicate infoName in the database.
3. ✅ Returns error 400 if if there are issues when saving new informations.
4. ✅ Returns error 400 if if there are errors when saving the new information.

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

# Delete Information

> ## Positive case
1. ✅ Returns 200 if deleting informations successfull and no cache.
2. ✅ Returns if deleting informations successfully and has cache.

> ## Negative case
1. ✅ Returns error 400 if if there is any error when finding the information by information id.

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

# Get Information

> ## Positive case
1. ✅ Returns 200 if the informations key exists in NodeCache.
2. ✅ Returns 200 if there are information in the database.

> ## Negative case
1. ✅ Returns error 404 if if there are no information in the database and any error occurs when finding the information.

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

# Update Information

> ## Positive case
1. ✅ Returns 200 if updating informations successfully when no cache.
2. ✅ Returns if updating informations successfully when hascache.

> ## Negative case
1. ✅ Returns error 400 if if there is any error when finding the information by information id.

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

# deleteReason

> ## Positive case
1. ✅ Receives a POST request in the **/api/reason/:userId/** route.
2. ✅ Return 200 if delete reason successfully.

> ## Negative case
1. ✅ Returns 403 when no permission to delete.
2. ✅ Returns 404 when error in finding user Id.
3. ✅ Returns 404 when error in finding reason.
4. ✅ Returns 500 when error in deleting.

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

# getAllReasons

> ## Positive case
1. ✅ Receives a GET request in the **/api/reason/:userId** route.
2. ✅ Return 200 if get schedule reason successfully.

> ## Negative case
1. ✅ Returns 404 when error in finding user by Id.
2. ✅ Returns 400 when any error in fetching the user

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

# getSingleReason

> ## Positive case
1. ✅ Receives a GET request in the **/api/reason/single/:userId** route.
2. ✅ Return 200 if not found schedule reason and return empty object successfully.
3. ✅ Return 200 if found schedule reason and return reason successfully.

> ## Negative case
1. ✅ Returns 404 when any error in find user by Id
2. ✅ Returns 400 when any error in fetching the user

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

# patchReason

> ## Positive case
1. ✅ Receives a POST request in the **/api/breason/** route.
2. ✅ Return 200 if updated schedule reason and send blue sqaure email successfully.

> ## Negative case
1. ✅ Returns 400 for not providing reason.
2. ✅ Returns 404 when error in finding user Id.
3. ✅ Returns 404 when not finding provided reason.
4. ✅ Returns 400 when any error in saving.

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

# postReason

> ## Positive case
1. ✅ Receives a POST request in the **/api/reason/** route.
2. ✅ Return 200 if s dchedule reason and send blue sqaure email successfully.

> ## Negative case
1. ✅ Returns 400 for warning to choose Sunday.
2. ✅ Returns 400 for warning to choose a funture date.
3. ✅ Returns 400 for not providing reason.
4. ✅ Returns 404 when error in finding user Id.
5. ✅ Returns 403 when duplicate reason to the date.
6. ✅ Returns 400 when any error in saving.

> ## Edge case
6 changes: 3 additions & 3 deletions src/controllers/informationController.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const mongoose = require('mongoose');
// const mongoose = require('mongoose');
// const userProfile = require('../models/userProfile');
// const hasPermission = require('../utilities/permissions');
const escapeRegex = require('../utilities/escapeRegex');
const cache = require('../utilities/nodeCache')();
const cacheClosure = require('../utilities/nodeCache');

const informationController = function (Information) {
const cache = cacheClosure();
const getInformations = function (req, res) {
// return all informations if cache is available
if (cache.hasCache('informations')) {
res.status(200).send(cache.getCache('informations'));
return;
}

Information.find({}, 'infoName infoContent visibility')
.then((results) => {
// cache results
Expand Down
Loading
Loading