Plan Review Routes
GET
/api/planReview/getReviewers
​
Return a list of reviews for a specific plan with populated reviewer info.
Name | Type | Description | |
---|---|---|---|
Query | plan_id | String | id of plan to get reviews for |
Output | PlanReview[] | List of reviews corresponding to this plan with populated user info. |
Sample Output​
[
{
"_id": {
"$oid": "62365a80b8316b8b54f7785e"
},
"reviewee_id": "mockUser",
"reviewer_id": "juniorDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "PENDING",
"__v": 0
},
{
"_id": {
"$oid": "62365a80b8316b8b54f7785d"
},
"reviewee_id": "mockUser",
"reviewer_id": "freshmanDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "UNDERREVIEW",
"__v": 0
}
]
GET
/api/planReview/plansToReview
​
Return a list of reviews for a specific reviewer with populated reviewee info.
Name | Type | Description | |
---|---|---|---|
Query | reviewer_id | String | id of reviewer to get reviews for |
Output | PlanReview[] | List of reviews corresponding to this reviewer with populated user info. |
Sample Output​
[
{
"_id": {
"$oid": "62365a80b8316b8b54f7785e"
},
"reviewee_id": "mockUser",
"reviewer_id": "juniorDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "PENDING",
"__v": 0
},
{
"_id": {
"$oid": "62365a80b8316b8b54f7785d"
},
"reviewee_id": "freshmanDev",
"reviewer_id": "juniorDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "APPROVED",
"__v": 0
}
]
POST
/api/planReview/request
​
Creates a plan review request if a review request hasn't been created. Returns 400 if missing Body field, 404 if reviewer is not registered, 409 if reviewer is already added in the reviewers array. A notification with the message [reviewee_name] has requested you to review a plan.
is created for the reviewer.
Name | Type | Description | |
---|---|---|---|
Body | plan_id | String | id of plan to create review for |
reviewee_id | String | id of user who requests the review | |
reviewee_name | String | name of reviewee user | |
reviewer_id | String | id of reviewer user who is being requested | |
Output | PlanReview | Created planReview object with status “PENDING”. |
Sample Output​
{
"_id": {
"$oid": "62365a80b8316b8b54f7785e"
},
"reviewee_id": "mockUser",
"reviewer_id": "juniorDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "PENDING",
"__v": 0
}
POST
/api/planReview/confirm
​
Confirms a plan review request. Returns 400 if missing Body field, 409 if plan_id is already added in the reviewer’s whitelisted array.
Name | Type | Description | |
---|---|---|---|
Body | review_id | String | id of review to confirm |
Output | PlanReview | Confirmed review object, status changed to “UNDERREVIEW”. |
Sample Output​
{
"_id": {
"$oid": "62365a80b8316b8b54f7785d"
},
"reviewee_id": "mockUser",
"reviewer_id": "freshmanDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "UNDERREVIEW",
"__v": 0
}
POST
/api/planReview/changeStatus
​
Approve or reject a plan. Returns 400 if Body field is invalid, 404 if review_id is not found.
Name | Type | Description | |
---|---|---|---|
Body | review_id | String | id of the planReview object |
status | String | APPROVED ,REJECTED , or UNDERREVIEW | |
Output | PlanReview | planReview object status changed according to the body input. |
Sample Output​
{
"_id": {
"$oid": "62365a80b8316b8b54f7785d"
},
"reviewee_id": "freshmanDev",
"reviewer_id": "juniorDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "APPROVED",
"__v": 0
}
DELETE
/api/planReview/removeReview
​
Removes a specific review. Remove the record from both sides(reviewer array & whitelisted array). returns 404 if reviewer does not exist for this plan.
Name | Type | Description | |
---|---|---|---|
Query | review_id | String | id of review to remove |
Output | PlanReview | Deleted review. |
{
"_id": {
"$oid": "62365a80b8316b8b54f7785d"
},
"reviewee_id": "mockUser",
"reviewer_id": "freshmanDev",
"plan_id": "623659ddb8316b8b54f77815",
"requestTime": {
"$date": "2022-03-19T22:34:40.718Z"
},
"status": "UNDERREVIEW",
"__v": 0
}