-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: feeds operations API function #838
base: main
Are you sure you want to change the base?
Conversation
functions-python/helpers/database.py
Outdated
rel.cascade = "all, delete-orphan" | ||
|
||
|
||
event.listen(mapper, "mapper_configured", set_cascade) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this be executed when the file is imported?Is this what you want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be executed when the SQLAlchemy triggers the mapper configurated events. This is not exactly when the file is imported, it's part of the SqlAchemy lifecycle. It might happen once per thread while Sqlalchemy is instantiating the classes.
unrestricted_domains = ["@mobilitydata.org"] | ||
unrestricted_domains = ["mobilitydata.org"] | ||
return not email or not any(email.endswith(f"@{domain}") for domain in unrestricted_domains) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the unrestricted logic as it was adding two times the @
character
Summary:
This function introduces the Operations API. This API is intended to be used by MobilityData internal team. The endpoints are protected by Google Oauth2.
Expected behavior:
The endpoints for updating GTFS and GTFS-RT are implemented.
Testing tips:
Via retool
Via curl:
Replace the data with the desired values and populate the access token:
From our AI friend
This pull request includes a variety of changes to the API deployment workflows, the feeds API implementation, and the documentation. The most important changes include the addition of OAuth2 client ID handling, the generation and upload of Operations API code, and the inclusion of logging in the feeds API implementation.
Workflow Enhancements:
OPERATIONS_OAUTH2_CLIENT_ID_1PASSWORD
to the environment variables in.github/workflows/api-deployer.yml
and.github/workflows/api-dev.yml
to handle OAuth2 client ID for the operations API. [1] [2].github/workflows/build-test.yml
. [1] [2]Feeds API Implementation:
api/src/feeds/impl/feeds_api_impl.py
and added logging for user email restriction checks. [1] [2]api/src/feeds/impl/feeds_api_impl.py
to use the logger and refactored email restriction checks. [1] [2] [3] [4]Documentation:
docs/OperationsAPI.yaml
to document the Operations API, including endpoints for updating GTFS and GTFS-RT feeds.Miscellaneous:
api/src/middleware/request_context.py
to correct the domain check inis_user_email_restricted
function.is_user_email_restricted
inapi/tests/unittest/middleware/test_request_context.py
to reflect the corrected domain check..flake8
and added.gcloudignore
to exclude new directories and files from linting and Google Cloud uploads respectively. [1] [2]Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.sh
to make sure you didn't break anything