diff --git a/backend/data/photo_sharing.db b/backend/data/photo_sharing.db index 6e2ef79..865d5af 100644 Binary files a/backend/data/photo_sharing.db and b/backend/data/photo_sharing.db differ diff --git a/backend/migrations/028_update_english_templates_to_match_german.js b/backend/migrations/028_update_english_templates_to_match_german.js new file mode 100644 index 0000000..432824d --- /dev/null +++ b/backend/migrations/028_update_english_templates_to_match_german.js @@ -0,0 +1,307 @@ +exports.up = async function(knex) { + // Update English templates to match the quality and content of German templates + + // 1. Gallery Created - Match German version with proper styling and conditionals + await knex('email_templates') + .where('template_key', 'gallery_created') + .update({ + subject_en: 'Your photo gallery is ready', + body_html_en: ` +

Hello {{host_name}},

+ +

Your photo gallery {{event_name}} for {{event_date}} has been successfully created and is now online!

+ +{{#if welcome_message}} +
+

Personal message from your photographer:

+

{{welcome_message}}

+
+{{/if}} + +
+

Your access data:

+ +
+ +
+ View Gallery +
+ +
+

Important: Your gallery will be available until {{expiry_date}}. After this date, the photos will be archived and will only be available upon request.

+
+ +

We hope you enjoy your photos!

+ +

Best regards,
+Your Photo Sharing Team

`, + body_text_en: `Hello {{host_name}}, + +Your photo gallery "{{event_name}}" for {{event_date}} has been successfully created and is now online! + +{{#if welcome_message}} +Personal message from your photographer: +{{welcome_message}} +{{/if}} + +Your access data: +- Gallery link: {{gallery_link}} +- Password: {{gallery_password}} + +Important: Your gallery will be available until {{expiry_date}}. After this date, the photos will be archived and will only be available upon request. + +We hope you enjoy your photos! + +Best regards, +Your Photo Sharing Team` + }); + + // 2. Expiration Warning - Match German version with urgency and styling + await knex('email_templates') + .where('template_key', 'expiration_warning') + .update({ + subject_en: 'Your photo gallery expires soon', + body_html_en: ` +

Hello {{host_name}},

+ +

Your photo gallery {{event_name}} will expire in {{days_remaining}} days!

+ +
+

⚠️ Important Notice

+

After {{expiry_date}}, your gallery will no longer be accessible online. The photos will be archived and will only be available upon special request.

+
+ +

Don't miss out – download your photos now!

+ +
+ Visit Gallery Now +
+ +
+

Quick reminder of your access data:

+ +
+ +

If you have any questions, please don't hesitate to contact us.

+ +

Best regards,
+Your Photo Sharing Team

`, + body_text_en: `Hello {{host_name}}, + +Your photo gallery "{{event_name}}" will expire in {{days_remaining}} days! + +⚠️ Important Notice +After {{expiry_date}}, your gallery will no longer be accessible online. The photos will be archived and will only be available upon special request. + +Don't miss out – download your photos now! + +Quick reminder of your access data: +- Gallery link: {{gallery_link}} +- Password: {{gallery_password}} + +If you have any questions, please don't hesitate to contact us. + +Best regards, +Your Photo Sharing Team` + }); + + // 3. Gallery Expired - Match German version with contact information + await knex('email_templates') + .where('template_key', 'gallery_expired') + .update({ + subject_en: 'Your photo gallery has expired', + body_html_en: ` +

Hello {{host_name}},

+ +

Your photo gallery {{event_name}} expired on {{expiry_date}} and is no longer accessible online.

+ +
+

Your photos are safely archived

+

Don't worry – your photos have been securely archived and are not lost. If you need access to your photos, please contact us:

+ +
+ +

Please have the following information ready when contacting us:

+ + +

We'll be happy to help you access your archived photos.

+ +

Best regards,
+Your Photo Sharing Team

`, + body_text_en: `Hello {{host_name}}, + +Your photo gallery "{{event_name}}" expired on {{expiry_date}} and is no longer accessible online. + +Your photos are safely archived +Don't worry – your photos have been securely archived and are not lost. If you need access to your photos, please contact us: + +📧 Email: {{support_email}} +{{#if support_phone}}📞 Phone: {{support_phone}}{{/if}} + +Please have the following information ready when contacting us: +- Event name: {{event_name}} +- Event date: {{event_date}} +- Expiry date: {{expiry_date}} + +We'll be happy to help you access your archived photos. + +Best regards, +Your Photo Sharing Team` + }); + + // 4. Archive Complete - Match German version with success message and details + await knex('email_templates') + .where('template_key', 'archive_complete') + .update({ + subject_en: 'Your photo gallery has been successfully archived', + body_html_en: ` +

Hello {{host_name}},

+ +

Your photo gallery {{event_name}} has been successfully archived.

+ +
+

✅ Archive successfully created

+

Your photos are now safely stored in our archive.

+
+ +
+

Archive details:

+ +
+ +

If you need access to your archived photos in the future, please contact us at:

+

+ 📧 {{support_email}}
+ {{#if support_phone}}📞 {{support_phone}}{{/if}} +

+ +

Thank you for using our photo sharing service!

+ +

Best regards,
+Your Photo Sharing Team

`, + body_text_en: `Hello {{host_name}}, + +Your photo gallery "{{event_name}}" has been successfully archived. + +✅ Archive successfully created +Your photos are now safely stored in our archive. + +Archive details: +- Event: {{event_name}} +- Archive date: {{archive_date}} +- Number of photos: {{photo_count}} +- Archive size: {{archive_size}} + +If you need access to your archived photos in the future, please contact us at: +📧 {{support_email}} +{{#if support_phone}}📞 {{support_phone}}{{/if}} + +Thank you for using our photo sharing service! + +Best regards, +Your Photo Sharing Team` + }); + + // 5. Test Email - Update to match German style + await knex('email_templates') + .where('template_key', 'test_email') + .update({ + subject_en: 'Test Email - Photo Sharing Platform', + body_html_en: ` +

Test Email

+ +

This is a test email from your photo sharing platform.

+ +
+

✅ Email configuration successful!

+

Your email settings have been configured correctly and emails can be sent.

+
+ +
+

Configuration details:

+ +
+ +

Best regards,
+Your Photo Sharing Team

`, + body_text_en: `Test Email + +This is a test email from your photo sharing platform. + +✅ Email configuration successful! +Your email settings have been configured correctly and emails can be sent. + +Configuration details: +- Timestamp: {{timestamp}} +- Sender: {{from_email}} + +Best regards, +Your Photo Sharing Team` + }); +}; + +exports.down = async function(knex) { + // Revert to previous simpler English templates + await knex('email_templates') + .where('template_key', 'gallery_created') + .update({ + subject_en: 'Your Photo Gallery is Ready', + body_html_en: '

Hello,

Your photo gallery "{{event_name}}" has been created.

Access Link: {{gallery_link}}

Password: {{gallery_password}}

The gallery will be available until {{expiry_date}}.

', + body_text_en: 'Your photo gallery "{{event_name}}" has been created. Access Link: {{gallery_link}} Password: {{gallery_password}} The gallery will be available until {{expiry_date}}.' + }); + + await knex('email_templates') + .where('template_key', 'expiration_warning') + .update({ + subject_en: 'Gallery Expires in {{days_remaining}} Days', + body_html_en: '

Reminder

Your photo gallery "{{event_name}}" will expire in {{days_remaining}} days.

Please download your photos before {{expiry_date}}.

Access Gallery

', + body_text_en: 'Your photo gallery "{{event_name}}" will expire in {{days_remaining}} days. Please download your photos before {{expiry_date}}. Access Gallery: {{gallery_link}}' + }); + + await knex('email_templates') + .where('template_key', 'gallery_expired') + .update({ + subject_en: 'Gallery Expired', + body_html_en: '

Gallery Expired

Your photo gallery "{{event_name}}" has expired and is no longer accessible.

If you need access to your photos, please contact support.

', + body_text_en: 'Your photo gallery "{{event_name}}" has expired and is no longer accessible. If you need access to your photos, please contact support.' + }); + + await knex('email_templates') + .where('template_key', 'archive_complete') + .update({ + subject_en: 'Gallery Archived', + body_html_en: '

Archive Complete

Your gallery "{{event_name}}" has been archived.

Archive size: {{archive_size}}

', + body_text_en: 'Your gallery "{{event_name}}" has been archived. Archive size: {{archive_size}}' + }); + + await knex('email_templates') + .where('template_key', 'test_email') + .update({ + subject_en: 'Test Email', + body_html_en: '

This is a test email sent at {{timestamp}}.

', + body_text_en: 'This is a test email sent at {{timestamp}}.' + }); +}; \ No newline at end of file diff --git a/backend/scripts/verify-template-equality.js b/backend/scripts/verify-template-equality.js new file mode 100644 index 0000000..c922797 --- /dev/null +++ b/backend/scripts/verify-template-equality.js @@ -0,0 +1,110 @@ +const { db } = require('../src/database/db'); + +async function verifyTemplateEquality() { + try { + console.log('Verifying template equality between German and English versions...\n'); + + const templates = await db('email_templates').select('*'); + + for (const template of templates) { + console.log(`\n=== ${template.template_key.toUpperCase()} ===`); + + // Check subject length similarity + const subjectEnLength = template.subject_en?.length || 0; + const subjectDeLength = template.subject_de?.length || 0; + console.log(`Subject length - EN: ${subjectEnLength}, DE: ${subjectDeLength}`); + + // Check HTML content features + const htmlEn = template.body_html_en || ''; + const htmlDe = template.body_html_de || ''; + + // Check for key features in both versions + const features = [ + { name: 'Handlebars conditionals', pattern: /{{#if/g }, + { name: 'Styled divs', pattern: /style="/g }, + { name: 'Background colors', pattern: /background-color:/g }, + { name: 'Buttons/CTAs', pattern: //g }, + { name: 'Icons/Emojis', pattern: /[📧📞✅⚠️]/g }, + { name: 'Lists', pattern: /