This is a Spring Boot application to manage load and booking operations efficiently.
It provides RESTful APIs for creating, reading, updating, and deleting (CRUD), as well as accepting and rejecting bookings.
It also manages load details such as source, destination, quantity, and truck type to facilitate smooth logistics operations.
Booking operations are dependent on existing loads, meaning a booking can only be created for a valid load.
- Java 17
- Spring Boot 3.4.4
- PostgreSQL
- Maven
- Lombok
- ModelMapper
-
Clone the repository
git clone https://github.com/Purshottam06/LoadAndBooking-Backend.git cd LoadAndBookingOperations -
Configure PostgreSQL Database
Update yourapplication.propertieswith your database config:spring.datasource.url=jdbc:postgresql://localhost:5432/your_db spring.datasource.username=your_user spring.datasource.password=your_password
-
Build the project
mvn clean install
-
Run the application
mvn spring-boot:run
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/load |
Create a new load |
| GET | /api/load |
Fetch all loads (filter by shipperId, truckType) |
| GET | /api/load/{loadId} |
Get load details |
| PUT | /api/load/{loadId} |
Update load details |
| DELETE | /api/load/{loadId} |
Delete a load |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/booking |
Create a new booking |
| GET | /api/booking |
Fetch bookings (filter by shipperId, transporterId) |
| GET | /api/booking/{bookingId} |
Get booking details |
| PUT | /api/booking/{bookingId} |
Update booking details |
| DELETE | /api/booking/{bookingId} |
Delete a booking |
| PATCH | /api/booking/accept/{bookingId} |
Accept a booking |
| PATCH | /api/booking/reject/{bookingId} |
Reject a booking |
- Load
statusshould default toPOSTEDwhen created. - When a booking is made (
POST /booking), its status should be set toBOOKED. - If a booking is deleted, the associated load’s status should become
CANCELLED. - A booking should not be created if the load is already
CANCELLED. - When a booking is accepted, its status becomes
ACCEPTED.
-
Accept or Reject Bookings:
Use/accept/{bookingId}to accept a booking, and
/reject/{bookingId}to reject a booking. -
Filtering Loads or Bookings:
Use query parameters such asshipperId,truckTypefor loads, and
shipperId,transporterIdfor bookings when using GET requests. -
Booking Depends on Load:
A booking must be linked to an existing load. -
UUID Format:
All IDs (loadId,bookingId) are UUIDs.