This is a backend API for a hospital application for booking appointments with doctors. See frontend project here. User can signup and login. Once logged in user is assigned a json web token for authentication/authorization. Only authorized users can see the doctors and book an appointment. Unit tests are written using RSpec and Shoulda matcher.
- Ruby v2.7.0
- Ruby on Rails v6.1.4.1
- Gems used for testing: Capybara, Rspec-Rails, and Shoulda-matchers.
See live demo here
There are three different models in the application:
-
User: The User model represents a user of the application.
-
Doctor: The Doctor model represents a doctor in the application.
-
Appointment: The Appointment model represents an appointment that belongs to the user and the doctor.
These are the methods available in each controller:
- Users:
- create: To sign up a user in the backend( POST /users)
- show: To show a user in the backend( GET /users/:id)
- user_params: To validate the parameters of the user in the backend( POST /users)
- encode_token: To encode the json web token( POST /users)
- secret_key: To encode the json web token( POST /users)
- Sessions:
- create: To sign in a user in the backend( POST /sessions)
- session_params: To validate the parameters of the session in the backend( POST /sessions)
- encode_token: To encode the json web token( POST /sessions)
- secret_key: To encode the json web token( POST /sessions)
- Doctors:
- index: To show all doctors in the backend( GET /doctors)
- show: To show a doctor in the backend( GET /doctors/:id)
- set_doctor: To set the doctor in the backend( GET /doctors/:id)
- Appointments:
- index: To show all appointments in the backend( GET /appointments)
- show: To show an appointment in the backend( GET /appointments/:id)
- create: To book an appointment in the backend( POST /appointments/new)
- appointment_params: To validate the parameters of the appointment in the backend( POST /appointments)
- set_appointment: To set the appointment in the backend( GET /appointments/:id)
- destroy: To cancel an appointment in the backend( DELETE /appointments/:id)
- update: To update an appointment in the backend( PATCH /appointments/:id)
To get a local copy up and running follow these steps:
- Ruby: 2.7.0
- Rails: 6.1.4.1
- Postgres: >=9.5
- Git
- Fork/Clone this project to your local machine
- Open folder in your local enviroment and run thes lines of code to get started:
Install gems with:
bundle install
Setup database with:
rails db:create
rails db:migrate
rails db:seed
Start server with:
rails s -p 3001
Then open a web page and go to port 3001 on your local machine.
Public API url is here You can test all the API endpoints in any API testing tools like Postman.
bundle exec rpsec
Follow vendor specific instructions to deploy the application.
- Add table for departments
- Success email after creating appointment
- Online payment
👤 Hillary Okello
- Github: HillaryOkello
- Twitter: @Kellyhillary4
- LinkedIn: HillaryOkello
- Email: hillariouskelly@gmail.com
Contributions and feature requests are welcome!
Start by:
- Forking the project
- Cloning the project to your local machine
cd
into the project directory- Run
git checkout -b your-branch-name
- Make your contributions
- Push your branch up to your forked repository
- Open a Pull Request with a detailed description to the development(or master if not available) branch of the original project for a review
Give a ⭐️ if you like this project!
This project is MIT licensed.