04/07 updated password reset, ticket templates, and satisfaction survey

This commit is contained in:
2026-04-07 17:32:11 -04:00
parent 36945f5976
commit 60db5c3f9a
18 changed files with 1309 additions and 105 deletions
+45
View File
@@ -180,6 +180,7 @@ def create_app(config_name=None):
db.create_all()
_seed_admin(app)
_seed_settings()
_seed_ticket_templates()
# ── Email ingestion background scheduler ────────────────────────────────────
_start_email_ingestion_scheduler(app)
@@ -265,6 +266,50 @@ def _start_email_ingestion_scheduler(app):
app.logger.error(f'[EMAIL INGEST] Failed to start scheduler: {exc}')
def _seed_ticket_templates():
"""Seed a starter set of ticket templates if none exist."""
from app.models import TicketTemplate
if TicketTemplate.query.first():
return # already seeded
defaults = [
dict(name='VPN / Remote Access Issue', category='network', priority='high',
icon='bi-shield-lock',
title_hint='Cannot connect to VPN',
description='Steps to reproduce:\n1. \n\nError message:\n\nOperating system:\n\nLast time it worked:',
sort_order=1),
dict(name='New Software Request', category='software', priority='low',
icon='bi-box-arrow-in-down',
title_hint='Software installation request — ',
description='Software name and version:\n\nBusiness justification:\n\nApproved by (manager):',
sort_order=2),
dict(name='Password / Account Access', category='access', priority='medium',
icon='bi-key',
title_hint='Cannot log in to ',
description='System / application:\n\nError message:\n\nLast successful login:',
sort_order=3),
dict(name='Hardware Issue', category='hardware', priority='medium',
icon='bi-pc-display',
title_hint='Hardware problem — ',
description='Device type and asset tag:\n\nSymptoms:\n\nWhen did it start:',
sort_order=4),
dict(name='New Employee Onboarding', category='access', priority='high',
icon='bi-person-plus',
title_hint='New employee setup — ',
description='Employee name:\nStart date:\nDepartment:\nManager:\n\nAccounts needed:\n- Email\n- VPN\n- Other:',
sort_order=5),
dict(name='Printer / Scanner Issue', category='printer', priority='low',
icon='bi-printer',
title_hint='Printer not working — ',
description='Printer name / location:\n\nError message:\n\nComputer OS:',
sort_order=6),
]
for d in defaults:
db.session.add(TicketTemplate(**d, is_active=True))
db.session.commit()
def _seed_settings():
"""Ensure all required system settings exist with safe defaults."""
from app.models import SystemSetting