"""Request Management Module.""" import sys from pathlib import Path from typing import List, Optional from fastapi import APIRouter from app.core.sdk.module import BaseModule _module_dir = Path(__file__).parent class RequestModule(BaseModule): """Module for managing service requests/tickets.""" id = "request" name = "Request Management" version = "1.0.0" description = "Модуль управления заявками" def __init__(self): self._module_dir = _module_dir self._routers: Optional[List[APIRouter]] = None def _load_routers(self) -> List[APIRouter]: """Load all routers from the module.""" if self._routers is not None: return self._routers if str(_module_dir) not in sys.path: sys.path.insert(0, str(_module_dir)) routers = [] try: from request_app.api.v1.routes import ( health, auth, users, tickets, reference, notifications, emails, settings, notification_templates, ) module_router = APIRouter(prefix="/api/v1/request") module_router.include_router(health.router) module_router.include_router(auth.router, prefix="/auth") module_router.include_router(users.router, prefix="/users") module_router.include_router(tickets.router) module_router.include_router(reference.router) module_router.include_router(notifications.router) module_router.include_router(emails.router) module_router.include_router(settings.router) module_router.include_router(notification_templates.router) routers = [module_router] except Exception as e: import traceback traceback.print_exc() self._routers = routers return self._routers def routers(self) -> List[APIRouter]: return self._load_routers() def permissions(self) -> List[str]: return ["request.read", "request.write", "request.delete"] def static_path(self) -> Optional[Path]: static = self._module_dir / "static" return static if static.exists() else None def templates_path(self) -> Optional[Path]: templates = self._module_dir / "templates" return templates if templates.exists() else None async def startup(self) -> None: pass async def shutdown(self) -> None: pass