Giter Club home page Giter Club logo

orgchart-release's Introduction

Organization Chart API Documentation

Base URL:

http://localhost:4000

image

Endpoints:

  1. GET /api/org/allusers

    • Description: Fetches all users.
    • Request Type: GET
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "message": "Fetched all users successfully",
            "data": [Array of User Objects]
        }
      • Status Code: 500 Internal Server Error
      • Body:
        {
            "message": "Failed to fetch all the users"
        }
  2. POST /api/org/orgchart

    • Description: Retrieves hierarchy for the organization chart.
    • Request Type: POST
    • Body Parameters:
      • email: Email of the user.
      • reportsTo: Email of the immediate supervisor (optional, set to 'null' if not applicable).
    • Response:
      • Status Code: 200 OK
      • Body: Array of user objects representing the hierarchy.
      • Status Code: 500 Internal Server Error
      • Body:
        {
            "message": "Something went wrong, Cannot fetch the hierarchy"
        }
  3. GET /api/org/roles?DOMAIN=[PR/TECH]

    • Description: Retrieves all roles in a specified domain.
    • Request Type: GET
    • Query Parameter:
      • DOMAIN: Domain name (PR or TECH).
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "message": "Sent roles from: [DOMAIN]",
            "data": [Array of Role Names]
        }
      • Status Code: 400 Bad Request
      • Body:
        {
            "message": "Domain doesn't exist"
        }
  4. GET /api/org/dept?DOMAIN=[PR/TECH]

    • Description: Retrieves all departments in a specified domain.
    • Request Type: GET
    • Query Parameter:
      • DOMAIN: Domain name (PR or TECH).
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "message": "Sent all departments from: [DOMAIN]",
            "data": [Array of Department Names]
        }
      • Status Code: 400 Bad Request
      • Body:
        {
            "message": "Domain doesn't exist"
        }
  5. GET /api/org/senior?ROLE=[Role]&DEPARTMENT=[Department]

    • Description: Retrieves emails of immediate seniors in a department for a given role.
    • Request Type: GET
    • Query Parameters:
      • ROLE: Role name.
      • DEPARTMENT: Department name.
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "message": "Senior email array sent successfully",
            "data": [Array of Email Addresses]
        }
      • Status Code: 500 Internal Server Error
      • Body:
        {
            "message": "Error fetching the senior email array"
        }
  6. POST /api/user/register

    • Description: Adds a new user to the system.
    • Request Type: POST
    • Body Parameters:
      • name: Name of the user.
      • email: Email of the user (must be unique).
      • password: Password of the user.
      • role: Role of the user.
      • department: Department of the user.
      • reportsTo: Email of the immediate supervisor.
    • Response:
      • Status Code: 200 OK
      • Body:
        "User created successfully"
      • Status Code: 409 Conflict
      • Body:
        "User already exists"
      • Status Code: 500 Internal Server Error
      • Body:
        "Internal server error, Failed to create user"
  7. POST /api/auth/login

    • Description: Logs in a user or admin.
    • Request Type: POST
    • Body Parameters:
      • NAME: Name of the user or admin.
      • ROLE: Role of the user or admin (USER or ADMIN).
      • EMAIL: Email of the user or admin.
      • PASSWORD: Password of the user or admin.
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "name": "User/Admin Name",
            "email": "User/Admin Email",
            "role": "User/Admin Role",
            "reportsTo": "Supervisor's Email",
            "accessRole": "User/Admin Role"
        }
      • Status Code: 400 Bad Request (Wrong credentials)
      • Body:
        "Wrong credentials!"
      • Status Code: 500 Internal Server Error
      • Body:
        "Internal server error occurred"
  8. POST /api/admin/register

    • Description: Registers a new admin.
    • Request Type: POST
    • Body Parameters:
      • name: Name of the admin.
      • email: Email of the admin (must be unique).
      • password: Password of the admin.
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "message": "Admin created successfully",
            "email": "Admin Email"
        }
      • Status Code: 500 Internal Server Error
      • Body:
        {
            "message": "Failed to create Admin"
        }
  9. GET /api/org/samedesignation

    • Description: Retrieves employees who work with a specified supervisor.
    • Request Type: GET
    • Body Parameters:
      • reportsTo: Email of the supervisor.
    • Response:
      • Status Code: 200 OK
      • Body:
        {
            "data": [Array of Employee Objects]
        }
      • Status Code: 500 Internal Server Error
      • Body:
        "Internal Server Error"

  1. POST /api/org/reportingto

  • Description: Retrieves people reporting to the current user.
  • Request Type: POST
  • Body Parameters:
    • email: Email of the current user.
  • Response:
    • Status Code: 200 OK
    • Body:
      {
          "data": [Array of User Objects],
          "message": "Fetched successfully"
      }
    • Status Code: 400 Bad Request
    • Body:
      "Failed to fetch"

Note: Replace [...] with actual values.

This documentation provides details on each API endpoint, including request type, parameters, response format, and possible status codes. Use it as a reference for integrating with the API.

orgchart-release's People

Contributors

deexithparand2k2 avatar deexijman avatar hafeeluddeen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.