Giter Site home page Giter Site logo

techunicorn-backend-assessment's Introduction

Backend Assessment

Backend assessment assignment implemented using Rust + Rocket.rs + SQLite. Uses JWT tokens for authorization.

API

/register

  • Request Body => JSON
    {
        "name" : String
        "email" : String
        "password" : String
        "account_type" : "Doctor" | "Patient" | "Admin"
    }
    

/login

  • Request Body => JSON
    {
        "email": String,
        "password": String
    }
    
  • Response Body => JWT Token

/doctors

  • Response Body => JSON
    [DoctorID]
    

/doctors/<doctor_id>

  • Path Params
    doctor_id: Integer
    

/doctors/<doctor_id>/slots

  • Path Params
    doctor_id: Integer
    
  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Request Body => JSON
    {
        "date": ISO-8601 String
    }
    
  • Response Body => JSON
    {
        "patient_id": Option<Integer>, //Admins and Doctors only
        "start_date": ISO-8601 String,
        "duration": Integer
    }
    

/doctors/<doctor_id>/book

Books an appointment with a doctor. Must be a Patient.

  • Path Params
    doctor_id: Integer
    
  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Request Body => JSON
    {
        "start_date": ISO-8601 String
        "duration": Integer
    }
    
  • Response Body => Appointment ID Integer

/appointments/<appointment_id>/cancel

Cancels the appointment. Must be Doctor or Admin

  • Path Params
    appointment_id: Integer
    
  • Request Header
    Authorization: Bearer <JWT Token>
    

/doctors/available

Shows available doctors for a given date. Must be an Admin.

  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Request Body => JSON
    {
        "date": ISO-8601 String
    }
    
  • Response Body => JSON
    [DoctorID]
    

/appointments/<appointment_id>

Shows appointment detials if authorized.

  • Path Params
    appointment_id: Integer
    
  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Response Body => JSON
      {
          "id": Integer,
          "doctor_id": Integer,
          "patient_id": Integer,
          "start_date": DateTime<FixedOffset>,
          "duration": Integer,
          "status": AppointmentStatus,
      }
    

/patients/<patient_id>/history

  • Path Params
    patient_id: Integer
    
  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Response Body => JSON
    [
      {
          "id": Integer,
          "doctor_id": Integer,
          "patient_id": Integer,
          "start_date": DateTime<FixedOffset>,
          "duration": Integer,
          "status": AppointmentStatus,
      }
    ]
    

/doctors/by_top_appointments

Lists doctors with the most appointments in a given day. Admin Only.

  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Request Body => JSON
    {
        "date": ISO-8601 String
    }
    
  • Response Body => JSON
    {
      "doctor_id": Integer,
      "appointments_count": Integer,
      "booked_mins": Integer,
    }
    

/doctors/with_six_hours_plus

Lists doctors with the 6+ hours of appointments in a given day. Admin Only.

  • Request Header
    Authorization: Bearer <JWT Token>
    
  • Request Body => JSON
    {
        "date": ISO-8601 String
    }
    
  • Response Body => JSON
    {
      "doctor_id": Integer,
      "appointments_count": Integer,
      "booked_mins": Integer,
    }
    

techunicorn-backend-assessment's People

Contributors

omaraaa avatar

Watchers

 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.