API: Get Coach Configurations by Schedule

Request

Retrieve all coach configurations for a specific schedule:

GET /coach-configurations/schedule/{scheduleId}

Sample Request:

GET /coach-configurations/schedule/2

Sample Response:


{
  "success": true,
  "message": "Coach configurations retrieved successfully",
  "data": [
    {
      "id": 1,
      "coach_id": 1,
      "schedule_id": 2,
      "bus_id": 3,
      "seat_plan_id": 4,
      "route_id": 5,
      "coach_type": 1,
      "status": 1,
      "created_by": 1,
      "updated_by": null,
      "created_at": "2025-08-10T10:00:00.000000Z",
      "updated_at": "2025-08-10T10:00:00.000000Z",
      "coach": {
        "id": 1,
        "name": "Express Coach 001",
        "code": "EC001"
      },
      "bus": {
        "id": 3,
        "registration_number": "DH-123456",
        "model": "Volvo B11R"
      },
      "seat_plan": {
        "id": 4,
        "name": "2x2 Layout",
        "total_seats": 40
      },
      "route": {
        "id": 5,
        "name": "Dhaka - Chittagong",
        "distance": "264 km"
      },
      "boarding_droppings": [
        {
          "id": 1,
          "coach_configuration_id": 1,
          "counter_id": 1,
          "type": 1,
          "time": "08:00:00",
          "starting_point_status": 1,
          "ending_point_status": 0,
          "status": 1,
          "counter": {
            "id": 1,
            "name": "Kallyanpur Counter",
            "location": "Kallyanpur, Dhaka"
          }
        }
      ]
    }
  ]
}
                

Use Cases:

  • Schedule Management - View all coaches assigned to a specific schedule
  • Fleet Planning - Understand resource allocation for a particular time slot
  • Route Optimization - Analyze coach deployment across different routes within a schedule
  • Capacity Planning - Calculate total available seats for a schedule

Response Details:

  • Multiple Configurations - Returns an array of all coach configurations for the schedule
  • Related Data - Includes coach, bus, seat_plan, route, and boarding_droppings
  • Schedule Information - The schedule details are not included since it's implicit from the request
  • Boarding Points - Shows all pickup and drop-off points for each configuration

Notes:

  • The schedule ID is required in the URL path.
  • If the schedule does not exist, the API will return an empty array.
  • Only active coach configurations are typically returned (status = 1).
  • Results are ordered by coach configuration creation time.