@@ -24,7 +24,7 @@ use crate::environment::AppState;
2424use crate :: graphql:: TripQueryParams ;
2525use crate :: models:: {
2626 BusScheduleDetail , BusScheduleDetails , GTFSStop , MemoryUsageStats , MinimalEmployee ,
27- NandiRoutesRes , RouteStopMapping , StopClusterResponse , StopCodeFromProviderStopCodeResponse ,
27+ NandiRoutesRes , RouteStopMapping , StopCodeFromProviderStopCodeResponse , StopDetailResponse ,
2828 TripDetails , VehicleData , VehicleMetadataResponse , VehicleOperationData ,
2929 VehicleServiceTypeResponse ,
3030} ;
@@ -206,10 +206,6 @@ pub fn create_routes(cfg: &mut actix_web::web::ServiceConfig) {
206206 "/cluster/{gtfs_id}/routes/{src_stop_code}/{dst_stop_code}" ,
207207 actix_web:: web:: get ( ) . to ( get_routes_between_clusters_for_stops) ,
208208 )
209- . route (
210- "/stop/{gtfs_id}/{stop_code}/cluster" ,
211- actix_web:: web:: get ( ) . to ( get_stop_cluster) ,
212- )
213209 . route ( "/ready" , actix_web:: web:: get ( ) . to ( readiness_probe) )
214210 . route ( "/version/{gtfs_id}" , actix_web:: web:: get ( ) . to ( get_version) )
215211 . route (
@@ -1155,30 +1151,6 @@ pub async fn get_routes_between_clusters_for_stops(
11551151 Ok ( HttpResponse :: Ok ( ) . json ( routes) )
11561152}
11571153
1158- #[ utoipa:: path(
1159- get,
1160- path = "/stop/{gtfs_id}/{stop_code}/cluster" ,
1161- tag = "Cluster" ,
1162- params(
1163- ( "gtfs_id" = String , Path , description = "GTFS feed identifier" ) ,
1164- ( "stop_code" = String , Path , description = "Stop code" ) ,
1165- ) ,
1166- responses(
1167- ( status = 200 , description = "Cluster id for the stop; cluster_id is null when the stop has no H3 cluster assigned." , body = StopClusterResponse ) ,
1168- ( status = 404 , description = "Unknown gtfs_id or stop_code" )
1169- )
1170- ) ]
1171- pub async fn get_stop_cluster (
1172- app_state : Data < AppState > ,
1173- path : Path < ( String , String ) > ,
1174- ) -> AppResult < HttpResponse > {
1175- let ( gtfs_id, stop_code) = path. into_inner ( ) ;
1176- let cluster_id = app_state
1177- . gtfs_service
1178- . get_stop_cluster_for_stop ( & gtfs_id, & stop_code) ?;
1179- Ok ( HttpResponse :: Ok ( ) . json ( StopClusterResponse { cluster_id } ) )
1180- }
1181-
11821154#[ utoipa:: path(
11831155 get,
11841156 path = "/routes/{gtfs_id}/fuzzy/{query}" ,
@@ -1293,7 +1265,7 @@ pub fn merge_stop_and_mapping(
12931265 ( "gtfs_id" = String , Path , description = "GTFS feed identifier" ) ,
12941266 ( "stop_code" = String , Path , description = "Stop code" ) ,
12951267 ) ,
1296- responses( ( status = 200 , description = "Stop details" , body = RouteStopMapping ) )
1268+ responses( ( status = 200 , description = "Stop details" , body = StopDetailResponse ) )
12971269) ]
12981270pub async fn get_stop (
12991271 app_state : Data < AppState > ,
@@ -1309,14 +1281,21 @@ pub async fn get_stop(
13091281 . get_station_by_id ( & stop_code)
13101282 . await
13111283 . ok_or_else ( || AppError :: NotFound ( format ! ( "OSRTC station not found: {stop_code}" ) ) ) ?;
1312- return Ok ( HttpResponse :: Ok ( ) . json ( osrtc_station_to_route_stop_mapping ( & station) ) ) ;
1284+ return Ok ( HttpResponse :: Ok ( ) . json ( StopDetailResponse {
1285+ mapping : osrtc_station_to_route_stop_mapping ( & station) ,
1286+ cluster_id : None ,
1287+ } ) ) ;
13131288 }
13141289 let ( stop, maybe_mapping) = app_state
13151290 . gtfs_service
13161291 . get_stop ( & gtfs_id, & stop_code)
13171292 . await ?;
1318- let merged_stop = merge_stop_and_mapping ( stop, maybe_mapping) ;
1319- Ok ( HttpResponse :: Ok ( ) . json ( merged_stop) )
1293+ let cluster_id = stop. cluster_id . clone ( ) ;
1294+ let mapping = merge_stop_and_mapping ( stop, maybe_mapping) ;
1295+ Ok ( HttpResponse :: Ok ( ) . json ( StopDetailResponse {
1296+ mapping,
1297+ cluster_id,
1298+ } ) )
13201299}
13211300
13221301#[ utoipa:: path(
0 commit comments