LiKenun commited on
Commit
5503290
·
1 Parent(s): 6a51bf4

Add incomplete `ApplicationDatabaseService`

Browse files
src/ctp_slack_bot/services/application_database_service.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime
2
+ from loguru import logger
3
+ from pydantic import BaseModel, PrivateAttr
4
+ from typing import Iterable, Mapping, Self
5
+
6
+ from ctp_slack_bot.core import Settings
7
+ from ctp_slack_bot.db import MongoDB
8
+
9
+
10
+ class ApplicationDatabaseService(BaseModel):
11
+ """Service for retrieving and persisting application state."""
12
+
13
+ settings: Settings
14
+ mongo_db: MongoDB # TODO: This should be replaced following the repository pattern―one repository class per collection.
15
+
16
+ class Config:
17
+ frozen=True
18
+
19
+ def __init__(self: Self, **data) -> None:
20
+ super().__init__(**data)
21
+ logger.debug("Created {}", self.__class__.__name__)
22
+
23
+ async def get_last_modification_times_by_file_paths(self: Self, file_paths: Iterable[str]) -> Mapping[str, datetime]:
24
+ """Retrieve the last modification time for each file path."""
25
+ raise NotImplementedError() # TODO
26
+
27
+ async def set_last_modification_time_by_file_path(self: Self, file_path: str, modification_time: datetime) -> None:
28
+ """Set the last modification time for a file path."""
29
+ raise NotImplementedError() # TODO