/employee_hierarchy_backend

Employee Hierarchy - web application that will managing employees structure. You can use CRUD operations with that model. You can manipulate with supervisor-subordinate relationship.

Primary LanguagePython

Django CI Maintainability Test Coverage

Task:

Create a web page that will display the employee hierarchy in tree form.

Information about each employee must be stored in a database and contain the following data:

  • FULL NAME;
  • Job title;
  • Employment date;
  • Salary amount;
  • Each employee has 1 boss;
  • The database must contain at least 50,000 employees and 5 levels hierarchies.
  • Don't forget to display the employee's position.

Additional requirements:

  • Create the database using Django/Flask migrations.
  • Use DB seeder for Django ORM / Flask-SQLAlchemy to seed the database.
  • Use Twitter Bootstrap to create basic styling for your page.
  • Create another page and display a list of employees with all the information available about the employee from the database and the ability to sort by any field.
  • Add the ability to search for employees by any field for the page created in task 4.
  • Add the ability to sort (and search if you completed task No5) by any field without reloading the page, for example using ajax.
  • Using standard Django/Flask functions, authenticate the user for the registered user-only section of the website.
  • Move the functionality developed in tasks 4, 5 and 6 (using ajax requests) to a section available only to registered users.
  • In the section available only to registered users, implement the remaining CRUD operations for employee records. Please note that all fields related to users must be editable, including the boss of each employee.
  • Make it possible to upload a photo of an employee and display it on the page where you can edit information about the employee. Add an additional column with a thumbnail photo of the employee on the list of all employees page.
  • Implement the ability to redistribute employees in case of a change in boss (a bonus may be that you can do this using the built-in mechanisms/paradigms offered by Django ORM / Flask-SQLAlchemy ORM).
  • Implement lazy loading for the employee tree. For example, show the first two levels of the hierarchy by default and load the next 2 levels or the entire tree branch when you click on a second-level employee.
  • Implement the ability to change an employee's boss using drag-n-drop directly in the employee tree.

Installation:

To start demo you need installed postgres or installed docker-compose

Running:

  1. Install dependencies use poetry install
  2. Fill the .env file in the root directory, use .env-example
  3. Run app with make dev
  4. Run app with docker-compose make docker-start

Working with:

If you want to seeding your test-db:

  1. Run make seed-first for seeding your first CEO-employee.
  2. Run make seed-dev for seeding the others, like intern, junior, middle and senior employees.
  3. Run make flush if you want to flush your dev database.