Django Rest Framework API for Office Automation (register user, register department, task management, ....)
This project cover followin tasks:
- Add User as Employee (username, first name, last name, email)
- Add Department by Admin User
- Request for Promotion from a regular employee to department employee
- Request for Promotion from a department employee to department manger
- Create task for yourself and other department employee
Most of APIs are represented on DRF API-Root Page Browsable API, But not all of them.
"tasks": "http://127.0.0.1:8000/tasks/[pk]"
"users": "http://127.0.0.1:8000/users/[pk]"(http://127.0.0.1:8000/users/)
"department": "http://127.0.0.1:8000/department/[pk]"
"request": "http://127.0.0.1:8000/request/[pk]"
This is not apeared in API-Root Page, Because it is not register in router.
"dashboard": "http://127.0.0.1:8000/dashboard/[pk]"
Default User of Django has been extented to meet requirements of project(Default process of creating new user in Django doesn't include first_name, last_name)
The custom user model is developed by extending AbstractUser model.
List All user Just to All Visitors, But hey cann't Create New User.
Just UnAuthenticated User can create create.
"users": "http://127.0.0.1:8000/users/[pk]"(http://127.0.0.1:8000/users/)
Membership is request of regular employee who is not belong to any department to the admin or manager of the depatmen to become a member of that department. "request": "http://127.0.0.1:8000/request/[pk]"
Hint: It is recorded in database as "m"(initial of membership) to "request_type" field.
Promotion is a request of dapartment employee who wants to become of a department manger. "request": "http://127.0.0.1:8000/request/[pk]"
Hint: It is recorded in database as "e2m"(initial of "Employee to Manager") to "request_type" field.
In order to dissmiss or fire a employee from department or degrading a manager to an employee, It is just set the department name of users/pk=id to null.
There is also an fire GET method on user according to bellow: http://127.0.0.1:8000/users/[pk]/fire
manager or admin auhtoization is checked, but this API is not well-tested!
All request will be listed to the user according to its rule:
Unathenticated User will see nothing.
Managers will see Membership request of regular employee to its department.
Admin will see all type of reqests.
They can access a request by its pk id. and reject or accept the request.
rejected request will be removed from database table. accepted tabel will make change in database:
- Make user manger of a department in case of acceptance of promotion request.
- Make change to department name of user class in case of acceptance of membership request.
All user can create task, an employee can just assign it to himsef, but manager assign it to himself or his department employee.
"dashboard": "http://127.0.0.1:8000/dashboard/[pk]"
Postman is the most popular API testing tools, I grab the headers and body from Inspect Element, Then I can Change the Parameters I need to test.
There are also some more alternative method to test project in djando and DRF API, But definitely Postman API Testing Method is superior to all. The active way of testing API in this projec was Browsable API of DRF. All code has been written in a way than code be tested with Browsable API of DRF
Unforunaetly, In the begginig of project, I wasn't familiar with awesome api documentation tools Swagger and openAPI standard. I could design better API.

