Backend assessment assignment implemented using Rust + Rocket.rs + SQLite. Uses JWT tokens for authorization.
- Request Body => JSON
{ "name" : String "email" : String "password" : String "account_type" : "Doctor" | "Patient" | "Admin" }
- Request Body => JSON
{ "email": String, "password": String }
- Response Body => JWT Token
- Response Body => JSON
[DoctorID]
- Path Params
doctor_id: Integer
- 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 }
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
Cancels the appointment. Must be Doctor or Admin
- Path Params
appointment_id: Integer
- Request Header
Authorization: Bearer <JWT Token>
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]
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, }
- 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, } ]
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, }
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, }