Skip to content

picklebrownie/interview-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Challenge

The challenge is to recreate this page and the page that is displayed when an item is clicked. Additionally, the user should have to log in in order to see either of these pages.

  • do not use a framework
  • must be built in PHP 8.1 or greater
  • use Bootstrap for a simple and clean design (we are focused on functionality, so design is least important)
  • database must be MySQL or MariaDB

Dev Environment

PHP 8, MariaDB, Nginx, phpMyAdmin, Xdebug, Docker

Get Started

Ensure you have Docker Desktop installed and open.

Clone the repository from github and open the directory in the terminal.

git clone [email protected]:picklebrownie/interview-challenge.git
cd interview-challenge

Start the docker container in the background.

docker-compose up -d

To stop the docker container, run the following from the command line in the root directory of your project.

docker-compose down

Import the database

Open phpMyAdmin in your browser at http://dbadmin.localhost.

go to the import tab and select the file located at ./build/database.sql and click go. This will import the interview-challenge database, tables, and data.

Opening the site

After importing the database, open the site at http://site.localhost.

You can login using the following credentials, or sign up for a new account.

Username: obiwan
Password: hellothere

NOTE: The vehicles with make of Subaru have images. The other vehicles do not have images, and instead use a placeholder image.

Debugging

Debugging is set up to run with PHPDebug extension in VSCode and Xdebug in the docker container. To debug, ensure the PHP Debug extension is installed in VSCode and click the debug button in the sidebar. Then click the green play button to start debugging.

Design Decisions

  • Database logic is separated out into its own files: Database is the base model which User and Vehicles extend.
  • The vehicle dashboard is found at index.php and the vehicle detail page is found at vehicle.php.
  • Header and footer are included in each page and can be found at includes/header.php and includes/footer.php.
  • The index's results filter is designed to use GET instead of POST so that the user can bookmark the page and share the link with others.

TODO

  • Export database and put in build directory
  • Update readme for how to import database
  • Create development environment with docker
  • Enable php debugger
  • Create a database
  • Create a table for vehicles
  • Create a table for users
  • Import data into the vehicles table
  • Modify data in the vehicles table
  • Create a db connection class
  • Create a user class
  • Add a login page
  • Add a logout button
  • Add a register page
  • Add a reset password page
  • Create the index page
  • Create the header
  • Create Vehicle class with get methods
  • Enable pagination
  • Create the vehicle list
  • Create the filter results form
  • Implement filtering by condition, make, model, year, and color
  • Implement filtering by keyword
  • Create the vehicle detail page
  • Find and assign images for the Subaru vehicles
  • Implement search by price with jQuery slider
  • Implement search by mileage with jQuery slider
  • Create an images table with foreign key to vehicle id, many images to one vehicle relationship. images table has two columns: id and image_url where image_url is points to the image location on the server
  • Add images to the vehicle detail page
  • Add images to the index listings
  • Create a features table with foreign key to vehicle id, many features to one vehicle relationship. features table has two columns: id and feature
  • Display features on the vehicle detail page
  • Add stock number, interior color, engine, and mpg to the vehicle detail page
  • Use stock number to the index listings instead of the VIN
  • Add new fields to the vehicle detail page
  • Add image slider on vehicle details page
  • Add keywords column to the vehicles table
  • Search keywords instead of all fields in the filter results
  • Research and add semantic search for keywords
  • Implement a proper footer
  • Refactor Vehicle::addFilters($query) to avoid SQL injection

About

PHP 8.1 MySQL PhpMyAdmin Docker Xdebug Nginx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published