ConTime API

contime_logo

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


Technologies & Tools used :

  • Python v3.8.5
    • Flask - "a micro web framework."
    • JsonSchema - "an implementation of JSON Schema for Python."
    • MongoEngine - "a python object data mapper for mongodb."
    • Bcrypt - "Good password hashing for your software and your servers."
  • MongoDB - "A document database, which means it stores data in JSON-like documents..."

ConTime API Roles:

  • ConTime is a web application that makes it easier for Sub(Contractors) to keep track of their employee's working history.

    • Quick Overview of API features
      • CREATE [ company, employee, calendars ]
      • DELETE [ company, employee ]
      • UPDATE [ company_password, employee_password, send_job_request, weekly_calendar ]

    ⠀ The Roles of the API are better understood in the endpoint section

⠀ Schemas ⠀ { " " : " " }

  • Company Schema
{
    "type" : "object",
    "properties" : {
        "first_name" : {"type" : "string"},
        "last_name" : {"type" : "string"},
        "email" : {"type" : "string"},
        "password" : {"type" : "string"},
        "company_name" : {"type" : "string"},
        "description" : {"type" : "string"},
    },
    "required": [
        "first_name",
        "last_name",
        "email",
        "password",
        "company_name",
        "description"
    ]
}
  • Employee Schema
{
    "type" : "object",
    "properties" : {
        "first_name" : {"type" : "string"},
        "last_name" : {"type" : "string"},
        "email" : {"type" : "string"},
        "password" : {"type" : "string"}
    },
    "required": [
        "first_name",
        "last_name",
        "email",
        "password"
    ]
}
  • Day Schema
{
    "type": "object",
    "properties": {
        "hours": {"type": "number"},
        "description": {"type": "string"},
        "location": {"type": "string"},
    },
    "required": [
        "hours",
        "description",
        "location",
    ]
}
  • Calendar Schema
{
    "type" : "object",
    "properties": {
        "hours": {"type" : "number"},
        "description": {"type" : "string"},
        "location": {"type" : "string"},
    },
    "required": [
        "hours",
        "description",
        "location",
    ]
}
{
    "type" : "object",
    "properties" : {
        "sunday" : "reference the day schema",
        "monday" : "reference the day schema",
        "tuesday" : "reference the day schema",
        "wednesday" : "reference the day schema",
        "thursday" : "reference the day schema",
        "friday" : "reference the day schema",
        "saturday" : "reference the day schema",
    },
    "required": [
        "sunday",
        "monday",
        "tuesday",
        "wednesday",
        "thursday",
        "friday",
        "saturday",
    ]
}
  • Change Password Schema
{
    "type" : "object",
    "properties" : {
        "password" : {"type" : "string"}
    },
    "required": [
        "password"
    ]
}

⠀ ↺ EndPoints ↻

  • ⠀ / ⠀⠀ ⮂ ⠀ [ 'GET' ] ⠀ ⟼ ⠀ Home of ConTime API, endpoint for API documentation.

  • ⠀ /login ⠀

    • GET ⠀ ⮂ ⠀ login using query parameters email = < email > | password = < password >, type = ( < company > or < employee > ) if login successfully return the respective ID.
  • ⠀ /employee ⠀

    • GET ⠀ ⮂ ⠀ quickly lookup employee's id using query parameter email = < email >
  • ⠀ /companies ⠀

    • GET ⠀ ⮂ ⠀ list of all the companies.
    • POST ⠀ ⮂ ⠀ create a new company in accordance with the company's schema above.
  • ⠀ /companies/< id > ⠀

    • GET ⠀ ⮂ ⠀ get company by id.
    • PUT ⠀ ⮂ ⠀ change company's password
    • DELETE ⠀ ⮂ ⠀ delete company permanetly.
  • ⠀ /companies/< id >/employees ⠀

    • GET ⠀ ⮂ ⠀ returns all of company's employees.
    • PUT ⠀ ⮂ ⠀ request employee to work for company using the query parameter employee_id = < id >
    • DELETE ⠀ ⮂ ⠀ delete employee from company using the query parameter employee_id = < id >.
  • ⠀ /employees ⠀

    • GET ⠀ ⮂ ⠀ list of all the employees.
    • POST ⠀ ⮂ ⠀ create a new employee in accordance with the employee's schema above.
  • ⠀ /employees/< id > ⠀

    • GET ⠀ ⮂ ⠀ get employee by id.
    • PUT ⠀ ⮂ ⠀ change employee's password
    • DELETE ⠀ ⮂ ⠀ delete employee permanetly.
  • ⠀ /employees/< id >/companies ⠀

    • GET ⠀ ⮂ ⠀ returns a list all of the companies employee works for.
    • PUT ⠀ ⮂ ⠀ accept job offer to work for a company using the query parameter company_id = < id > and status = < accept > || < decline >
    • DELETE ⠀ ⮂ ⠀ leave a company using the query parameter company_id = < id >.
  • ⠀ /calendars ⠀

    • GET ⠀ ⮂ ⠀ list of all calendars
  • ⠀ /calendars/< id > ⠀

    • GET ⠀ ⮂ ⠀ get calendar by id.
  • ⠀ /calendars/employees/< employee_id > ⠀

    • GET ⠀ ⮂ ⠀ get all calendars for employee_id
  • ⠀ /calendars/companies/< company_id > ⠀

    • GET ⠀ ⮂ ⠀ get all calendars for company_id
  • ⠀ calendars/companies/< company_id >/employees/< employee_id > ⠀

    • GET ⠀ ⮂ ⠀ return all of employee's calendars for a specific company
  • ⠀ calendars/companies/< company_id >/employees/< employee_id >/current ⠀

    • PUT ⠀ ⮂ ⠀ create current weekly calendar, if current calendar already exists UPDATE in accordance with the calendar's schema above.




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