03dd477899
Check Cross-Plugin Imports / check (push) Has been cancelled
- Scope-Deklarationen: tasks only_mine, kommunikation conversation_ids, wiki category_ids (NEUE contracts.py), report_generator template_ids, automation agent_ids (module_key agents), tags tag_ids, unified_search entity_types dynamisch aus Provider-Registry - Core-Beiträge: navigation default_route (Startseite) + dashboard widget_app_ids (Widget-TYP-Angebot, Layout bleibt Phase M) - Backend-Filter (additive UND): /tasks (only_mine), /comm/conversations, /wiki/articles+/categories (Subtree), /reports/print-templates, /agents, /tags, /search GET+POST (entity_types-Schnitt), /miniapps?host=dashboard - apply_entity_type_scope-Helper (requested ∧ scope) - Frontend: WorkspaceSwitcher default_route-Navigation, Sidebar workspace-menu_order-Sortierung, workspaceStore moduleMenuOrder() - Tests: 18/18 Deklarationen + 11/11 Filter (TDD), Frontend 2/2 + Store 18/18, tsc clean, Build OK - Regression 64 passed (4 Kombi-Failures = Suite-Isolation, solo-bewiesen); Checker 0; Ruff = Vorbestand (Stash-bewiesen)
83 lines
2.5 KiB
Python
83 lines
2.5 KiB
Python
"""Public contract for the report_generator plugin.
|
|
|
|
Exposes models and PDF generation functions for other plugins.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
from app.plugins.builtins.report_generator.models import (
|
|
ReportInstance,
|
|
ReportTemplate,
|
|
)
|
|
from app.plugins.builtins.report_generator.pdf_generator import (
|
|
PRESET_META,
|
|
PRESET_TEMPLATES,
|
|
generate_pdf,
|
|
generate_pdf_from_template_content,
|
|
generate_preset_report,
|
|
generate_print_pdf,
|
|
get_preset_list,
|
|
render_template_file,
|
|
render_template_string,
|
|
)
|
|
|
|
|
|
class ReportGeneratorContract:
|
|
"""Public API surface for the report_generator plugin."""
|
|
|
|
contract_name = "report_generator"
|
|
|
|
# ─── models ───
|
|
ReportTemplate = ReportTemplate
|
|
ReportInstance = ReportInstance
|
|
|
|
# ─── pdf_generator ───
|
|
generate_pdf = staticmethod(generate_pdf)
|
|
generate_print_pdf = staticmethod(generate_print_pdf)
|
|
generate_preset_report = staticmethod(generate_preset_report)
|
|
generate_pdf_from_template_content = staticmethod(generate_pdf_from_template_content)
|
|
render_template_file = staticmethod(render_template_file)
|
|
render_template_string = staticmethod(render_template_string)
|
|
get_preset_list = staticmethod(get_preset_list)
|
|
PRESET_META = PRESET_META
|
|
PRESET_TEMPLATES = PRESET_TEMPLATES
|
|
|
|
# ─── Workspace Scopes contribution (Phase N4) ───
|
|
|
|
@staticmethod
|
|
def workspace_scopes() -> list[dict]:
|
|
"""Scope-Dimensionen des reports-Moduls: Vorlagen-Teilmengen (N4)."""
|
|
return [
|
|
{
|
|
"module_key": "reports",
|
|
"dimensions": [
|
|
{
|
|
"key": "template_ids",
|
|
"label": "Vorlagen",
|
|
"control": "multiselect",
|
|
"options": [],
|
|
"value_source": {
|
|
"endpoint": "/api/v1/reports/print-templates",
|
|
"items_path": "items",
|
|
"value_key": "id",
|
|
"label_key": "name",
|
|
},
|
|
},
|
|
],
|
|
}
|
|
]
|
|
|
|
|
|
# ─── self-registration ───
|
|
|
|
_contract = ReportGeneratorContract()
|
|
get_contract_registry().register("report_generator", _contract)
|
|
|
|
|
|
__all__ = [
|
|
"ReportGeneratorContract",
|
|
"ReportTemplate",
|
|
"ReportInstance",
|
|
]
|