Skip to content
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

Persist status callback requests #142

Merged

Conversation

steventux
Copy link
Contributor

@steventux steventux commented Jan 16, 2025

Description

  • Adds dependency on local PostgreSQL db for development and local tests
  • Adds containerised PostgreSQL db for CI
  • Adds status recording service

Context

When NHS Notify sends callback data via the status endpoint POST /api/status/create we need to persist the data in the post body. This helps us to understand the delivery success of notifications we have sent.

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

When the status callback endpoint receives requests the post body will be saved to the database to record the channel and message status depending on the payload type.
This commit adds the datastore and service module which handles this persistence.
There's good support for composition of SQL in psycopg2 so use it.
We do this in test setup quite a few times so make it a utility.
@steventux steventux force-pushed the persist-status-callback-requests branch 9 times, most recently from 6a42144 to 21fb910 Compare January 16, 2025 17:33
@steventux steventux force-pushed the persist-status-callback-requests branch from 21fb910 to ec5d825 Compare January 16, 2025 17:37
@steventux steventux marked this pull request as ready for review January 16, 2025 17:49
@steventux steventux requested a review from dnimmo January 16, 2025 17:50
We now have local dev and test dbs so improve tests by asserting persistence has worked as expected.
@steventux steventux force-pushed the persist-status-callback-requests branch from 79020fd to 97472a4 Compare January 20, 2025 16:54
@steventux steventux merged commit afa461f into feature-flask-and-function-apps Jan 21, 2025
24 checks passed
@steventux steventux deleted the persist-status-callback-requests branch January 21, 2025 09:02
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