-- ===================================================================== -- NOTIFICATION SCHEMA — Part 18: channel provider config + seed email templates -- Stores per-tenant SMS (Kavenegar) and Email (SMTP) provider settings, and seeds -- the default Persian email templates (welcome / account verification / promotion). -- ===================================================================== SET search_path TO notification, public; CREATE TABLE IF NOT EXISTS channel_config ( tenant_id UUID NOT NULL, channel TEXT NOT NULL, -- 'sms' | 'email' settings JSONB NOT NULL DEFAULT '{}',-- kavenegar:{api_key,line_number} / smtp:{host,port,username,password,from_email,from_name,use_tls} enabled BOOLEAN NOT NULL DEFAULT FALSE, updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), PRIMARY KEY (tenant_id, channel) ); -- Seed default Email templates (idempotent; no dependency on a unique constraint). INSERT INTO notification_templates (code, channel, locale, subject, body_html, is_active) SELECT v.code, v.channel, v.locale, v.subject, v.body_html, TRUE FROM (VALUES ('welcome', 'Email', 'fa', 'به فلترندر خوش آمدید 🎉', '
سلام {{name}}، خوشحالیم که به جمع سازندگان فلترندر پیوستی. حالا میتونی با هوش مصنوعی و بیش از ۱٬۲۰۰ قالب، ویدیو و تصویر حرفهای بسازی.
اگر این حساب را شما نساختهاید، این ایمیل را نادیده بگیرید.
سلام {{name}}، برای فعالسازی حساب خود کد زیر را وارد کنید:
{{code}}
این کد تا ۱۵ دقیقه معتبر است. اگر شما درخواست ندادهاید، این پیام را نادیده بگیرید.