- A simple project that a shop would be able to register its seller
- Enabling the company to:
- Register Sales
- Control sale commission
- Send details about the sales to the seller by email
-
$ git clone https://github.com/rafaelbreno/seller-controller-test
-
$ cd seller-controller-test
-
$ composer install
-
$ npm install
-
$ npm run dev
- Configure .env.example file
- I used Mailtrap.io to mock email
-
$ cp .env.example .env
-
$ php artisan key:generate
- You can run it in 3 different ways
- Shell Script
-
$ ./start.sh
- This will start a Laravel Docker based application automatically
- There are more info about the file, in the file, all commented
-
- Docker
-
$ chmod -R 777 storage/ storage/*
-
$ docker-compose up -d
-
$ docker-compose exec app php artisan migrate:fresh
-
- Common way
-
$ php artisan migrate:fresh
-
- After that you can access the app in the following url:
http://localhost:8000/
-
$ php artisan test
- It will run some tests
- All stored at: 'tests/feature/UserTest.php'
-
$ php artisan db:seed
- To fill the database with dummy data
- Application:
- Develop a Sales and Sellers API, to calculate the Seller's commission of each sale
- Commission of 8.5%
-
Register new Seller
- Method: POST
- URL:
/seller/create
- Request Body:
-
{ "name": "string, not unique", "email": "string, unique" }
-
- Response Body:
-
{ "id": "string, uuid", "name": "string, not unique", "email": "string, unique" }
-
-
List all Sellers
- View:
- Method: GET
- URL:
/seller
- Returns Blade View
user/index.blade.php
- API:
- Method: GET
- URL:
/api/sellers
- Request Body:
-
{}
-
- Response Body:
-
{ "id": "string, uuid", "name": "string, not unique", "email": "string, unique", "commission": "integer" }
-
- View:
-
Register new Sell
- Method: POST
- URL:
/sale/create
- Request Body:
-
{ "seller_id": "uuid", "sale_value": "integer" }
-
- Response Body:
-
{ "id": "string, uuid", "name": "string, not unique", "email": "string, unique", "commission": "integer", "sale_value": "integer", "created_at": "datetime" }
-
-
List all Sellers Sale
- Method: GET
- URL:
/seller/{id}
- Request Body:
-
{ "id": "string, uuid" }
-
- Response Body:
-
{ "id": "string, uuid", "name": "string, not unique", "email": "string, unique", "commission": "integer", "sale_value": "integer", "created_at": "datetime" }
-
- At the end of the day, an email should be sent with a sale report of that day
- Create an Application that consumes this API