Entity Relationship Diagram
erDiagram
%% Core entities
User {
int userId PK
string username
string email
string phoneNumber
string password
enum role
Image profilePicture
}
Vehicle {
int vehicleId PK
string brand
enum type
string model
enum fuelType
}
VehicleListing {
int listingId PK
string vehicleNo
double pricePerDay
enum seating
}
%% Booking related entities
Booking {
int bookingId PK
enum status
double totalPayableAmount
enum rentingType
duration Duration
}
PickUp {
int pickupId PK
date date
time time
}
Drop {
int dropId PK
date date
time time
enum status
}
%% Supporting entities
Location {
int locationId PK
string addressLine
string addressLineOptional
string area
string city
string state
string country
int pincode
string phoneNumber
}
Inspection {
int inspectionId PK
List_of_Image images
string comments
}
Image {
int imageId PK
string contentType
blob imageBytes
}
Review {
int reviewId PK
float rating
string review
}
%% Core relationships
User ||--o{ VehicleListing : "manages as rentingPartner"
VehicleListing ||--o{ Review : "receives"
User ||--o{ Review : "writes"
Vehicle ||--o{ VehicleListing : "has"
%% Booking relationships
User ||--o{ Booking : "makes"
Booking ||--|| PickUp : "has"
Booking ||--|| Drop : "has"
%% Location relationships
PickUp ||--|| Location : "at"
Drop ||--|| Location : "at"
%% Inspection relationships
PickUp ||--|| Inspection : "has"
Drop ||--|| Inspection : "has"
%% Image relationships
Vehicle ||--o{ Image : "has"
Inspection ||--o{ Image : "contains"
Legend
User Entity
| Field |
Type |
Description |
| userId |
Int |
Primary Key |
| username |
String |
User's display name |
| email |
String |
User's email address |
| phoneNumber |
String |
Contact number |
| password |
String |
Hashed password |
| role |
UserRole (Enum) |
CUSTOMER, RENTING_PARTNER |
| profilePicture |
Image |
Profile image |
Vehicle Entity
| Field |
Type |
Description |
| vehicleId |
Int |
Primary Key |
| brand |
String |
Vehicle brand name |
| type |
VehicleType (Enum) |
Type of vehicle |
| model |
String |
Vehicle model name |
| images |
List<Image> |
Foreign Key to Image list |
| fuelType |
FuelType (Enum) |
Type of fuel used |
VehicleListing Entity
| Field |
Type |
Description |
| listingId |
Int |
Primary Key |
| vehicleNo |
String |
Vehicle registration number |
| pricePerDay |
Double |
Daily rental price |
| seating |
SeatingType (Enum) |
Seating configuration |
| rentingPartner |
User |
Foreign Key to User |
| vehicle |
Vehicle |
Foreign Key to Vehicle |
Booking Entity
| Field |
Type |
Description |
| bookingId |
Int |
Primary Key |
| status |
BookingStatus (Enum) |
Current booking status |
| totalPayableAmount |
Double |
Total rental amount |
| rentingType |
RentingType (Enum) |
Type of rental |
| duration |
Duration |
Rental duration |
| vehicle |
Vehicle |
Foreign Key to Vehicle |
| user |
User |
Foreign Key to User |
| pickupInfo |
PickUp |
Foreign Key to PickUp |
| dropInfo |
Drop |
Foreign Key to Drop |
Location Entity
| Field |
Type |
Description |
| locationId |
Int |
Primary Key |
| addressLine |
String |
Primary address line |
| addressLineOptional |
String |
Secondary address line |
| area |
String |
Area/locality |
| city |
String |
City name |
| state |
String |
State name |
| country |
String |
Country name |
| pincode |
Int |
Postal code |
| phoneNumber |
String |
Contact number |
Inspection Entity
| Field |
Type |
Description |
| inspectionId |
Int |
Primary Key |
| images |
List<Image> |
Foreign Key to Image list |
| comments |
String |
Inspection notes |
Drop Entity
| Field |
Type |
Description |
| dropId |
Int |
Primary Key |
| date |
LocalDate |
Drop-off date |
| time |
LocalTime |
Drop-off time |
| location |
Location |
Foreign Key to Location |
| inspection |
Inspection |
Foreign Key to Inspection |
| status |
DropStatus (Enum) |
PENDING, DROPPED, DELAYED_DROP |
PickUp Entity
| Field |
Type |
Description |
| pickupId |
Int |
Primary Key |
| date |
LocalDate |
Pickup date |
| time |
LocalTime |
Pickup time |
| location |
Location |
Foreign Key to Location |
| inspection |
Inspection |
Foreign Key to Inspection |