from models import EmailTemplate, User, db def create_default_templates(): """Create default email templates if they don't exist.""" # Get the first admin user to be the creator admin = User.query.filter_by(is_admin=True).first() if not admin: print("No admin user found. Please create an admin user first.") return # Define default templates for each notification type default_templates = [ { 'name': 'Account Created', 'subject': 'Welcome to DocuPulse!', 'body': '''
Dear {{ user.username }},
Your account has been successfully created by {{ created_by }}. To get started, you need to set up your password.
Click the link below to set up your password (this link will expire in 24 hours):
If you didn't receive this email or if the link has expired, please contact your administrator to request a new password setup link.
If you have any questions, please don't hesitate to contact our support team.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
We received a request to reset your password. Click the link below to set a new password:
If you didn't request this, please ignore this email or contact support if you have concerns.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your DocuPulse account has been successfully deleted as requested.
We're sorry to see you go. If you change your mind, you can create a new account at any time.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your DocuPulse account has been successfully updated.
If you didn't make these changes, please contact our support team immediately.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has invited you to join the room "{{ room_name }}".
Click the link below to view the room:
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your invitation to the room "{{ room_name }}" has been removed.
If you believe this is an error, please contact the room administrator.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has invited you to join a conversation.
Click the link below to view the conversation:
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your invitation to the conversation has been removed.
If you believe this is an error, please contact the conversation administrator.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has sent a new message in your conversation.
Click the link below to view the message:
Best regards,
The DocuPulse Team