first commit

This commit is contained in:
2026-07-11 23:54:36 +07:00
commit b07562921b
40 changed files with 3813 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
from pathlib import Path
from pydantic import BaseModel, Field
from core.base import TypedTransport
from reporting.models import RenderedReport
class FileTransportConfig(BaseModel):
path: str = Field()
append_extension: bool = Field(True)
class FileTransport(TypedTransport[FileTransportConfig]):
transport_type = "file"
config_model = FileTransportConfig
def publish_typed(self, rendered_report: RenderedReport, transport: FileTransportConfig) -> str:
destination = Path(transport.path)
if transport.append_extension and not destination.suffix:
destination = destination.with_suffix(rendered_report.file_extension)
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(rendered_report.content, encoding="utf-8")
return str(destination)