Skip to content

A Django-based Leave Management System to handle leave requests and approvals with role-based access.

Notifications You must be signed in to change notification settings

jztchl/Leave-Management-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Leave Management System

A Django-based Leave Management System to handle leave requests and approvals with role-based access.

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Setup](#setup)
- [Running the Application](#running-the-application)
- [API Endpoints](#api-endpoints)
- [Contributing](#contributing)
- [License](#license)

## Features

- User registration with role-based access.
- Leave request submission by employees.
- Leave approval by managers.
- View leave requests by HR and managers.
- JWT authentication for secure API access.

## Installation

1. **Clone the Repository**

   ```bash
   git clone https://github.com/yourusername/Leave-Management-API.git
   cd Leave-Management-API
  1. Create a Virtual Environment

    python -m venv env
  2. Activate the Virtual Environment

    On Windows:

    .\env\Scripts\activate

    On macOS/Linux:

    source env/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Apply Migrations

    python manage.py migrate
  5. Run the Development Server

    python manage.py runserver

    The application will be available at http://127.0.0.1:8000/.

Setup

Running the Application

  1. Start the Development Server

    python manage.py runserver
  2. Access the Application

    Open your browser and navigate to http://127.0.0.1:8000/.

API Endpoints

  • User Registration

    • POST /register/
    • Request Body: { "first_name": "John", "last_name": "Doe", "username": "johndoe", "email": "john@example.com", "password": "yourpassword", "role": "EMPLOYEE" }
  • Submit Leave Request

    • POST /leave_request/
    • Request Body: { "AssignedManager": 1, "reason": "Sick leave" }
  • List Managers

    • GET /managers_list/
  • View Leaves for HR

    • GET /hr_view_leaves/
  • View Leaves for Managers

    • GET /manager_view_leaves/
  • Approve Leave

    • PATCH /manager_approve_leave/<id>/
    • Request Body: {}

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes and commit (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

For further documentation and API details, refer to the Django REST framework documentation.

Feel free to modify it based on any additional features or specifics of your project!

About

A Django-based Leave Management System to handle leave requests and approvals with role-based access.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages