The project is structured as follows:
api/index.ts
sets up the backend database connection and Express server. This should actually be in theserver
folder, but it must be here due to a Vercel limitation.server/
contains the backend codebasket/
contains files related to the Basket conceptfoodItem/
contains files related to the FoodItem conceptpantryItem/
contains files related to the PantryItem conceptrecipe/
contains files related to the Recipe conceptreminder/
contains files related to the Reminder conceptuser/
contains files related to the User concept
client/
contains the frontend starter codeApp.vue
is the root component of your applicationmain.ts
is the entry point of your application, which initializes Vuecomponents/
contains the components of the frontendAccount/
contains the account settings page and the related formsPantryItem/
contains the page and components related to PantryItemDeletedItem/
contains the deleted items page displaying all items deleted from pantryBasket/
contains the baskets page displaying all of the user's basketsRecipe/
contains the the pages and components related to RecipeReminder/
contains the component related to ReminderLogin/
contains the login/register page and the related formscommon/
contains general form components that can be reused across different concepts
public/
contains base HTML files and static assets (like the default Fritter logo)router.ts
contains the Vue routerstore.ts
contains the Vuex store, which stores application state and persistent data
The following api routes have already been implemented for you (Make sure to document all the routes that you have added.):
This renders the index.html
file that will be used to interact with the backend
Returns
- A list of all the items sorted in descending order by date added
Throws
403
if the user is not logged in
GET /api/pantryItems?status=inPantry
- Get all the pantry items in the pantry for the user in session
Returns
- A list of all the items sorted in descending order by date added
Throws
403
if the user is not logged in
Body
owner
{Types.ObjectId | string} - The id of the owner of the itemname
{string} - The given name of the itemquantity
{number} - The nonnegative amount of the itemunit
{string} - The type of unit for the itemexpiration
{string | null} - The expiration date as a string for the item, if one is givenremindDays
{number} - The date to send a reminder for this item, if one is givenfoodItems
{Array<{Types.ObjectId | string}>} - The food items to be added to pantry
Returns
- A success message
- The created pantry items
Throws
403
If the user is not logged in400
If the item name is empty or a stream of empty spaces or if the item unit is not specified405
If an invalid item quantity (e.g. negative) is given, if an invalid expiration date is given, or if an invalid reminder date is given
Returns
- A success message
Throws
403
If the user is not logged in404
If the pantryItemId is not valid
Body
name
{string} - The given name of the itemquantity
{number} - The nonnegative amount of the itemunit
{string} - The type of unit for the itemexpiration
{string | null} - The expiration date as a string for the item, if one is givenremindDays
{number} - The date to send a reminder for this item, if one is giveninPantry
{boolean | null} - The status to update for this item, if provided
Returns
- A success message
- An object with the updated pantry item (either updates only the status or updates the stored item information)
Throws
403
If the user is not logged in404
If the pantryItemId is not valid or if the item unit is specified405
If an invalid item quantity (e.g. negative) is given, or if an invalid expiration/reminder date is given
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
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
Body (no need to add fields that are not being changed)
username
{string} - The user's usernamepassword
{string} - The user's password
Returns
- A success message
- An object with the update user details (without password)
Throws
403
if the user is not logged in400
if username or password is in the wrong format409
if the username is already in use
Returns
- A success message
Throws
403
if the user is not logged in
Returns
- a list of all recipes matching filter parameters, sorted alphabetically by name
Throws
403
if the user is not logged in
Returns
- the recipe with specified id
Throws
403
if the user is not logged in404
if the recipeId is not valid
Body
name
{string} - The name of the recipeingredients
{Array<{name: string, quantity: number, unit: number}>} - The ingredients needed for the recipeinstructions
{string} - The instructions for the recipecookTime
{number} - The cook time in minutes needed for the recipe
Returns
- A success message
- The created recipe
Throws
403
if the user is already logged in400
if the recipe name or instructions is empty or a stream of empty spaces400
if the ingredients list is empty405
if an invalid cook time (e.g. negative or zero) is given invalid
Returns
- A success message
Throws
403
if user is not logged in404
if the recipeId is not valid
Returns
- A list of all the items sorted alphabetically by name
Throws
403
if the user is not logged in
Returns
- the basket with specified id
Throws
403
if the user is not logged in404
if the basketId is not valid
Body
owner
{Types.ObjectId | string} - The id of the owner of the basketname
{string} - The given name of the basketingredients
{Array<{name: string, quantity: number, unit: number}>} - The items of the basket
Returns
- A success message
- The created basket
Throws
403
If the user is not logged in400
If the basket name is empty or a stream of empty spaces or if the item unit is not specified
Returns
- A success message
Throws
403
If the user is not logged in404
If the basketId is not valid
Body
name
{string} - The given name of the itemquantity
{value: number, unit: string} - The number of items and its unitbaskets
{new: string, baskets: Array<{Object}>} The basketsfoodItems
{Array<{name: string, quantity: number, unit: string}>} The food items to be added to pantry
Returns
- A success message
- An object with the updated baskets
Throws
403
If the user is not logged in
Body
name
{string} - The given name of the itemingredients
{Array<{name: string, quantity: number, unit: string}>} - The items of the basket
Returns
- A success message
- An object with the updated basket
Throws
403
If the user is not logged in404
If the pantryItemId is not valid or if the item unit is specified
Returns
- A list of all the reminders for the user in session
Throws
403
if the user is not logged in
PATCH /api/reminders/:pantryItemId
- Modify the status of the reminder associated with the pantry item
Body
dismissed
{boolean} - The status to update for this reminder
Returns
- A success message
- An object with the updated reminder
Throws
403
If the user is not logged in404
If the pantryItemId is not valid