Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 2.17 KB

README.md

File metadata and controls

58 lines (45 loc) · 2.17 KB

I have prepared a file .env and sqlite database to make it easy for you to run the project.

Installation and Run project

  1. Run the following commands to install and run the project

composer install

2. To fill DB

php artisan db:seed

3. To run the project

php artisan serve

4. To run tests

php artisan test

Endpoints

  1. GET "/api/products" - get list of products
    Parameters:
    size (required, integer)
    page (required, integer)
    Filters:
    category (string) - filter by category name of products
    discount (integer) - filter by discount percentage of products
    priceLess (integer) - filter by product price. This filter applies before discounts are applied and will show products with prices lesser than or equal the value provided

    All filter works as a query string parameter.
    Example: http://127.0.0.1:8000/api/products/?page=1&size=5&category=boots

    You can you multiple filters. It shows a list of products that matches all filters
    Example: http://127.0.0.1:8000/api/products/?page=1&size=5&category=boots&priceLess=89000

  2. GET "api/products/{id}" - get product by id

  3. POST "api/products" - create new product
    Fields:
    sku (required, string)
    name (required, string)
    category (required, string)
    price (required, double like 150.00)
    discount_id (optional, integer, exists:discounts,id)

  4. PUT "api/products/{id}" - update product
    Fields:
    sku (string)
    name (string)
    category (string)
    price (double like 150.00)
    discount_id (integer, exists:discounts,id)

  5. DELETE "api/products/{id}" - delete product

Screenshoots

image

image