Files
leocrm/app/plugins/builtins/wiki/contracts.py
T

56 lines
1.6 KiB
Python
Raw Normal View History

"""Wiki plugin contract — public interface for cross-plugin access (N4).
Created for the Phase N workspace_scopes contribution (the wiki previously
had no contract module — N4 needs one for the scope registry, mirroring the
contacts/dms/mail/calendar pattern from N1).
"""
from __future__ import annotations
from app.plugins.builtins.contracts import get_contract_registry
class WikiContract:
"""Public contract for the wiki plugin."""
contract_name = "wiki"
# ─── Workspace Scopes contribution (Phase N4) ───
@staticmethod
def workspace_scopes() -> list[dict]:
"""Scope-Dimensionen des wiki-Moduls: Kategorien-Teilmengen (N4)."""
return [
{
"module_key": "wiki",
"dimensions": [
{
"key": "category_ids",
"label": "Wiki-Kategorien",
"control": "multiselect",
"options": [],
"value_source": {
"endpoint": "/api/v1/wiki/categories",
"items_path": "items",
"value_key": "id",
"label_key": "name",
},
},
],
}
]
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───
_contract = WikiContract()
get_contract_registry().register("wiki", _contract)
__all__ = ["WikiContract"]