This test requires:
- Working with PHP7.* and Symfony 4+
- Mysql Database
- Use Symfony coding standards
- Nginx or Apache
-
Implement a call to NASA API to retrieve the list of Asteroids based on their closest approach date to Earth (Near-Earth Objects - NEOs):
- Use api.nasa.gov
- API-KEY: (hidden, can be provided separately)
- Documentation: https://api.nasa.gov/ and go to "Browse APIs -> Asteroids - NeoWs"
- Limit the query to the last 3 days.
-
Persist the resulting list in your DB without duplicates. Define the data model as follows:
- date
- reference (neo_reference_id)
- name
- speed (kilometers_per_hour)
- is hazardous (is_potentially_hazardous_asteroid)
-
Create the following routes in your application:
- GET /neo/hazardous
- return all DB entries which contain potentially hazardous asteroids (with pagination)
- response format: JSON
- GET /neo/fastest?hazardous=(true|false)
- calculate and return the model of the fastest asteroid
- with a hazardous parameter, where true means is hazardous
- default hazardous value is false
- response format: JSON
- GET /neo/best-month?hazardous=(true|false)
- calculate and return a month with most asteroids (not a month in a year)
- with a hazardous parameter, where true means is hazardous
- default hazardous value is false
- response format: JSON
- GET /neo/hazardous
-
Bonus points:
- Clean and straightforward code
- Use restful API best practices
- Create functional tests for API endpoints.
- Use Docker
Technologies:
- PHP 7.4
- Symfony 5.1
- Nginx+php-fpm
- MySQL 5.7
- Docker (docker-compose)
- Project setup in Docker will be refactored
- Functional tests are not yet implemented
-
Copy .env.dist to .env to setup docker variables
HOST_USER=1000:1000 MYSQL_DATABASE=clicklogic_test_task MYSQL_ROOT_PASSWORD=password MYSQL_PASSWORD=password MYSQL_USER=root COMPOSER_AUTH='{"github-oauth":{"github.com":"<personal access token>"}}'
-
Copy app.env.dist to app/.env.local to setup application variables and set proper variables
-
Run
docker-compose build docker-compose up -d
-
Go inside php-fpm container and install composer dependencies
docker-compose exec php-fpm bash composer install
-
Inside php-fpm container run
php bin/console nasa-api:parse-near-earth-objects
-
Download Postman collection and environment (in the postman folder), set NASA API key in environment variables and check endpoints.