/fast-api

ConTime API is the bridge between the backend and the frontend of the ConTime Web Application.

Primary LanguagePython

ConTime API

ConTime API is the bridge between the backend and the frontend of the ConTime Web Application.


Technologies & Tools used :

  • Python v3.8.5
    • FastAPI - "A modern, fast, web framework for building APIs..."
    • Pydantic - "Data validation and settings management using python type annotations."
    • Typing - A standard Python module for declaring datatypes like [dict, list, set, tuple].
    • PyMongo - "A Python distribution containing tools for working with MongoDB..."
  • MongoDB - "A document database, which means it stores data in JSON-like documents..."

ConTime API Roles:

  • CREATE new users and calendars.
    • There are two types of user [ employer, employee ]
    • A calendar can only be created by a employee ( user_type )
  • UPDATE or DELETE existing users, and calendars.
    • Update employer's password.

Schemas ⠀ { " " : " " }

  • ( user_type ) employer
{
  "first_name": "string",
  "last_name": "string",
  "email": "string",
  "password": "string",
  "id": "unique_id",
  "date_created": "date_time"
}
  • ( user_type ) employee
{
  "employer_id": "string",
  "first_name": "string",
  "last_name": "string",
  "email": "string",
  "id": "unique_id",
  "date_created": "date_time"
}
  • Calendar
{
  "employer_id": "string",
  "employee_id": "string",
  "week_id": "string",
  "week_start_end": {},
  "sunday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "monday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "tuesday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "wednesday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "thursday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "friday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "saturday": {
    "hour": 0,
    "location": "",
    "description": ""
  },
  "date_created": "date_time"
}

Routes ⠀ ↺ ↻

  • "⠀/⠀"⠀ ⮂ ⠀ [ 'GET' ] ⠀ ⟼ ⠀ Home of ConTime API, This route redirects to '/docs' route, if using applications such as PostMan it is recommended to visit ' /openapi.json ' route instead.

  • " /users/{user_type} "⠀ ⮂ ⠀ [ 'GET' ]⠀ ⟼ ⠀ Get all employers or employees from DataBase.

  • " /user/{user_type} "⠀ ⮂ ⠀ [ 'GET' , 'DELETE' ]⠀ ⟼ ⠀ Get or delete a employer or employee from DataBase.

    • Authentication : ⠀ Use user's email and password
  • " /add_employer "⠀ ⮂ ⠀ [ 'POST' ]⠀ ⟼ ⠀ Insert a new Employer instance into the DataBase.

  • " /add_employee "⠀ ⮂ ⠀ [ 'POST' ]⠀ ⟼ ⠀ Insert a new Employee instance into the DataBase.

  • " /employer/get_employees "⠀ ⮂ ⠀ [ 'GET' ]⠀ ⟼ ⠀ Get all employees who's employer_id is equal to employer's id.

    • Authentication : ⠀ Use user's email and password
  • " /employer/change_password "⠀ ⮂ ⠀ [ 'PUT' ]⠀ ⟼ ⠀ Change Employer ( user_type ) password.

    • Authentication : ⠀ Use user's email and password
  • " /calendar "⠀ ⮂ ⠀ [ 'GET' ]⠀ ⟼ ⠀ Get all calendars from the DataBase.

  • " /calendar/{user_type} "⠀ ⮂ ⠀ [ 'GET' ]⠀ ⟼ ⠀ Get All of user's calendar.

    • Authentication : ⠀ Use user's email and password
  • " /calendar//calendar/current_week "⠀ ⮂ ⠀ [ 'PUT' ]⠀ ⟼ ⠀ Create or Update current week's calendar.

    • Authentication : ⠀ Use user's email and password




Author: Marcelo Martins
GitHub: @matxa
Email: matxa21@gmail.com