Skip to content

MagFry/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": "department01@gmail.com"
    },
    "token": "TOKEN_PARA"
}

Checking token and loading department

{
    "id": 1,
    "username": "department01",
    "email": "department01@gmail.com"
}

Listing employees of given department using its valid token

[
    {
        "employee_id": 2,
        "name": "Magda",
        "surname": "Fry",
        "email": "magfry@gmail.com",
        "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": "anna@gmail.com",
        "created_at": "2019-11-30T00:55:22.743691Z",
        "owner": 1
    }
]

Adding employee

   {
        "name": "Bartosz",
        "surname": "Walas",
        "email": "walasy@gmail.com"
    }
  • output
{
    "employee_id": 7,
    "name": "Bartosz",
    "surname": "Walas",
    "email": "walasy@gmail.com",
    "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": "walasy@gmail.com",
        "created_at": "2019-12-01T14:06:32.325699Z",
        "owner": 1
    },
    {
        "employee_id": 2,
        "name": "Magda",
        "surname": "Fry",
        "email": "magfry@gmail.com",
        "created_at": "2019-11-30T00:55:42.516781Z",
        "owner": 1
    },
    {
        "employee_id": 1,
        "name": "Anna",
        "surname": "Krawczyk",
        "email": "anna@gmail.com",
        "created_at": "2019-11-30T00:55:22.743691Z",
        "owner": 1
    }
]

Deleting employee

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

Registering department

{
	"username": "department04",
	"email": "department03@gmail.com",
	"password": "department04",
	"token": "AuthToken.objects.create(user)"
}
  • output
{
    "user": {
        "id": 4,
        "username": "department04",
        "email": "department03@gmail.com"
    },
    "token": "TOKEN_PARA"
}

About

Employee management system written in Django + React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published