Code Monkey home page Code Monkey logo

carmanagement's Introduction

Car Rental Management System

This repository contains the code for a Car Rental Management System, providing functionalities to manage customers, vehicles, and booking reservations. It's built as a RESTful API.

Project Overview

The system includes endpoints to manage customers, vehicles, and bookings. It offers functionalities accessible via HTTP requests.

Database Diagram

Database Diagram

Getting Started

Follow these steps to set up and run the project:

  1. Clone this repository.
  2. Install the required dependencies using pip install -r requirements.txt.
  3. Set up the database and configure environment variables in .env.
  4. Run the application with python -m flask run.

Endpoints

Authentication

  • Signup: Create a new user account.

    curl -X POST -H "Content-Type: application/json" -d '{
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "1234567890",
        "password": "securepassword"
    }' http://your_domain/signup
  • Login: Authenticate and obtain an access token.

    curl -X POST -H "Content-Type: application/json" -d '{
        "email": "[email protected]",
        "password": "securepassword"
    }' http://your_domain/login

Admin Routes

Customers

  • Create Customer: Create a new customer (Admin access required).

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <access_token>" -d '{
        "name": "Alice",
        "email": "[email protected]",
        "phone": "9876543210",
        "password": "strongpassword"
    }' http://your_domain/admin/customers
  • Get Customer by ID: Retrieve a customer by ID (Admin access required).

    curl -X GET -H "Authorization: Bearer <access_token>" http://your_domain/admin/customers/<customer_id>
  • Update Customer by ID: Update a customer by ID (Admin access required).

    curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer <access_token>" -d '{
        "name": "Alice",
        "email": "[email protected]",
        "phone": "9876543210",
        "password": "updatedpassword"
    }' http://your_domain/admin/customers/<customer_id>
  • Delete Customer by ID: Delete a customer by ID (Admin access required).

    curl -X DELETE -H "Authorization: Bearer <access_token>" http://your_domain/admin/customers/<customer_id>

Vehicles

  • Create Vehicle: Create a new vehicle (Admin access required).

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <access_token>" -d '{
        "type": "small_cars",
        "available": true
    }' http://your_domain/admin/vehicles
  • Get Vehicle by ID: Retrieve a vehicle by ID (Admin access required).

    curl -X GET -H "Authorization: Bearer <access_token>" http://your_domain/admin/vehicles/<vehicle_id>
  • Update Vehicle by ID: Update a vehicle by ID (Admin access required). Restrict the type field to predefined types: 'small_cars', 'family_cars', 'vans'.

    curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer <access_token>" -d '{
        "type": "small_cars",
        "available": false
    }' http://your_domain/admin/vehicles/<vehicle_id>
  • Delete Vehicle by ID: Delete a vehicle by ID (Admin access required).

    curl -X DELETE -H "Authorization: Bearer <access_token>" http://your_domain/admin/vehicles/<vehicle_id>

Booking Routes

  • Make Booking: Make a vehicle booking (Authenticated customer access required).
    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <access_token>" -d '{
        "vehicle_id": <vehicle_id>,
        "date_hired": "YYYY-MM-DD",
        "date_returned": "YYYY-MM-DD"
    }' http://your_domain/make_booking

Usage Instructions

  • Ensure correct payload format for requests.
  • Authenticate using obtained access tokens.

carmanagement's People

Contributors

amremaish 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.