ctp-slack-bot / src /ctp_slack_bot /services /application_database_service.py
LiKenun's picture
Refactor #3
bb7c9a3
from datetime import datetime
from loguru import logger
from pydantic import ConfigDict
from typing import Iterable, Mapping, Self
from ctp_slack_bot.core import ApplicationComponentBase, Settings
from ctp_slack_bot.db import MongoDB
class ApplicationDatabaseService(ApplicationComponentBase):
"""Service for retrieving and persisting application state."""
model_config = ConfigDict(frozen=True)
settings: Settings
mongo_db: MongoDB # TODO: This should be replaced following the repository pattern―one repository class per collection.
async def get_last_modification_times_by_file_paths(self: Self, file_paths: Iterable[str]) -> Mapping[str, datetime]:
"""Retrieve the last modification time for each file path."""
raise NotImplementedError() # TODO
async def set_last_modification_time_by_file_path(self: Self, file_path: str, modification_time: datetime) -> None:
"""Set the last modification time for a file path."""
raise NotImplementedError() # TODO
@property
def name(self: Self) -> str:
return "application_database_service"