masaruk Logo

analysis/04-functional-spec/buses-module.md

Buses List

Buses Module – Functional Specification

1. Purpose

The Buses Module manages all bus-related operations for tourism providers. A Bus is a core logistical resource used in trips for transportation between cities or within itinerary days.

This module covers:

  • Creating and maintaining bus records
  • Assigning drivers
  • Defining facilities (WiFi, Charger, etc.)
  • Managing operational status (Active, Inactive, Maintenance)
  • Integrating buses into trip creation and itineraries

2. Involved Entities

EntityDescription
BusA transportation vehicle owned/managed by a provider.
DriverDriver information stored inside the bus record.
TripTrips reference a bus via transportation metadata.
ProviderOwner of the bus.

Note: No standalone "Driver" entity exists in the UI; driver data is embedded inside Bus.

4. Bus Entity Fields

FieldTypeNotes
idPK
provider_idFKBus owner
plate_numberStringPlate Number
modelStringBus Model (Manufacturer + Year)
seats_capacityIntegerSeats Capacity
statusEnumactive / inactive / maintenance
driver_nameStringDriver Name
driver_phoneStringDriver Phone Number
driver_photo_urlStringDriver Photo
bus_photo_urlStringBus Photo
created_attimestamp
updated_attimestamp

5. Facilities & Amenities

WiFi
Electric Charger
Display Screen
Bathroom
Air Conditioning
Refrigerator
Microphone
First Aid Kit

Missing facility simply means "false" in the database.

6. Statuses

نشطةغير نشطةتحت الصيانة
UI LabelEnumMeaning
Active (نشطة)ACTIVEBus available for assignment
Inactive (غير نشطة)INACTIVEHidden / not assignable
Under Maintenance (تحت الصيانة)MAINTENANCETemporarily unavailable

7. Business Rules

BR-1. Bus must belong to a provider

Every bus is tied to a single provider (no shared buses across providers).

BR-2. Only active buses can be assigned to trips

If status != ACTIVE, bus cannot appear in trip creation list.

BR-3. Driver fields are mandatory

Because UI requires: Driver Name, Phone Number, Driver Photo

BR-4. Facilities checkboxes represent true/false values

Each facility is stored as a boolean field.

BR-5. Cannot delete a bus linked to future trips

Trips referencing the bus prevent deletion.

Error: Cannot delete this bus as it is linked to active trips

BR-6. Bus status MAINTENANCE blocks booking

Trips using a bus under maintenance are marked with warnings.

BR-7. Image requirements

Bus image and driver image must support PNG, JPG, GIF up to 10MB.

8. State Transitions

INACTIVE → ACTIVE       (Provider activates bus)
ACTIVE → INACTIVE       (Provider deactivates bus)
ACTIVE → MAINTENANCE    (Provider sets bus for maintenance)
MAINTENANCE → ACTIVE    (Maintenance completed)