- Hotels service
Hotels CRUD service api .
- Consul used to register services such as php-fpm , nginx
- Link each service to service registry .
- Monitor health check and reload service if it's down .
- Docker installed on your machine .
-
git clone https://github.com/MohamedFawzy/hotels.git
-
cd hotels
-
cd docker
-
docker-compose up
-
Open your browser at
http://localhost:8500
you should see registered services up and running . -
Open docker container for php-fpm with the following command
docker exec -it docker_microservice_hotels_fpm_1 /bin/bash
-
Install composer packages
composer install
-
copy
source/.env.example
to.env.
change to the followingDB_CONNECTION=mongodb DB_HOST=mongodb DB_PORT=27017 DB_DATABASE=hotels DB_USERNAME= DB_PASSWORD=
-
Open fpm container
docker exec -it docker_microservice_hotels_fpm_1 /bin/bash
then 1-php artisan key:generate
2-php artisan config:cache
3-php artisan db:seed
4-./frontend.sh
5-npm install
-
Use any mongo database GUI tool to access collection or login to
docker exec -it mongodb /bin/bash
thenmongo
,use hotels
,db.hotels.find({}).pretty()
you should see collection of documents for hotels generated by seed
docker exec -it docker_microservice_hotels_fpm_1 /bin/bash
./vendor/bin/phpunit
1- Search can by done for range using IN with "," comma separated e.g 29-03-2018,27-04-2018
.
2- Search support IN , equal , LIKE , etc .
3- Sorting using all columns desc , asc .
- Factory : hide implementation from client class
- Repository : assumed will add cache layers for filters in future so i need repository to cache query objects .
- Service layer : for calling repository and aggregate multiple repository .
- Decorator : Change object presentation in response used for filter, sort objects .
- Hydrator : Hydrate request into entity .
- Transformer: Transform response object to hotels entity .
1- Let GUI render multiple objects of availability .
2- Remove availability in a separate collection and aggregate it's result with hotels in Hotels Service .
3- Improve code coverage .