55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
export interface EmailTemplate {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
subject: string;
|
|
header: string;
|
|
body: string;
|
|
footer: string;
|
|
variables: string[]; // List of placeholders found in the text
|
|
updatedAt: string;
|
|
}
|
|
|
|
export type ViewState = 'dashboard' | 'editor';
|
|
|
|
export interface ToastMessage {
|
|
id: string;
|
|
type: 'success' | 'error' | 'info';
|
|
text: string;
|
|
}
|
|
|
|
// Uniform schema for both Postgres and MySQL, showing the VARCHAR id needed for UUIDs
|
|
export const SQL_SCHEMA = `
|
|
-- Per MySQL
|
|
CREATE TABLE IF NOT EXISTS email_templates (
|
|
id VARCHAR(255) PRIMARY KEY,
|
|
template_key VARCHAR(255) UNIQUE NOT NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
description TEXT,
|
|
subject VARCHAR(255),
|
|
header_html MEDIUMTEXT,
|
|
body_html MEDIUMTEXT,
|
|
footer_html MEDIUMTEXT,
|
|
full_html MEDIUMTEXT,
|
|
required_variables JSON,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Per PostgreSQL
|
|
-- CREATE TABLE IF NOT EXISTS email_templates (
|
|
-- id VARCHAR(255) PRIMARY KEY,
|
|
-- template_key VARCHAR(255) UNIQUE NOT NULL,
|
|
-- name VARCHAR(255) NOT NULL,
|
|
-- description TEXT,
|
|
-- subject VARCHAR(255),
|
|
-- header_html TEXT,
|
|
-- body_html TEXT,
|
|
-- footer_html TEXT,
|
|
-- full_html TEXT,
|
|
-- required_variables JSONB,
|
|
-- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
-- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
-- );
|
|
`;
|