Two apps were made in the root of this folder (outside of clowning_around project):
- appointmnets: contain the models for the appointments
- api: the logic for API endpoints
The endpoints are as follows: +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | URL | GET | POST | PATCH | +============================================|=======================|========================================================|===============+ | clients/appointments | All appointments | N/a | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clients/appointments/upcoming | Upcoming appointments | N/a | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clients/appointments/past | Past appointment | N/a | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clients/appointments/<int:pk> | Single appointment | N/a | Update rating | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | troupeleader/createappointment | N/a | Create appointment | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clowns/appointments | All appointments | N/a | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clowns/appointments/<int:pk> | Single appointment | N/a | Change status | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clowns/appointments/<int:pk>/issue | N/a | Create issue for appointment | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+ | clowns/appointments/<int:pk>/clientdetails | N/a | Provide reason and appointment, receive client details | N/a | +--------------------------------------------+-----------------------+--------------------------------------------------------+---------------+
All views were implemented using generic views.
To test the endpoints with pre-made Postman queries: https://www.getpostman.com/collections/6f138484d70ea88e9f1d
The PostgreSQL database was dumped to datadump.json. Load it using docker-compose -f local.yml run --rm django python manage.py loaddata datadump.json
Create a superuser account with docker-compose -f local.yml run --rm django python manage.py createsuperuser to view the admin page.
To run the project:
- Build the image: docker-compose -f local.yml build
- Make migrations: docker-compose -f local.yml run --rm django python manage.py makemigrations
- Run migrations: docker-compose -f local.yml run --rm django python manage.py migrate
- Load database datadump: docker-compose -f local.yml run --rm django python manage.py loaddata datadump.json
- Run the docker image: docker-compose -f local.yml up
- Run the server: docker-compose -f local.yml run --rm django python manage.py runserver
---
There’s nothing quite as important as ensuring you’re punctual for any and all appointments made. This is a sign of respect and concern for the other parties time and needs. No being understands this quite as well as a clown. Your task, should you be so inclined, is to build a Django application, specifically for the time management needs of this world’s greatest child entertainers.
The application, when complete, should be able to allow clowns, troupe leaders and clients to:
Authenticate themselves as clowns, troupe leaders or clients
Clients to:
- View their upcoming and past appointments (as an API endpoint)
- Rate a past appointment with clown face emojis
Troupe leaders to:
- Create appointments for clowns, assigned to a limited capacity troupe, managed by themselves
Clowns to:
- View their appointments and change the current status of these appointments (upcoming, incipient, completed, cancelled)
- Report an issue with an appointment (not a state change)
- Request client contact details, with reason for request
All the above tasks should be completable through a collection of complete API endpoints. The application has a framework provided (based on https://github.com/pydanny/cookiecutter-django) with a fixture that contains dummy users you can use not only to test but also, use within your additional applications. The frontend provided can be ignored as a part of the cookiecutter and not the final application, which will be used exclusively through API endpoints. Your applications should include dummy data, which you can source from anywhere you’d like.
You only have two hours to complete the assignment, including any tasks you’d consider necessary to mark a feature/implementation/component complete. Should you not get around to doing anything, feel free to add TODO or NOTE comments to let us know you wanted to, but just didn’t get to.
The following are some things to help you get started
To get the provided datadump.json file into your database
`docker-compose -f local.yml run --rm django python ./manage.py loaddata datadump.json`
(https://coderwall.com/p/mvsoyg/django-dumpdata-and-loaddata
)
Moved to settings.
To create an superuser account, use this command:
$ python manage.py createsuperuser
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
Running type checks with mypy:
$ mypy clowning_around
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest $ coverage html $ open htmlcov/index.html
$ pytest
Moved to Live reloading and SASS compilation.
This app comes with Celery.
To run a celery worker:
cd clowning_around
celery -A config.celery_app worker -l info
Please note: For Celery's import magic to work, it is important where the celery commands are run. If you are in the same folder with manage.py, you should be right.
In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server MailHog with a web interface is available as docker container.
Container mailhog will start automatically when you will run all docker containers. Please check cookiecutter-django Docker documentation for more details how to start all containers.
With MailHog running, to view messages that are sent by your application, open your browser and go to http://127.0.0.1:8025
The following details how to deploy this application.
See detailed cookiecutter-django Docker documentation.
The following are some things to help you get started
To get the provided datadump.json file into your database
`docker-compose -f local.yml run --rm django python ./manage.py loaddata datadump.json`
(https://coderwall.com/p/mvsoyg/django-dumpdata-and-loaddata
)