9 lines
401 B
Python
9 lines
401 B
Python
from .domain.models import Document, IngestionResult
|
|
from .ports import PublicationPort
|
|
from .governance import authorize
|
|
from .settings import Settings
|
|
|
|
def publish_document(document: Document, publisher: PublicationPort, settings: Settings) -> IngestionResult:
|
|
ok, reason = authorize(document, settings)
|
|
return publisher.publish(document) if ok else IngestionResult(False, document, reason)
|