Final project for Team time(e) the beaver in MIT 6.1040.
The following backend routes are implemented.
Body
username
{string} - The user's usernamepassword
{string} - The user's password
Returns
- A success message
- An object with the created user's details (without password)
Throws
403
if there is a user already logged in400
if username or password is in the wrong format409
if username is already in use
Returns
- Currently logged in user, or null if not logged in
Body
username
{string} - The user's usernamepassword
{string} - The user's password
Returns
- A success message
- An object with user's details (without password)
Throws
403
if the user is already logged in400
if username or password is not in correct format format or missing in the req401
if the user login credentials are invalid
Returns
- A success message
Throws
403
if user is not logged in
Body
password
{string} - The user's password
Returns
- A success message
- An object with the updated user details (without password)
Throws
403
if the user is not logged in400
if password is in the wrong format
Returns
- An array of goals created by logged in user.
Throws
403
if the user is not logged in
Returns
- An array of goals representing the goal feed
Throws
403
if the user is not logged in
Returns
- An array of the goals of the given user
Throws
403
if the user is not logged in403
if user is not friends with given user
Body
hours
{number} - The number of hourscategory
{string} - The name of the category associated with the goaltype
{string} - The type of the goal (”goal” or “budget”)private
{boolean} - true if goal is private, false if goal is not private
Returns
- A success message
- An object with the created goal
Throws
403
if the user is not logged in409
if logged in user already has a goal for the given category400
if hours is invalid number404
if category does not exist400
if type is invalid
Body
hours
{number} - The number of hourscategory
{string} - The name of the category associated with the goaltype
{string} - The type of the goal (”goal” or “budget”)private
{boolean} - true if goal is private, false if goal is not private
Returns
- A success message
- An object with the updated goal
Throws
403
if the user is not logged in409
if logged in user already has a goal for the given category400
if hours is invalid number404
if category does not exist404
if given goal does not exist400
if type is invalid
Returns
- A success message
Throws
403
if the user is not logged in403
if the user does not own the given goal404
If the given goal does not exist
Returns
- An array of categories created by logged in user.
Throws
403
if the user is not logged in
Body
name
{string} - The name of the category
Returns
- A success message
- An object with the created category
Throws
403
if the user is not logged in400
if name is incorrect format409
if logged in user already has a category with name
Returns
- A success message
Throws
403
if the user is not logged in404
If the logged in user doesn’t have a category with the given name
Body
name
{string} - The new name
Returns
- A success message
- An object with the updated category
Throws
403
if the user is not logged in400
if new name is incorrect format404
If the logged in user doesn’t have a category with the given name409
if logged in user already has a category with new name
Returns
- Array of friend objects, sorted by date first one being most recent
Throws
403
if user not logged in
Returns
- Array of friend request objects, sorted by date first one being most recent
Throws
403
if user not logged in
Returns
- String representing friend request status: ‘friends’, ‘request sent’, ‘request received’, or ‘no’
Throws
403
if user not logged in400
if username not included in request404
ifusername
is not recognizable username
Returns
- Success message
Throws
403
if user not logged in400
if username not included in request404
iffriend
is not recognizable username403
iffriend
is not a friend of current user
Returns
- Success message
- Friend request object
Throws
403
if user not logged in400
isrequestee
is empty404
ifrequestee
is not recognizable username409
if already friends withrequestee
, or has incoming or sent friend request torequestee
Returns
- Success message
Throws
403
if user not logged in400
isrequestee
is empty404
ifrequestee
is not recognizable username404
if friend request does not exist
Body
response
{string} - 'accept' if accepting, 'reject' if rejecting
Returns
- Success message
Throws
403
if user not logged in400
isrequester
is empty404
ifrequester
is not recognizable username404
if friend request does not exist400
isresponse
is not 'accept' nor 'reject'
GET /api/entries?category=categoryName&start=startTime&end=endTime
- Get logged in user’s time entries over given time period associated with given categories
Returns
- An array of time entries (all query attributes are optional)
Throws
403
if the user is not logged in404
if category with given name is not found400
if start is incorrect format400
if end is incorrect format400
if the time period from start to end is not a valid non zero time period
Body
start
{string} - ISO start timeend
{string} - ISO end timecategory
{string} - The name of the category associated with this time entrytag
{string} - The tag for this time entry (not required)overwrite
{boolean} - true if time entry should overwrite conflicts
Returns
- A success message
- An object with the created time entry
Throws
403
if the user is not logged in400
if start is incorrect format400
if end is incorrect format400
if the time period from start to end is not a valid non zero time period404
if category with given name is not found409
if this time entry would conflict with another
Returns
- A success message
Throws
403
if the user is not logged in403
if the user is not the owner of this time entry404
If time entry does not exist
Body
start
{string} - ISO start timeend
{string} - ISO end timecategory
{string} - The name of the category associated with this time entrtag
{string} - The tag for this time entry (not required)
Returns
- A success message
- An object with the updated time entry
Throws
403
if the user is not logged in400
if start is incorrect format400
if end is incorrect format400
if the time period from start to end is not a valid non zero time period404
if category with given name is not found404
if given time entry does not exist409
if this time entry would conflict with another