Plan Routes
GET
/api/plans/:plan_id
Gets a plan by id.
Name | Type | Description | |
---|---|---|---|
Params | plan_id | String | plan id |
Output | Plan | The plan corresponding to the id in the request params. |
Sample Output
{
"majors": [
"B.S. Computer Science (NEW - 2021 & after)"
],
"distribution_ids": [],
"_id": "623659ddb8316b8b54f77815",
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1,
"years": [
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77817",
"name": "AP/Transfer",
"user_id": "mockUser",
"year": 0,
"__v": 0
},
{
"courses": [
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "62395837daa1f097d4062697",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Precalculus",
"term": "fall",
"year": "Freshman",
"credits": 4,
"number": "AS.110.105",
"area": "Q",
"version": "Fall 2021",
"__v": 0
},
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [
{
"Description": "Grade of C- or better in AS.110.107 OR AS.110.109 OR AS.110.113 OR AS.110.201 OR AS.110.212 OR AS.110.302, or a 5 or better on the AP BC exam.",
"Expression": "AS.110.107[C]^OR^AS.110.109[C]^OR^AS.110.113[C]^OR^AS.110.201[C]^OR^AS.110.212[C]^OR^AS.110.302[C]",
"IsNegative": "N"
}
],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "6239583cdaa1f097d40626b2",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Calculus III",
"term": "spring",
"year": "Freshman",
"credits": 4,
"number": "AS.110.202",
"area": "Q",
"version": "Spring 2022",
"__v": 0
}
],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781a",
"name": "Freshman",
"user_id": "mockUser",
"year": 2021,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781c",
"name": "Sophomore",
"user_id": "mockUser",
"year": 2022,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781e",
"name": "Junior",
"user_id": "mockUser",
"year": 2023,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77820",
"name": "Senior",
"user_id": "mockUser",
"year": 2024,
"__v": 0
}
]
}
GET
/api/plansByUser/:user_id
Gets a list of all plans of a particular user filled with all year and course objects.
Name | Type | Description | |
---|---|---|---|
Params | user_id | String | user id |
Output | Plan[] | A list of plans corresponding to the plan ids stored in the user corresponding to the user id in the request params. |
Sample output
[
{
"majors": [
"B.S. Computer Science (NEW - 2021 & after)"
],
"distribution_ids": [],
"_id": "623659ddb8316b8b54f77815",
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1,
"years": [
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77817",
"name": "AP/Transfer",
"user_id": "mockUser",
"year": 0,
"__v": 0
},
{
"courses": [
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "62395837daa1f097d4062697",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Precalculus",
"term": "fall",
"year": "Freshman",
"credits": 4,
"number": "AS.110.105",
"area": "Q",
"version": "Fall 2021",
"__v": 0
},
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [
{
"Description": "Grade of C- or better in AS.110.107 OR AS.110.109 OR AS.110.113 OR AS.110.201 OR AS.110.212 OR AS.110.302, or a 5 or better on the AP BC exam.",
"Expression": "AS.110.107[C]^OR^AS.110.109[C]^OR^AS.110.113[C]^OR^AS.110.201[C]^OR^AS.110.212[C]^OR^AS.110.302[C]",
"IsNegative": "N"
}
],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "6239583cdaa1f097d40626b2",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Calculus III",
"term": "spring",
"year": "Freshman",
"credits": 4,
"number": "AS.110.202",
"area": "Q",
"version": "Spring 2022",
"__v": 0
}
],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781a",
"name": "Freshman",
"user_id": "mockUser",
"year": 2021,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781c",
"name": "Sophomore",
"user_id": "mockUser",
"year": 2022,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781e",
"name": "Junior",
"user_id": "mockUser",
"year": 2023,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77820",
"name": "Senior",
"user_id": "mockUser",
"year": 2024,
"__v": 0
}
]
},
{
"_id": {
"$oid": "6239587fdaa1f097d40626ba"
},
"majors": [
"B.S. Molecular and Cellular Biology"
],
"year_ids": [
{
"$oid": "6239587fdaa1f097d40626bc"
},
{
"$oid": "62395880daa1f097d40626bf"
},
{
"$oid": "62395880daa1f097d40626c1"
},
{
"$oid": "62395880daa1f097d40626c3"
},
{
"$oid": "62395880daa1f097d40626c5"
}
],
"distribution_ids": [],
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1
}
]
POST
/api/plans/
Creates a new plan. When creating a plan, the post body can specify the number of years("numYear" field) and the backend will automatically generate years document in this order:[freshman, sophomore, junior, senior, fifth year]. For example, if the post body specified numYear: 3, then freshman, sophomore, junior year documents will be generated. The default numYear value is 4 (if you don't specify). plan_ids field of the user document is also updated.
Name | Type | Description | |
---|---|---|---|
Body | name | String | new plan's name |
user_id | String | the new plan's owner id | |
majors | String | the degrees associated with the new plan | |
numYears | Number | Number of years to create | |
expireAt | Date | the time when the object is supposed to be trash-collected (note: this needs fixing) | |
Output | Plan | Newly created plan. |
Sample Output
{
"majors": [
"B.S. Computer Science (NEW - 2021 & after)"
],
"distribution_ids": [],
"_id": "623659ddb8316b8b54f77815",
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1,
"years": [
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77817",
"name": "AP/Transfer",
"user_id": "mockUser",
"year": 0,
"__v": 0
},
{
"courses": [
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "62395837daa1f097d4062697",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Precalculus",
"term": "fall",
"year": "Freshman",
"credits": 4,
"number": "AS.110.105",
"area": "Q",
"version": "Fall 2021",
"__v": 0
},
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [
{
"Description": "Grade of C- or better in AS.110.107 OR AS.110.109 OR AS.110.113 OR AS.110.201 OR AS.110.212 OR AS.110.302, or a 5 or better on the AP BC exam.",
"Expression": "AS.110.107[C]^OR^AS.110.109[C]^OR^AS.110.113[C]^OR^AS.110.201[C]^OR^AS.110.212[C]^OR^AS.110.302[C]",
"IsNegative": "N"
}
],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "6239583cdaa1f097d40626b2",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Calculus III",
"term": "spring",
"year": "Freshman",
"credits": 4,
"number": "AS.110.202",
"area": "Q",
"version": "Spring 2022",
"__v": 0
}
],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781a",
"name": "Freshman",
"user_id": "mockUser",
"year": 2021,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781c",
"name": "Sophomore",
"user_id": "mockUser",
"year": 2022,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781e",
"name": "Junior",
"user_id": "mockUser",
"year": 2023,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77820",
"name": "Senior",
"user_id": "mockUser",
"year": 2024,
"__v": 0
}
]
}
PATCH
/api/plans/:plan_id
Updates a plan's name or degrees corresponding to a given id.
Name | Type | Description | |
---|---|---|---|
Body | plan_id | String | id of plan to update |
majors | String[]? | optional array of degree ids to update the plan's degree array with | |
name | String? | optional new name for the plan | |
Output | Plan | Updated plan. |
Sample Output
{
"majors": [
"B.S. Computer Science (NEW - 2021 & after)"
],
"distribution_ids": [],
"_id": "623659ddb8316b8b54f77815",
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1,
"years": [
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77817",
"name": "AP/Transfer",
"user_id": "mockUser",
"year": 0,
"__v": 0
},
{
"courses": [
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "62395837daa1f097d4062697",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Precalculus",
"term": "fall",
"year": "Freshman",
"credits": 4,
"number": "AS.110.105",
"area": "Q",
"version": "Fall 2021",
"__v": 0
},
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [
{
"Description": "Grade of C- or better in AS.110.107 OR AS.110.109 OR AS.110.113 OR AS.110.201 OR AS.110.212 OR AS.110.302, or a 5 or better on the AP BC exam.",
"Expression": "AS.110.107[C]^OR^AS.110.109[C]^OR^AS.110.113[C]^OR^AS.110.201[C]^OR^AS.110.212[C]^OR^AS.110.302[C]",
"IsNegative": "N"
}
],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "6239583cdaa1f097d40626b2",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Calculus III",
"term": "spring",
"year": "Freshman",
"credits": 4,
"number": "AS.110.202",
"area": "Q",
"version": "Spring 2022",
"__v": 0
}
],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781a",
"name": "Freshman",
"user_id": "mockUser",
"year": 2021,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781c",
"name": "Sophomore",
"user_id": "mockUser",
"year": 2022,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781e",
"name": "Junior",
"user_id": "mockUser",
"year": 2023,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77820",
"name": "Senior",
"user_id": "mockUser",
"year": 2024,
"__v": 0
}
]
}
DELETE
/api/plans/:plan_id
Deletes a plan corresponding to a given id. By deleting a plan, all associated courses and distributions are deleted from the database.
Name | Type | Description | |
---|---|---|---|
Params | plan_id | String | id of plan to delete |
Output | Plan | Deleted plan. |
Sample Output
{
"majors": [
"B.S. Computer Science (NEW - 2021 & after)"
],
"distribution_ids": [],
"_id": "623659ddb8316b8b54f77815",
"name": "Unnamed Plan",
"user_id": "mockUser",
"__v": 1,
"years": [
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77817",
"name": "AP/Transfer",
"user_id": "mockUser",
"year": 0,
"__v": 0
},
{
"courses": [
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "62395837daa1f097d4062697",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Precalculus",
"term": "fall",
"year": "Freshman",
"credits": 4,
"number": "AS.110.105",
"area": "Q",
"version": "Fall 2021",
"__v": 0
},
{
"termOffered": [],
"tags": [],
"wi": false,
"taken": false,
"preReq": [
{
"Description": "Grade of C- or better in AS.110.107 OR AS.110.109 OR AS.110.113 OR AS.110.201 OR AS.110.212 OR AS.110.302, or a 5 or better on the AP BC exam.",
"Expression": "AS.110.107[C]^OR^AS.110.109[C]^OR^AS.110.113[C]^OR^AS.110.201[C]^OR^AS.110.212[C]^OR^AS.110.302[C]",
"IsNegative": "N"
}
],
"isPlaceholder": false,
"isTransfer": false,
"ratings": [],
"distribution_ids": [],
"_id": "6239583cdaa1f097d40626b2",
"user_id": "mockUser",
"year_id": "623659ddb8316b8b54f7781a",
"plan_id": "623659ddb8316b8b54f77815",
"title": "Calculus III",
"term": "spring",
"year": "Freshman",
"credits": 4,
"number": "AS.110.202",
"area": "Q",
"version": "Spring 2022",
"__v": 0
}
],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781a",
"name": "Freshman",
"user_id": "mockUser",
"year": 2021,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781c",
"name": "Sophomore",
"user_id": "mockUser",
"year": 2022,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f7781e",
"name": "Junior",
"user_id": "mockUser",
"year": 2023,
"__v": 0
},
{
"courses": [],
"plan_id": [
"623659ddb8316b8b54f77815"
],
"_id": "623659ddb8316b8b54f77820",
"name": "Senior",
"user_id": "mockUser",
"year": 2024,
"__v": 0
}
]
}