Fix notification_templates table column names

Update auth email template migration and edge function to use correct column names:
- template_key → key
- subject → email_subject
- html_content → email_body_html

Matches existing notification_templates schema used in NotifikasiTab.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-01-02 13:41:30 +07:00
parent 0d29c953c1
commit c6250d2b47
2 changed files with 10 additions and 28 deletions

View File

@@ -82,7 +82,7 @@ serve(async (req: Request) => {
const { data: template, error: templateError } = await supabase
.from('notification_templates')
.select('*')
.eq('template_key', 'auth_email_verification')
.eq('key', 'auth_email_verification')
.single();
if (templateError || !template) {
@@ -110,13 +110,13 @@ serve(async (req: Request) => {
};
// Process shortcodes in subject
let subject = template.subject;
let subject = template.email_subject;
Object.entries(templateVars).forEach(([key, value]) => {
subject = subject.replace(new RegExp(`{${key}}`, 'g'), value);
});
// Process shortcodes in HTML body
let htmlBody = template.html_content;
let htmlBody = template.email_body_html;
Object.entries(templateVars).forEach(([key, value]) => {
htmlBody = htmlBody.replace(new RegExp(`{${key}}`, 'g'), value);
});