-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: Official Status Tag Update #869
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
Conversation
This commit introduces a PostgreSQL trigger and associated function to log changes to the `official` field in the `public.feed` table. It also includes a query to set the `official` field for feeds meeting specific criteria. This enhances data auditability and ensures change history is recorded in `officialstatushistory`.
| -- Trigger to track changes in the official field of the feed table | ||
| CREATE TRIGGER track_official_tag_change | ||
| AFTER UPDATE OF official ON public.feed | ||
| FOR EACH ROW | ||
| EXECUTE FUNCTION log_official_tag_change(); |
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.
Let's remove this trigger as it's not possible to infer the email of the person/system stamping the official field. It's true that for the execution if the [email protected] but subsequence updates the email should be associated with the person staying the official flag.
However, we still need to do the first migration so the officialstatushistory should contain one row for the feeds that were updated in the SQL update in this PR.
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.
Okay. Done
…ct query update to the 'officialstatushistory' table
… official_status_tag_update
| id, | ||
| '[email protected]', | ||
| NOW(), | ||
| 'Official status tag changed' |
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.
I find this note to be a bit generic.
Maybe you can ask @emmambd for a note that is specific to the operation done here.
Like: Official status set after manual verification of initial DB contents.
Or something like this.
Or maybe it's not important.
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.
Where does this alert show up? I think keeping is general is okay in case there's a world where we do automate this in the future
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.
@emmambd it shows up as a note in the officialstatushistory table for the feeds i set to official.
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.
If it lives in the DB I think that is sufficient.
Summary:
This PR contains sql queries to update and set official tags for feeds from with valid contact email that have 'mbd' as their source & logs these changes to the public.officialstatushistory
Key Changes
This pull request addresses the functionality described in issue https://github.com/MobilityData/mobility-feed-api/issues/851
Expected behavior:
Snapshot of updated official status tag
Snapshot of officialstatushistory table
Testing tips:
Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything