diff --git a/api/prisma/seed.ts b/api/prisma/seed.ts index 99674995..091324c0 100644 --- a/api/prisma/seed.ts +++ b/api/prisma/seed.ts @@ -328,6 +328,61 @@ async function seedEmailTemplates(admin: { id: string; email: string }) { { key: 'SHIFT_STATUS', label: 'Shift Status', description: 'Status of the shift', isRequired: true, isConditional: false, sampleValue: 'OPEN', sortOrder: 10 }, ], }, + { + key: 'email-verification', + name: 'Email Verification', + description: 'Sent to new users to verify their email address after self-registration', + category: EmailTemplateCategory.SYSTEM, + subjectLine: 'Verify your email — {{ORGANIZATION_NAME}}', + isSystem: true, + variables: [ + { key: 'RECIPIENT_NAME', label: 'User Name', description: 'Name of the user being verified', isRequired: true, isConditional: false, sampleValue: 'Jane Doe', sortOrder: 0 }, + { key: 'VERIFICATION_URL', label: 'Verification URL', description: 'URL the user clicks to verify their email', isRequired: true, isConditional: false, sampleValue: 'https://app.cmlite.org/verify-email?token=abc123', sortOrder: 1 }, + { key: 'ORGANIZATION_NAME', label: 'Organization Name', description: 'Name of the organization', isRequired: true, isConditional: false, sampleValue: 'Changemaker Lite', sortOrder: 2 }, + { key: 'EXPIRY_HOURS', label: 'Expiry Hours', description: 'Number of hours until the verification link expires', isRequired: true, isConditional: false, sampleValue: '24', sortOrder: 3 }, + ], + }, + { + key: 'password-reset', + name: 'Password Reset', + description: 'Sent when a user requests a password reset link', + category: EmailTemplateCategory.SYSTEM, + subjectLine: 'Reset your password — {{ORGANIZATION_NAME}}', + isSystem: true, + variables: [ + { key: 'RECIPIENT_NAME', label: 'User Name', description: 'Name of the user requesting a reset', isRequired: true, isConditional: false, sampleValue: 'Jane Doe', sortOrder: 0 }, + { key: 'RESET_URL', label: 'Reset URL', description: 'URL the user clicks to reset their password', isRequired: true, isConditional: false, sampleValue: 'https://app.cmlite.org/reset-password?token=abc123', sortOrder: 1 }, + { key: 'ORGANIZATION_NAME', label: 'Organization Name', description: 'Name of the organization', isRequired: true, isConditional: false, sampleValue: 'Changemaker Lite', sortOrder: 2 }, + ], + }, + { + key: 'account-approved', + name: 'Account Approved', + description: 'Sent to a user when an admin approves their account after email verification', + category: EmailTemplateCategory.SYSTEM, + subjectLine: 'Account approved — {{ORGANIZATION_NAME}}', + isSystem: true, + variables: [ + { key: 'RECIPIENT_NAME', label: 'User Name', description: 'Name of the approved user', isRequired: true, isConditional: false, sampleValue: 'Jane Doe', sortOrder: 0 }, + { key: 'LOGIN_URL', label: 'Login URL', description: 'URL to the login page', isRequired: true, isConditional: false, sampleValue: 'https://app.cmlite.org/login', sortOrder: 1 }, + { key: 'ORGANIZATION_NAME', label: 'Organization Name', description: 'Name of the organization', isRequired: true, isConditional: false, sampleValue: 'Changemaker Lite', sortOrder: 2 }, + ], + }, + { + key: 'account-pending-approval', + name: 'Account Pending Approval (Admin Notification)', + description: 'Sent to admins when a new user verifies their email and is awaiting approval', + category: EmailTemplateCategory.SYSTEM, + subjectLine: 'New user awaiting approval — {{ORGANIZATION_NAME}}', + isSystem: true, + variables: [ + { key: 'NEW_USER_NAME', label: 'New User Name', description: 'Name of the new user requesting approval', isRequired: true, isConditional: false, sampleValue: 'Jane Doe', sortOrder: 0 }, + { key: 'NEW_USER_EMAIL', label: 'New User Email', description: 'Email of the new user', isRequired: true, isConditional: false, sampleValue: 'jane@example.com', sortOrder: 1 }, + { key: 'REGISTERED_AT', label: 'Registration Date', description: 'Date the user registered', isRequired: true, isConditional: false, sampleValue: 'February 16, 2026', sortOrder: 2 }, + { key: 'ADMIN_URL', label: 'Admin URL', description: 'URL to the admin users page filtered to pending approval', isRequired: true, isConditional: false, sampleValue: 'https://app.cmlite.org/app/users?status=PENDING_APPROVAL', sortOrder: 3 }, + { key: 'ORGANIZATION_NAME', label: 'Organization Name', description: 'Name of the organization', isRequired: true, isConditional: false, sampleValue: 'Changemaker Lite', sortOrder: 4 }, + ], + }, ]; let seededCount = 0;