Setting Up locally
- Install
pipenv
using commandpip install pipenv
- Clone the repository.
- Activate virtual environment using command
pipenv shell
- Install all dependecies using command
pipenv install
- Navigate to the
server
directory and type
python manage.py migrate
- Create super user to access admin dashboard
python manage.py createsuperuser
- Start the development server
python manage.py runserver
- Open
127.0.0.1:8000
into the browser to see things in action
Database Schema and relationships
API Documentation and automated testing
Once the development server is up and running then you can visit http://127.0.0.1:8000/swagger/ to see API documentation.
Models and Views(API) automated testing
python manage.py test
Endpoints response screenshots
- GET method: Getting tickets for a user ( By default : 2 Tickets )
http://127.0.0.1:8000/api/tickets/<user_id> e.g. http://127.0.0.1:8000/api/tickets/3
Tickets with count, http://127.0.0.1:8000/api/tickets/2?count=5
- GET method: Getting list of upcoming events
http://127.0.0.1:8000/api/upcoming-events
- POST method: Participating in an event ( event_id and ticket_id required in body)
http://127.0.0.1:8000/api/participate
Body
{
"event_id" : 5,
"ticket_id" : 7
}
- GET method: Get all past winners
http://127.0.0.1:8000/api/past-winners
- GET method: Announce winner of an event. ( event_id is required )
http://127.0.0.1:8000/api/event-winner/<event_id> e.g. http://127.0.0.1:8000/api/event-winner/6