feat: send notifications when subscription tier changes (#59) #63

Merged
egullickson merged 4 commits from issue-59-tier-change-notifications into main 2026-02-01 02:38:21 +00:00
Owner

Summary

  • Adds email and in-app notifications when user subscription tier changes
  • Notifications triggered by admin override, user upgrade/downgrade, and grace period auto-downgrade
  • Includes previous tier, new tier, and reason for change

Fixes #59

Changes

  • Extended TemplateKey type with 'subscription_tier_change'
  • Added migration 007_subscription_tier_change_template.sql with responsive HTML email template
  • Added sendTierChangeNotification() to NotificationsService
  • Integrated notifications into SubscriptionsService methods (upgrade, downgrade, adminOverride)
  • Integrated notifications into grace-period.job.ts for auto-downgrades

Test Plan

  • Verify type-check passes
  • Verify lint passes
  • Test email notification sent on tier upgrade
  • Test email notification sent on tier downgrade
  • Test email notification sent on admin override
  • Test email notification sent on grace period expiration
  • Test in-app notification appears in notification bell
  • Mobile + desktop responsive validation

Generated with Claude Code

## Summary - Adds email and in-app notifications when user subscription tier changes - Notifications triggered by admin override, user upgrade/downgrade, and grace period auto-downgrade - Includes previous tier, new tier, and reason for change Fixes #59 ## Changes - Extended `TemplateKey` type with `'subscription_tier_change'` - Added migration `007_subscription_tier_change_template.sql` with responsive HTML email template - Added `sendTierChangeNotification()` to `NotificationsService` - Integrated notifications into `SubscriptionsService` methods (upgrade, downgrade, adminOverride) - Integrated notifications into `grace-period.job.ts` for auto-downgrades ## Test Plan - [ ] Verify type-check passes - [ ] Verify lint passes - [ ] Test email notification sent on tier upgrade - [ ] Test email notification sent on tier downgrade - [ ] Test email notification sent on admin override - [ ] Test email notification sent on grace period expiration - [ ] Test in-app notification appears in notification bell - [ ] Mobile + desktop responsive validation Generated with [Claude Code](https://claude.com/claude-code)
egullickson added 1 commit 2026-02-01 01:51:12 +00:00
feat: send notifications when subscription tier changes (refs #59)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 7m15s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 30s
Deploy to Staging / Verify Staging (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
cc2898f6ff
Adds email and in-app notifications when user subscription tier changes:
- Extended TemplateKey type with 'subscription_tier_change'
- Added migration for tier change email template with HTML
- Added sendTierChangeNotification() to NotificationsService
- Integrated notifications into upgradeSubscription, downgradeSubscription, adminOverrideTier
- Integrated notifications into grace-period.job.ts for auto-downgrades

Notifications include previous tier, new tier, and reason for change.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson added 1 commit 2026-02-01 02:03:00 +00:00
fix: replace template conditionals with simple variable substitution (refs #59)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m33s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 39s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
86b2e46798
The TemplateService only supports {{variable}} substitution, not Handlebars-style
conditionals. Changed to use a single {{additionalInfo}} variable that is built
in the service code based on upgrade/downgrade status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson added 1 commit 2026-02-01 02:21:21 +00:00
fix: add migration to update existing tier change template (refs #59)
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 3m4s
Deploy to Staging / Deploy to Staging (pull_request) Has been cancelled
Deploy to Staging / Verify Staging (pull_request) Has been cancelled
Deploy to Staging / Notify Staging Ready (pull_request) Has been cancelled
Deploy to Staging / Notify Staging Failure (pull_request) Has been cancelled
706851f396
The original migration already inserted the template with Handlebars conditionals.
This migration updates the existing record to use simple variable substitution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson added 1 commit 2026-02-01 02:22:57 +00:00
fix: use upsert for tier change template migration (refs #59)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m5s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 30s
Deploy to Staging / Verify Staging (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
1614ef697b
Changed INSERT to INSERT...ON CONFLICT DO UPDATE so the migration works for:
- Fresh deployments (inserts new template)
- Existing databases (updates template to fix variable substitution)

Removed unnecessary migration 008.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit e3a482e00f into main 2026-02-01 02:38:21 +00:00
egullickson deleted branch issue-59-tier-change-notifications 2026-02-01 02:38:21 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#63