Add Apple Sign In welcome email, notification preferences on registration, and contractor sharing tests

- Send welcome email to new users who sign up via Apple Sign In
- Create notification preferences (all enabled) when new accounts are created
- Add comprehensive integration tests for contractor sharing:
  - Personal contractors only visible to creator
  - Residence-tied contractors visible to all users with residence access
  - Update/delete access control for shared contractors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-01 17:42:37 -06:00
parent be507561f1
commit 0a708c092d
7 changed files with 527 additions and 11 deletions

View File

@@ -145,6 +145,76 @@ The Casera Team
return s.SendEmail(to, subject, htmlBody, textBody)
}
// SendAppleWelcomeEmail sends a welcome email for Apple Sign In users (no verification needed)
func (s *EmailService) SendAppleWelcomeEmail(to, firstName string) error {
subject := "Welcome to Casera!"
name := firstName
if name == "" {
name = "there"
}
htmlBody := fmt.Sprintf(`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #333; }
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { text-align: center; padding: 20px 0; }
.cta { background: #07A0C3; color: white; padding: 15px 30px; text-decoration: none; border-radius: 8px; display: inline-block; margin: 20px 0; }
.features { background: #f8f9fa; padding: 20px; border-radius: 8px; margin: 20px 0; }
.feature { margin: 10px 0; }
.footer { text-align: center; color: #666; font-size: 12px; margin-top: 40px; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Welcome to Casera!</h1>
</div>
<p>Hi %s,</p>
<p>Thank you for joining Casera! Your account has been created and you're ready to start managing your properties.</p>
<div class="features">
<h3>Here's what you can do with Casera:</h3>
<div class="feature">🏠 <strong>Manage Properties</strong> - Track all your homes and rentals in one place</div>
<div class="feature">✅ <strong>Task Management</strong> - Never miss maintenance with smart scheduling</div>
<div class="feature">👷 <strong>Contractor Directory</strong> - Keep your trusted pros organized</div>
<div class="feature">📄 <strong>Document Storage</strong> - Store warranties, manuals, and important records</div>
</div>
<p>If you have any questions, feel free to reach out to us at support@casera.app.</p>
<p>Best regards,<br>The Casera Team</p>
<div class="footer">
<p>&copy; %d Casera. All rights reserved.</p>
</div>
</div>
</body>
</html>
`, name, time.Now().Year())
textBody := fmt.Sprintf(`
Welcome to Casera!
Hi %s,
Thank you for joining Casera! Your account has been created and you're ready to start managing your properties.
Here's what you can do with Casera:
- Manage Properties: Track all your homes and rentals in one place
- Task Management: Never miss maintenance with smart scheduling
- Contractor Directory: Keep your trusted pros organized
- Document Storage: Store warranties, manuals, and important records
If you have any questions, feel free to reach out to us at support@casera.app.
Best regards,
The Casera Team
`, name)
return s.SendEmail(to, subject, htmlBody, textBody)
}
// SendVerificationEmail sends an email verification code
func (s *EmailService) SendVerificationEmail(to, firstName, code string) error {
subject := "Casera - Verify Your Email"