File size: 1,114 Bytes
5503290
 
bb7c9a3
5503290
 
bb7c9a3
5503290
 
 
bb7c9a3
5503290
 
bb7c9a3
 
5503290
 
 
 
 
 
 
 
 
 
bb7c9a3
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"