Skip to content

rajal-kumar/booking_management_api

Repository files navigation

Booking Management API

A Rails 7 API backend for a vehicle fleet service booking system. Built for a tech assessment demo with Devise JWT authentication and endpoints for driver bookings, car/service management, and admin review. Includes pagination, serializers, seed data, and full RSpec test coverage.

🚀 Live Demo

🔧 Tech Stack

  • Ruby on Rails 7 (API-only mode)
  • PostgreSQL
  • Devise + JWT (devise-jwt)
  • JSON:API-compliant (jsonapi-serializer)
  • Kaminari (pagination)
  • ActionMailer (confirmation emails)
  • CORS-enabled (frontend-ready)
  • RSpec (tests)

📦 Features

  • Driver booking API with:
    • Car selection
    • Service/department selection
    • Date and status
  • Admin-ready endpoints for viewing/updating bookings
  • Confirmation email sent on booking submission
  • JSON:API response formatting
  • Pagination for all index endpoints
  • CORS enabled for frontend integration
  • Seed file with example cars and services
  • Full test coverage for models, controllers, mailer, and pagination

🔗 API Endpoints

  • GET /api/v1/cars
  • GET /api/v1/services
  • GET /api/v1/bookings
  • POST /api/v1/bookings

🚀 Getting Started

Clone & Setup

git clone https://github.com/yourusername/booking_management_api.git
cd booking_management_api
bundle install
rails db:create db:migrate db:seed
rails s

Run Tests

bundle exec rspec

🔐 Authentication

Authentication is scaffolded but not fully configured. Bookings table integration depends on final auth wiring.


🌱 Seed Data

Seeds are available in db/seeds.rb. It creates:

  • 2 Cars (e.g., Toyota Corolla, Ford Ranger)
  • 3 Services (e.g., Maintenance, WOF, Detailing)

📬 Mailer

BookingMailer sends a confirmation email to the user when a booking is created.


🔁 Pagination

All index endpoints (e.g., /cars, /services, /bookings) support pagination via query params:

GET /cars?page=1&per_page=10

The response includes standard JSON:API meta and links pagination data.


🧪 Test Coverage

RSpec specs include

  • Models
  • Mailer (BookingMailer)
  • Request specs (Cars, Bookings, Services)
  • Pagination specs
  • Auth helpers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published