1
0

Store posting results to a mongodb

This commit is contained in:
2026-03-30 12:23:13 +02:00
parent d800d9b7be
commit fb19145e8c
13 changed files with 331 additions and 9 deletions

View File

@@ -1,11 +1,12 @@
from __future__ import annotations
from content_automation.adapters.publish_store.mongodb import MongoPublishedContentStore
from content_automation.adapters.social.instagram import InstagramAdapter
from content_automation.adapters.social.youtube import YouTubeAdapter
from content_automation.adapters.storage.base import StorageAdapterBase
from content_automation.adapters.storage.local import LocalFilesystemStorageAdapter
from content_automation.adapters.storage.s3 import S3StorageAdapter
from content_automation.interfaces import SocialNetworkAdapter
from content_automation.interfaces import PublishedContentStore, SocialNetworkAdapter
from content_automation.settings import AppSettings
@@ -49,3 +50,22 @@ def build_social_adapters(settings: AppSettings) -> dict[str, SocialNetworkAdapt
expiry=settings.youtube.expiry or None,
),
}
def build_published_content_store(
settings: AppSettings,
) -> PublishedContentStore | None:
if not settings.mongodb.enabled:
return None
if not settings.mongodb.connection_uri:
raise ValueError(
"CONTENT_AUTOMATION_MONGODB__CONNECTION_URI must be set when "
"MongoDB persistence is enabled."
)
return MongoPublishedContentStore(
connection_uri=settings.mongodb.connection_uri,
database_name=settings.mongodb.database_name,
collection_name=settings.mongodb.collection_name,
)