Skip to main content

Plan Review Routes

GET /api/planReview/getReviewers​

Return a list of reviews for a specific plan with populated reviewer info.

NameTypeDescription
Queryplan_idStringid of plan to get reviews for
OutputPlanReview[]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.

NameTypeDescription
Queryreviewer_idStringid of reviewer to get reviews for
OutputPlanReview[]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.

NameTypeDescription
Bodyplan_idStringid of plan to create review for
reviewee_idStringid of user who requests the review
reviewee_nameStringname of reviewee user
reviewer_idStringid of reviewer user who is being requested
OutputPlanReviewCreated 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.

NameTypeDescription
Bodyreview_idStringid of review to confirm
OutputPlanReviewConfirmed 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.

NameTypeDescription
Bodyreview_idStringid of the planReview object
statusStringAPPROVED,REJECTED, or UNDERREVIEW
OutputPlanReviewplanReview 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.

NameTypeDescription
Queryreview_idStringid of review to remove
OutputPlanReviewDeleted 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
}