-
Notifications
You must be signed in to change notification settings - Fork 5
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
EES-4930 Send Public API subscription notifications #5097
Conversation
@@ -0,0 +1,23 @@ | |||
namespace GovUk.Education.ExploreEducationStatistics.Notifier.Model; | |||
|
|||
public static class NotifierTableStorageTableNames |
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 know it was me who named it like this, but I'm now thinking this might be better named as simply NotifierTableStorage
.
And the fields inside could be renamed like:
PublicationPendingSubscriptionsTableName
--> PublicationPendingSubscriptionsTable
...
...
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.
Ah yeah, good point, I think this does make things a little tidier. I've done this renaming now as a new commit. Thanks. 🙂
c187534
to
f9a008b
Compare
f9a008b
to
801eb32
Compare
…s + adding messages to the queue when an API data set has a new version
…eStorageService from Notifier.Repositories to Notifier.Services
…NotifierQueueStorage to outer scope.
…ifyApiSubscribers function. Remove unused IOptions<AppSettingsOptions> parameter from ApiSubscriptionRepository constructor.
…ing to simplify serialisation
…scribed ApiSubscription rows
…ata set file details page from email
…tDataSetFile and dataSetFileService.ts
…e and shorten names of table name constants.
This PR completes the work originally started by @jack-hive to send Public API subscription notifications, building on the work also added by @jack-hive in #5043, #5076 and #5056 which allowed subscribing and unsubscribing to Public API data sets.
In this PR a new queue triggered function
ApiSubscriptionFunctions.NotifySubscribers
is added to Notifier.ApiSubscriptionFunctions.NotifySubscribers
functionThe function expects a
ApiNotificationMessage
queue message as input:On receipt of this message it will send email notifications using Gov.uk Notify for all verified subscribers of the data set.
It uses FluentValidation to throw a validation exception if any of
dataSetId
,dataSetFileId
orversion
in the queue message are empty.Notification email template
The email template is personalised with the data set title, version, a link to the data set file details page, and an unsubscribe link.
It expects values for these placeholders to be provided:
data_set_title
,data_set_url
,data_set_version
,unsubscribe_url
.Rename Notifier functions
I standardised the naming across all of Notifier's Publication and Public API subscription functions. The full list of functions is now:
Changes to Publisher
The publisher functions have been changed to queue a
ApiNotificationMessage
message on publishing of data sets.Full list of changes
This is a record of the changes I made to complete this work.
IApiSubscriptionTableStorageService
/ApiSubscriptionTableStorageService
fromNotifier.Repositories
toNotifier.Services
.Constants.NotifierTableStorageTableName
andConstants.NotifierQueueStorage
to outer scope.IOptions<AppSettingsOptions>
parameter from theApiSubscriptionRepository
constructor.FunctionContext
parameter from theNotifySubscribers
function.ApiSubscriptionNotificationId
environment property toappsettings.Local.json.example
and the infrastructure ARM template.ApiSubscriptionStatus
SubscriptionPending
asPending
.ApiNotificationMessage
Version
from typeSemVersion
tostring
to simplify serialisation.DataSetTitle
to the fields returned in theNotifySubscribers
table query, required for the email personalisation.NotifySubscribers
table query to excludePending
subscribers from being sent notifications.ApiNotificationMessage
to theNotifySubscribers
function.DataSetFileId
inApiNotificationMessage
and fixed the link to the data set file details page in the email.dataSetId
fordataSetFileId
inDataSetFileService.GetDataSetFile
anddataSetFileService.ts
to avoid ambiguity.NotifySubscribersTests
function integration tests.ees-notifier-templateid-api-subscription-notification
to all Azure environments (EES-5359).