A Coffee Stock for CornerJob
Features
- Security based on user roles.
- Using JWT to protect resources
- CRUD of User by admin
- CRUD of Coffee by admin
- CRUD of Order by admin
- List Coffees by customer
- Buy Coffee by customer
Main Tools
- Docker
- Symfony
- Api-Platform
- PhpUnit
- MySql
- Apache
Installing steps
-
Clone the project
~$ git clone https://github.com/pcabreus/cornerjob-test.git ~$ cd cornerjob/
-
Build and up docker (Used generic docker for sf4)
~/cornerjob$ docker-compose build ~/cornerjob$ docker-compose up -d
-
Go into the php container in order to set up the db and basic configs
~/cornerjob$ docker exec -it sf4_php bash cd
-
Run symfony commands:
GO into the code:
dev@xxx:/home/wwwroot/$ cd sf4
Install dependencies:
dev@xxx:/home/wwwroot/sf4$ composer update
Load data:
dev@xxx:/home/wwwroot/sf4$ php bin/console doctrine:schema:update --force
dev@xxx:/home/wwwroot/sf4$ php bin/console doctrine:fixtures:load
Create secure keys:
dev@xxx:/home/wwwroot/sf4$ mkdir config/jwt
Use phrase secreto
for all (Just for the test ok!?):
dev@xxx:/home/wwwroot/sf4$ openssl genrsa -out config/jwt/private.pem -aes256 4096
dev@xxx:/home/wwwroot/sf4$ openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem
Run test:
dev@xxx:/home/wwwroot/sf4$ php bin/phpunit