前端(Vite + React)、API/worker(Fastify + BullMQ)、api-contracts 契约包、 迁移脚本、测试与自托管 docker-compose 示例。 开源准备:运维脚本与机器信息已拆到私有仓库;公司名、备案号、隐私邮箱改读 publicCompliance.local.json(仓库只保留占位模板);站点地址与客服二维码改为 VITE_ 环境变量;fixtures 中的真实用户标识已匿名化;三个 package.json 标注 Apache-2.0。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
21 lines
921 B
SQL
21 lines
921 B
SQL
CREATE TABLE IF NOT EXISTS notification_events (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
channel text NOT NULL CHECK (channel IN ('email')),
|
|
event_type text NOT NULL,
|
|
recipient text NOT NULL,
|
|
subject text NOT NULL DEFAULT '',
|
|
status text NOT NULL CHECK (status IN ('sent', 'failed', 'skipped')),
|
|
provider text NOT NULL DEFAULT 'resend',
|
|
provider_message_id text,
|
|
error text,
|
|
related_user_id uuid REFERENCES users(id),
|
|
related_order_id uuid REFERENCES orders(id),
|
|
related_ticket_id uuid REFERENCES tickets(id),
|
|
related_invoice_id uuid REFERENCES invoice_requests(id),
|
|
metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_notification_events_created ON notification_events(created_at DESC);
|
|
CREATE INDEX IF NOT EXISTS idx_notification_events_user_created ON notification_events(related_user_id, created_at DESC);
|