/parking-lot-management

Parking Lot Management System. It's a web application that allows users to manage a parking lot

Primary LanguageJava

Parking Lot Management System

=============================

A simple web application for managing a parking lot.

Getting Started


Clone the Repository

git clone https://github.com/fahmimmaliki/parking-lot-management.git

Install Dependencies

mvn install

Run the Application using Docker Compose

docker compose up

This will start the application and make it available at http://localhost:8080/api/parking.

Access the Application

http://localhost:8080/api/parking

Endpoints


Get Available Places

GET /api/parking/places

JSON Body Example:

{}

Response:

{
  "availablePlaces": 10
}

Park a Car

POST /api/parking/park

JSON Body Example:

{
  "licensee": "ABC123"
}

Response:

{
  "message": "Car parked successfully"
}

Leave a Car

POST /api/parking/leave/{id}

JSON Body Example:

{}

Response:

{
  "message": "Car has left. Bill: 5000"
}

Get All Cars

GET /api/parking/cars

JSON Body Example:

{}

Response:

[
  {
    "id": 1,
    "licensee": "ABC123",
    "arrival": "2023-02-20T14:30:00",
    "leave": "2023-02-20T15:30:00",
    "parked": true,
    "bill": 5000
  },
  {
    "id": 2,
    "licensee": "DEF456",
    "arrival": "2023-02-20T15:30:00",
    "leave": "2023-02-20T16:30:00",
    "parked": true,
    "bill": 5000
  }
]

Update Settings

PATCH /api/parking/settings

JSON Body Example:

{
  "totalPlaces": 15,
  "payPerHour": 4000,
  "payFirstHour": 6000
}

Response:

{
  "message": "Settings updated successfully"
}

Get History

GET /api/parking/history

JSON Body Example:

{}

Response:

[
  {
    "licensee": "ABC123",
    "arrival": "2023-02-20T14:30:00",
    "leave": "2023-02-20T15:30:00",
    "bill": 5000
  },
  {
    "licensee": "DEF456",
    "arrival": "2023-02-20T15:30:00",
    "leave": "2023-02-20T16:30:00",
    "bill": 5000
  }
]

I hope this helps! Let me know if you have any questions or need further assistance.