- Customer does signup.
- Creates a quote.
- Reviewed the quote and marks it accepted.
- Does the payment/start the policy and backend gets the bill paid by payment link or something.
- Get detail of the policy.
- List of policies.
- Get history of a single policy.
-
Part 1: Create customer
There could be two ways to use this endpoint: a. Customer post his information along with name, dob, email/phone, password (basically does the signup) b. A staff from insurance company can post above information and customer gets the link to set password
The post body for customer probably is not enough, we should post with one unique identifier e.g. Phone or email We can create a User (I am talking about django user here), and put a one-to-one mapping with Customer table.
{ "first_name": "Ben", "last_name": "Stokes", "dob": "25-06-1991" }
-
Part 2: Create quote Quote information could be posted by a staff user, along with customer
{ "type": "personal-accident", "premium": 200, "cover": 200000 "state": "new", "customer": 1, }
Also the customer himself could login, and post the quote attributes and on backend we can fetch the customer from logged in user and can fill in before creating the quote
-
Part 3: Implement search for customers/policies. Find customers by name, dob or policy type.
- On django admin: added filter on policy: filter by name, dob and policy type
- On django admin: added filter on customer: filter by name, dob
-
Discuss how you would implement authentication for users/customers, and would these be the same or different?
Since we are already using Django REST Framework we can utilise
rest_framework authtoken
for authentication, So we can use token based authentiocation, for this we will expose one login API which validates the user credentials and returns a token which could be used in subsequent requests,User does not have to be customer necesarily, user could be staff user as well, if user is customer user will have a one-to-one mapping with customer.
- Python
- Django
- Django REST Framework
- SQLite3 (Note: SQLite3 is used to reduce the setup time. PostgreSQL would be preferred for production environments.)
To get the project up and running on your local machine, follow these steps:
- Clone the repository:
git clone https://github.com/pk026/democrance
- Create a virtualenv using:
python3 -m venv venv
- Activate environment using:
source venv/bin/activate
- Install requirements using:
pip install -r requirements.txt
- Create database schema using:
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser --username admin --email [email protected]
- run development server:
python manage.py runserver