Wastetopia (Food Recycling Website)
September 2016 - March 2017
This was a year-long group project in which myself and five other students were tasked with creating a website through which people could give away unwanted food in their local area. This was a large project with the following main features:
- User profiles: registering/logging in
- Ability to add an item to give away
- Ability to search for items in a specific area
- Ability to request/reserve items
- Ability to add items to a watch list
- Ability to message users
- Ability to see notifications about items in the watch list
- Ability to add reviews
- Analysis of user's habits to make recommendations or predictions
For this project, we used a Model-View-Controller (MVC) design, building all of the components from the ground up. For the Models, we used a relational database which we queried using SQL; the queries were wrapped in functions inside PHP model classes. For the Controllers we used a series of PHP classes that called functions to retrieve, add, or update data using the scripts in the model classes. The Views were rendered using a templating language called TWIG, which was passed data by the controllers. All routing was managed by a main index.php file, which checked specific authorisation requirements before routing the user's request to the appropriate controller.
We split the team into front-end and back-end designers. For the majority of the project I was on the back-end team, but towards the end of the project my focus shifted towards connecting the back-end code to the front-end visuals. My main contributions to the project were:
- Helping design the database
- Helping write the SQL queries to deal with the data in the database correctly: including queries to get data for adding/editing/viewing items and a base model for searching
- Helping with the registration system, including setting up an email system to send verification emails to users
- Creating models and controllers for the User Profile page (including functionality for checking their Watch List, looking at their history of transactions, and adding listings)
- Creating a messaging system, including tables in the database and classes for the Models and Controllers; for this step I had more input into the design of the views
- Creating a notification system
- Helping with the requesting/watch-list system
- Helping with the recommendations/predictions sections
More information is shown below.
Database and SQL Queries
The image above shows the structure of the classes within the Database. An item can have details such as tags and barcodes and images added to it; each listing contains an item along with a location and a user that has listed the item; each listing is linked to a transaction that also involves a user; each user can be linked to conversations with messages, and these conversations have to be linked to a listing.
From this, SQL statements with joins were used to get the desired information for display; these were grouped into PHP classes and placed inside Model files.