Skip to content

Set get notification to use DB reader#2910

Open
jzbahrai wants to merge 1 commit into
mainfrom
task/set-reader-caller
Open

Set get notification to use DB reader#2910
jzbahrai wants to merge 1 commit into
mainfrom
task/set-reader-caller

Conversation

@jzbahrai

Copy link
Copy Markdown
Collaborator

Summary | Résumé

TODO: 1-3 sentence description of the changed you're proposing.

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

TODO: Fill in test instructions for the reviewer.

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

Copilot AI review requested due to automatic review settings June 15, 2026 20:16
@jzbahrai jzbahrai requested a review from jimleroyer as a code owner June 15, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Routes get_notification_with_personalisation DB reads through the configured reader bind (instead of the default session), aligning this endpoint with the project’s read/write routing approach.

Changes:

  • Updated get_notification_with_personalisation to query via db.on_reader().query(...).
  • Added a unit test that asserts the DAO function uses the reader bind.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/dao/notifications_dao.py Switches get_notification_with_personalisation to use the DB reader bind for the query.
tests/app/dao/notification_dao/test_notification_dao.py Adds a test that verifies the reader bind is used by the DAO function.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 336 to +342
def get_notification_with_personalisation(service_id, notification_id, key_type):
filter_dict = {"service_id": service_id, "id": notification_id}
if key_type:
filter_dict["key_type"] = key_type

try:
return Notification.query.filter_by(**filter_dict).options(joinedload("template")).one()
return db.on_reader().query(Notification).filter_by(**filter_dict).options(joinedload("template")).one()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants