From 9bbd821e2c0b4ffd8e49bb382536a131c57899d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Sat, 17 Oct 2026 18:29:59 +0200 Subject: [PATCH 1/2] :sparkles: add operator to departures fixes #5137 --- API_CHANGELOG.md | 2 ++ app/Http/Resources/DepartureResource.php | 4 +++- resources/types/Api.gen.ts | 1 + storage/api-docs/api-docs.json | 17 ++++++++++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/API_CHANGELOG.md b/API_CHANGELOG.md index 99d922b9a..4035dadd7 100644 --- a/API_CHANGELOG.md +++ b/API_CHANGELOG.md @@ -25,6 +25,8 @@ Check back here regularly to stay ahead of removals. # 2026-10-17 +New field `operator` in `DepartureResource` (`GET /station/{id}/departures`): the operator of the trip, `null` if unknown. + Removed the following deprecated fields, announced in 2026-03 and 2026-04: - `EventDetailsResource.trainDistance`: use `totalDistance` instead diff --git a/app/Http/Resources/DepartureResource.php b/app/Http/Resources/DepartureResource.php index 0c7eeefff..fbbfe5c75 100644 --- a/app/Http/Resources/DepartureResource.php +++ b/app/Http/Resources/DepartureResource.php @@ -11,7 +11,7 @@ #[OA\Schema( title: 'Departure', description: 'A single departure at a station', - required: ['tripId', 'when', 'plannedWhen', 'platform', 'plannedPlatform', 'direction', 'line', 'cancelled', 'station'], + required: ['tripId', 'when', 'plannedWhen', 'platform', 'plannedPlatform', 'direction', 'line', 'cancelled', 'station', 'operator'], properties: [ new OA\Property(property: 'tripId', description: 'Unique trip identifier', type: 'string', example: '1|200513|0|81|6012023'), new OA\Property(property: 'when', description: 'Actual departure time (null if no realtime data)', type: 'string', format: 'date-time', example: '2023-01-06T13:49:00+01:00', nullable: true), @@ -35,6 +35,7 @@ ), new OA\Property(property: 'cancelled', description: 'Whether this departure is cancelled', type: 'boolean', example: false), new OA\Property(property: 'station', ref: '#/components/schemas/StationResource'), + new OA\Property(property: 'operator', ref: OperatorResource::class, nullable: true), ], )] class DepartureResource extends JsonResource @@ -63,6 +64,7 @@ public function toArray($request): array ], 'cancelled' => $this->resource->cancelled, 'station' => new StationResource($this->resource->station), + 'operator' => $this->resource->trip->operator ? new OperatorResource($this->resource->trip->operator) : null, ]; } } diff --git a/resources/types/Api.gen.ts b/resources/types/Api.gen.ts index d88b68a6d..1d877a317 100644 --- a/resources/types/Api.gen.ts +++ b/resources/types/Api.gen.ts @@ -1368,6 +1368,7 @@ export interface DepartureResource { */ cancelled: boolean; station: StationResource; + operator: OperatorResource | null; } /** diff --git a/storage/api-docs/api-docs.json b/storage/api-docs/api-docs.json index cc0417ee9..bb8669662 100644 --- a/storage/api-docs/api-docs.json +++ b/storage/api-docs/api-docs.json @@ -13715,7 +13715,8 @@ "direction", "line", "cancelled", - "station" + "station", + "operator" ], "properties": { "tripId": { @@ -13806,6 +13807,20 @@ }, "station": { "$ref": "#/components/schemas/StationResource" + }, + "operator": { + "oneOf": [ + { + "$ref": "#/components/schemas/OperatorResource" + }, + { + "type": "object", + "nullable": true, + "enum": [ + null + ] + } + ] } }, "type": "object" From c63556e2707e84a1480b7343b30b2820591af6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Sat, 17 Oct 2026 18:32:58 +0200 Subject: [PATCH 2/2] show operator --- resources/tailwind-app/pages/Checkin/LineRunPage.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/tailwind-app/pages/Checkin/LineRunPage.vue b/resources/tailwind-app/pages/Checkin/LineRunPage.vue index 208e94c81..1912cd87c 100644 --- a/resources/tailwind-app/pages/Checkin/LineRunPage.vue +++ b/resources/tailwind-app/pages/Checkin/LineRunPage.vue @@ -36,6 +36,7 @@ const displayLineName = computed(() => (lineName.value ?? '').replaceAll(/\(.*?\ const tripCategory = ref(initialCategory.value); const tripUuid = ref(null); +const operatorName = ref(null); function handleBack(): void { router.back(); @@ -44,6 +45,7 @@ function handleBack(): void { function onTrip(trip: TripResource): void { tripCategory.value = trip.category ?? initialCategory.value; tripUuid.value = trip.uuid ?? tripUuid.value; + operatorName.value = trip.operator?.name ?? null; } function selectStart(stopover: StopoverResource): void { @@ -112,7 +114,12 @@ function selectDestination(stopover: StopoverResource): void { :background-color="color" :color="textColor" /> - {{ direction }} +
+ {{ direction }} + + {{ operatorName }} + +