Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend): schema updates, migration, queries for Email Notificat…
…ion Service (#9445) <!-- Clearly explain the need for these changes: --> The email service has requirements to - Email users when some activity has happened on their account on some scheduled basis -> We need a way to get active users and the executions that happened while they were active - Allow users to configure what emails they get -> Need a user preference - Get User email by Id so that we can email them -> Pretty self-explanatory We need to add a few new backend queries + db models for the notification to start handling these details. This is the first set of those changes based on experience building the app service ### Changes 🏗️ <!-- Concisely describe all of the changes made in this pull request: --> - Adds a new DB Model, `UserNotificationPreferences,` with related migration - Adds a new DB Model `NotificationEvent` with related migration to track what notifications we've sent and how many and such (how much we add here is open to change depending on what limits on data we want) - Adds a new DB Model `UserNotificationBatch` with related migration to handle batching of like models - Adds queries to get users and executions by `datetime` ranges as `ISO` strings - Adds new queries to the `DatabaseManager` and exposes them to the other `AppService`s - Exposes all new queries plus an existing one `get_user_by_id` ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] I extracted these changes from a working implementation of the service, and tested they don't bring down the service by being uncalled by running the standard agent tests we do on release --------- Co-authored-by: Reinier van der Leer <[email protected]>
- Loading branch information