Skip to content

Commit 9430ff0

Browse files
authored
Merge pull request #1177 from MobilityData/1125-modifying-features-in-gbfs-endpoints
feat: 1125 modifying features in gbfs endpoints
2 parents d199faa + 215aa38 commit 9430ff0

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

functions-python/gbfs_validator/src/gbfs_data_processor.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
from shared.database.database import with_db_session
3131
from shared.helpers.utils import create_http_task
3232

33+
FEATURE_ENDPOINTS = [
34+
"manifest",
35+
"gbfs_versions",
36+
"vehicle_types",
37+
"station_status",
38+
"vehicle_status",
39+
"system_regions",
40+
"system_pricing_plans",
41+
"system_alerts",
42+
"geofencing_zones",
43+
]
44+
3345

3446
class GBFSDataProcessor:
3547
def __init__(self, stable_id: str, feed_id: str):
@@ -298,7 +310,9 @@ def update_or_create_gbfs_endpoint(
298310
)
299311

300312
gbfs_endpoint_orm.url = endpoint.url # Update the URL
301-
gbfs_endpoint_orm.is_feature = endpoint.name in features
313+
gbfs_endpoint_orm.is_feature = (
314+
endpoint.name in features and endpoint.name in FEATURE_ENDPOINTS
315+
)
302316
return gbfs_endpoint_orm
303317

304318
def validate_gbfs_feed_versions(self) -> None:

liquibase/changelog.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@
5656
<include file="changes/feat_1124.sql" relativeToChangelogFile="true"/>
5757
<!-- Materialized view updated. Added versions of GBFS feeds-->
5858
<include file="changes/feat_1118.sql" relativeToChangelogFile="true"/>
59+
<include file="changes/feat_1125.sql" relativeToChangelogFile="true"/>
5960
</databaseChangeLog>

liquibase/changes/feat_1125.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Update gbfsendpoint table to set is_feature = false for specific endpoints
2+
UPDATE gbfsendpoint
3+
SET is_feature = CASE
4+
WHEN name IN (
5+
'manifest',
6+
'gbfs_versions',
7+
'vehicle_types',
8+
'station_status',
9+
'vehicle_status',
10+
'system_regions',
11+
'system_pricing_plans',
12+
'system_alerts',
13+
'geofencing_zones'
14+
) THEN true
15+
ELSE false
16+
END;

0 commit comments

Comments
 (0)