- Change email service logging from console.log to console.warn for better visibility - Update mailgun and couchdb configuration with improved error handling - Enhance database seeder with better logging and error management - Improve service factory patterns for better testability
27 lines
983 B
TypeScript
27 lines
983 B
TypeScript
/**
|
|
* Mock email service for sending verification emails
|
|
*/
|
|
export class EmailService {
|
|
/**
|
|
* Simulates sending a verification email with a link to /verify-email?token=${token}
|
|
* @param email - The recipient's email address
|
|
* @param token - The verification token
|
|
*/
|
|
async sendVerificationEmail(email: string, token: string): Promise<void> {
|
|
// In a real implementation, this would send an actual email
|
|
// For this demo, we'll just log the action
|
|
console.warn(
|
|
`📧 Sending verification email to ${email} with token: ${token}`
|
|
);
|
|
console.warn(`🔗 Verification link: /verify-email?token=${token}`);
|
|
|
|
// Simulate network delay
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
|
|
// In a real implementation, we would make an HTTP request to an email service
|
|
// Example: await fetch('/api/send-email', { method: 'POST', body: JSON.stringify({ email, token }) });
|
|
}
|
|
}
|
|
|
|
export const emailService = new EmailService();
|