Email template management
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from sqlalchemy.orm import Session
|
||||
from ..models.models import MembershipTier, User, UserRole
|
||||
from ..models.models import MembershipTier, User, UserRole, EmailTemplate
|
||||
from .security import get_password_hash
|
||||
from datetime import datetime
|
||||
|
||||
@@ -54,3 +54,19 @@ def init_default_data(db: Session):
|
||||
db.commit()
|
||||
print("✓ Created default admin user (admin@swanseaairport.org / admin123)")
|
||||
print(" ⚠️ Remember to change the admin password!")
|
||||
|
||||
# Check if email templates exist
|
||||
existing_templates = db.query(EmailTemplate).count()
|
||||
if existing_templates == 0:
|
||||
print("Creating default email templates...")
|
||||
from ..services.email_service import get_default_templates
|
||||
default_templates_data = get_default_templates()
|
||||
|
||||
default_templates = []
|
||||
for template_data in default_templates_data:
|
||||
template = EmailTemplate(**template_data)
|
||||
default_templates.append(template)
|
||||
|
||||
db.add_all(default_templates)
|
||||
db.commit()
|
||||
print(f"✓ Created {len(default_templates)} default email templates")
|
||||
|
||||
Reference in New Issue
Block a user