Skip to content

Rafaellcx/m2-digital

Repository files navigation

About

M2 Digital - WEB - Backend test. Created some items like Contracts, Factories, Seeders, Dependency Injection, Docker and Swagger in Laravel 8.

Solution

Made using the Laravel 8 framework, MySQL database, Docker for application containerization and Swagger for APIS visualization and testing.

img.png

How to run the project

After downloading the m2-digital repository, being in its main folder, go up the structure composed of the following containers:

  • api-m2-back: Composed with Apache and PHP, being exposed to port 8000;
  • api-m2-db: With the MySql database.
  1. Create the .env file from the .env.example file contained in the project root:
  cp .env.example .env
  1. Through the following commands:
docker-compose build
docker-compose up -d

After finishing the creation of the containers, we must execute the commands below so that the environment is ready to be used:

  1. Used to populate the database with the necessary tables of the solution:
    docker exec -ti api-m2-back php artisan migrate
  2. Used to populate the tables if you want to view pre-registered data(Optional):
    docker exec -it  api-m2-back php artisan db:seed
  3. Used to permissions config(Required).
    docker exec -it  api-m2-back chown -R www-data:www-data storage/

Now we can use the application through the address "http://127.0.0.1:8000/api/documentation" If you want to run the application later, check if the api-m2-back container is active executing the following command (Remembering that the same can/must be applied to the container from the database):

docker container ls -a

If you want to start the api-m2-back container, run the following command:

docker container start api-m2-back

If you want to stop the api-m2-back container, run the following command:

docker container stop api-m2-back

ER Diagram

In the proposed diagram, note that there could be a relationship between city and group similar to the relationship between campaign and product tables, however, despite being a very viable form of normalization, for the test in question it would not be mandatory.

img_1.png

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages