Skip to content

nknik/Employee_Management_App

 
 

Repository files navigation

How to run project locally

pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver 8000
npm run dev

and visit: http://localhost:8000/

Description

  • Backend: Django REST framework
  • Frontend: React + Redux

Deployed on heroku with PostgreSQL database

Link: https://emp-app-prod.herokuapp.com/

REST API endpoints

Employees

Departments

Links

Examples in Postman

Login department

    {
	"username": "department01",
        "password": "department01"
    }
  • exemplary output
{
    "user": {
        "id": 1,
        "username": "department01",
        "email": "[email protected]"
    },
    "token": "TOKEN_PARA"
}

Checking token and loading department

{
    "id": 1,
    "username": "department01",
    "email": "[email protected]"
}

Listing employees of given department using its valid token

[
    {
        "employee_id": 2,
        "name": "Magda",
        "surname": "Fry",
        "email": "[email protected]",
        "created_at": "2019-11-30T00:55:42.516781Z",
        "owner": 1
    },
    {
        "employee_id": 1,https://emp-app-prod.herokuapp.com/api/employees/
        "name": "Anna",
        "surname": "Krawczyk",
        "email": "[email protected]",
        "created_at": "2019-11-30T00:55:22.743691Z",
        "owner": 1
    }
]

Adding employee

   {
        "name": "Bartosz",
        "surname": "Walas",
        "email": "[email protected]"
    }
  • output
{
    "employee_id": 7,
    "name": "Bartosz",
    "surname": "Walas",
    "email": "[email protected]",
    "created_at": "2019-12-01T14:06:32.325699Z",
    "owner": 1
}
  • Now we can check the list of employees to check if the employee was added to the given department
[
    {
        "employee_id": 7,
        "name": "Bartosz",
        "surname": "Walas",
        "email": "[email protected]",
        "created_at": "2019-12-01T14:06:32.325699Z",
        "owner": 1
    },
    {
        "employee_id": 2,
        "name": "Magda",
        "surname": "Fry",
        "email": "[email protected]",
        "created_at": "2019-11-30T00:55:42.516781Z",
        "owner": 1
    },
    {
        "employee_id": 1,
        "name": "Anna",
        "surname": "Krawczyk",
        "email": "[email protected]",
        "created_at": "2019-11-30T00:55:22.743691Z",
        "owner": 1
    }
]

Deleting employee

[
    {
        "employee_id": 7,
        "name": "Bartosz",
        "surname": "Walas",
        "email": "[email protected]",
        "created_at": "2019-12-01T14:06:32.325699Z",
        "owner": 1
    },
    {
        "employee_id": 1,
        "name": "Anna",
        "surname": "Krawczyk",
        "email": "[email protected]",
        "created_at": "2019-11-30T00:55:22.743691Z",
        "owner": 1
    }
]

Registering department

{
	"username": "department04",
	"email": "[email protected]",
	"password": "department04",
	"token": "AuthToken.objects.create(user)"
}
  • output
{
    "user": {
        "id": 4,
        "username": "department04",
        "email": "[email protected]"
    },
    "token": "TOKEN_PARA"
}

About

Employee management system written in Django + React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 71.1%
  • Python 26.4%
  • HTML 2.5%