Application for creating, retrieving, listing and deleting employees inside company.
After creating employee will get email with login and password.
Each employee with department HR will get staff status.
$ pip install -r requirments.txt
$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py loaddata fixtures.json
$ python3 manage.py runserver
It will create a database with following employees:
- login: admin, password: admin123
- login: HRUser, password: LDJ7LZ59
- login: Buyer, password: CGP7RNGG
- /api/employees/ GET list of employees
- /api/employees/ POST create employee (staff only)
- /api/employees/:id/ GET retrieve employee
- /api/employees/:id/ PUT update employee (staff only)
- /api/employees/:id/ PATCH partial update (owner only)
- /api/employees/:id/ DELETE delete employee (staff only)
Create new employee with
username "NewUser"
rank "Senior
department "Digital"
email "[email protected]":
curl -u HRUser -d "username=NewUser&rank=S&department=DG&[email protected]" -X POST http://localhost:8000/api/employees/
Get list of employees:
curl http://localhost:8000/api/employees/
Retrieve data of employee with id 3:
curl http://localhost:8000/api/employees/3/