feat: send notifications when subscription tier changes (#59) #63
@@ -17,7 +17,7 @@ CHECK (template_key IN (
|
||||
'subscription_tier_change'
|
||||
));
|
||||
|
||||
-- Insert subscription tier change email template
|
||||
-- Insert or update subscription tier change email template
|
||||
INSERT INTO email_templates (template_key, name, description, subject, body, variables, html_body) VALUES
|
||||
(
|
||||
'subscription_tier_change',
|
||||
@@ -86,4 +86,12 @@ MotoVaultPro Team',
|
||||
</table>
|
||||
</body>
|
||||
</html>'
|
||||
);
|
||||
)
|
||||
ON CONFLICT (template_key) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description,
|
||||
subject = EXCLUDED.subject,
|
||||
body = EXCLUDED.body,
|
||||
variables = EXCLUDED.variables,
|
||||
html_body = EXCLUDED.html_body,
|
||||
updated_at = NOW();
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Migration: Fix subscription tier change email template
|
||||
* @ai-summary Fixes template to use simple variable substitution instead of conditionals
|
||||
* @ai-context TemplateService only supports {{variable}}, not Handlebars conditionals
|
||||
*/
|
||||
|
||||
-- Update the existing template to use simple variable substitution
|
||||
UPDATE email_templates
|
||||
SET
|
||||
body = 'Hi {{userName}},
|
||||
|
||||
Your MotoVaultPro subscription has been {{changeType}}.
|
||||
|
||||
Previous Tier: {{previousTier}}
|
||||
New Tier: {{newTier}}
|
||||
Reason: {{reason}}
|
||||
|
||||
{{additionalInfo}}
|
||||
|
||||
If you have any questions, please contact support.
|
||||
|
||||
Best regards,
|
||||
MotoVaultPro Team',
|
||||
variables = '["userName", "changeType", "previousTier", "newTier", "reason", "additionalInfo"]',
|
||||
updated_at = NOW()
|
||||
WHERE template_key = 'subscription_tier_change';
|
||||
Reference in New Issue
Block a user