bmc_hub/app/modules/test_module/frontend/views.py
Christian 38fa3b6c0a feat: Add subscriptions lock feature to customers
- Added a new column `subscriptions_locked` to the `customers` table to manage subscription access.
- Implemented a script to create new modules from a template, including updates to various files (module.json, README.md, router.py, views.py, and migration SQL).
- Developed a script to import BMC Office subscriptions from an Excel file into the database, including error handling and statistics reporting.
- Created a script to lookup and update missing CVR numbers using the CVR.dk API.
- Implemented a script to relink Hub customers to e-conomic customer numbers based on name matching.
- Developed scripts to sync CVR numbers from Simply-CRM and vTiger to the local customers database.
2025-12-13 12:06:28 +01:00

53 lines
1.4 KiB
Python

"""
Test Module Module - Frontend Views
HTML view routes for template module
"""
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
import logging
from app.core.database import execute_query
logger = logging.getLogger(__name__)
# APIRouter instance (module_loader kigger efter denne)
router = APIRouter()
# Templates til dette modul (relativ til module root)
templates = Jinja2Templates(directory="app/modules/test_module/test_modules")
@router.get("/test_module", response_class=HTMLResponse)
async def template_page(request: Request):
"""
Template module hovedside
Args:
request: FastAPI request object
Returns:
HTML response
"""
try:
# Hent items til visning
items = execute_query(
"SELECT * FROM test_module_items ORDER BY created_at DESC LIMIT 10"
)
return templates.TemplateResponse("index.html", {
"request": request,
"page_title": "Test Module Module",
"items": items or []
})
except Exception as e:
logger.error(f"❌ Error rendering template page: {e}")
return templates.TemplateResponse("index.html", {
"request": request,
"page_title": "Test Module Module",
"error": str(e),
"items": []
})