This is a RESTful API for managing a doctor's office, developed using Laravel. The API provides endpoints for managing authentication, doctors, patients, appointments, prescriptions, medical histories, and medications.
This project requires the following to run:
- PHP 8.2+
- Laravel v11.0+
-
Clone the repository:
git clone https://github.com/KassemHachi/interview-test-medical-api/.git cd interview-test-medical-api
-
Install the dependencies:
composer install
-
Set up the environment variables:
cp .env.example .env php artisan key:generate
-
Configure your database in the
.env
file: -
Set up the environment variables:
php artisan migrate --seed
-
Start the development server
php artisan serve
Ensure you configure the following environment variables in your .env
file:
DB_CONNECTION
DB_HOST
DB_PORT
DB_DATABASE
DB_USERNAME
DB_PASSWORD
-
Register a new user
- Endpoint:
POST /auth/register
- Request Body:
{ "name": "User Name", "email": "[email protected]", "password": "password", "password_confirmation": "password", "type": "patient", "phone": "0123456789" }
- Endpoint:
-
Login
- Endpoint:
POST /auth/login
- Request Body:
{ "email": "[email protected]", "password": "password" }
- Endpoint:
-
Logout
- Endpoint:
POST /auth/logout
- Authentication: Bearer token
- Endpoint:
-
Forgot Password
- Endpoint:
POST /auth/forgot-password
- Endpoint:
-
Reset Password
- Endpoint:
PATCH /auth/reset-password
- Endpoint:
-
Verify Email
- Endpoint:
POST /auth/verify-email
- Endpoint:
-
Send Verification Email
- Endpoint:
POST /auth/send-verification-email
- Authentication: Bearer token
- Endpoint:
-
Get One Doctor
- Endpoint:
GET /doctors/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Doctors - Endpoint:
GET /doctors/
- Authentication: Bearer token
-
Get One Patient
- Endpoint:
GET /patients/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Patients
- Endpoint:
GET /patients/
- Authentication: Bearer token
- Endpoint:
-
Create Appointment
- Endpoint:
POST /appointments
- Request Body:
{ "patient_id": 1, "date": "2024-07-03", "time": "07:25:00", "reason": "test reason" }
- Authentication: Bearer token
- Endpoint:
-
Update Appointment
- Endpoint:
PATCH /appointments/{id}
- Request Body:
{ "patient_id": 1, "date": "2024-07-03", "time": "07:25:00", "reason": "test reason" }
- Authentication: Bearer token
- Endpoint:
-
Get One Appointment
- Endpoint:
GET /appointments/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Appointments
- Endpoint:
GET /appointments/
- Authentication: Bearer token
- Endpoint:
-
Delete Appointment
- Endpoint:
DELETE /appointments/{id}
- Authentication: Bearer token
- Endpoint:
-
Create Prescription
- Endpoint:
POST /prescriptions
- Request Body:
{ "patient_id": 1, "prescription_medications": [ { "medication_id": 1, "dosage": "3", "frequency": "5", "start_date": "2024-07-04", "end_date": "2024-07-04" } ] }
- Authentication: Bearer token
- Endpoint:
-
Update Prescription
- Endpoint:
PATCH /prescriptions/{id}
- Request Body:
{ "patient_id": 1, "prescription_medications": [ { "medication_id": 1, "dosage": "3", "frequency": "5", "start_date": "2024-07-04", "end_date": "2024-07-04" } ] }
- Authentication: Bearer token
- Endpoint:
-
Get One Prescription
- Endpoint:
GET /prescriptions/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Prescriptions
- Endpoint:
GET /prescriptions/
- Authentication: Bearer token
- Endpoint:
-
Delete Prescription
- Endpoint:
DELETE /prescriptions/{id}
- Authentication: Bearer token
- Endpoint:
-
Create Medical History
- Endpoint:
POST /medical-histories
- Request Body:
{ "patient_id": 1, "diagnosis": "Diagnosis example", "treatment": "Treatment example", "notes": "Notes example" }
- Authentication: Bearer token
- Endpoint:
-
Update Medical History
- Endpoint:
PATCH /medical-histories/{id}
- Request Body:
{ "patient_id": 1, "diagnosis": "Diagnosis example", "treatment": "Treatment example", "notes": "Notes example" }
- Authentication: Bearer token
- Endpoint:
-
Get One Medical History
- Endpoint:
GET /medical-histories/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Medical Histories
- Endpoint:
GET /medical-histories/
- Authentication: Bearer token
- Endpoint:
-
Delete Medical History
- Endpoint:
DELETE /medical-histories/{id}
- Authentication: Bearer token
- Endpoint:
-
Create Medication
- Endpoint:
POST /medications
- Request Body:
{ "name": "Medication name", "description": "Medication description" }
- Authentication: Bearer token
- Endpoint:
-
Update Medication
- Endpoint:
PATCH /medications/{id}
- Request Body:
{ "name": "Medication name", "description": "Medication description" }
- Authentication: Bearer token
- Endpoint:
-
Get One Medication
- Endpoint:
GET /medications/{id}
- Authentication: Bearer token
- Endpoint:
-
Get All Medication
- Endpoint:
GET /medications/
- Authentication: Bearer token
- Endpoint:
-
Delete Medication
- Endpoint:
DELETE /medications/{id}
- Authentication: Bearer token
- Endpoint:
-
Get Profile
- Endpoint:
GET /profile
- Authentication: Bearer token
- Endpoint:
-
Update Profile
- Endpoint:
PATCH /profile
- Request Body:
{ "name": "Updated name", "email": "[email protected]", "phone": "Updated phone number" }
- Authentication: Bearer token
- Endpoint:
-
Delete Profile
- Endpoint:
DELETE /profile
- Authentication: Bearer token
- Endpoint:
-
Change Password
- Endpoint:
PATCH /profile/change-password
- Request Body:
{ "current_password": "currentpassword", "new_password": "newpassword", "new_password_confirmation": "newpassword" }
- Authentication: Bearer token
- Endpoint: