Add configuration rules, refactor settings management, and enhance import functionality
- Introduced a new configuration file `.cursorrules` to define coding standards, error handling, testing requirements, and project-specific guidelines. - Refactored `config.py` to implement a `Settings` dataclass for better management of environment variables, improving testability and maintainability. - Updated the import duty schedule handler to utilize session management with `session_scope`, ensuring proper database session handling. - Enhanced the import service to streamline the duty schedule import process, improving code organization and readability. - Added new service layer functions to encapsulate business logic related to group duty pinning and duty schedule imports. - Updated README documentation to reflect the new configuration structure and improved import functionality.
This commit is contained in:
27
services/__init__.py
Normal file
27
services/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Service layer: business logic and orchestration.
|
||||
|
||||
Services accept a DB session from the caller (handlers open session_scope and pass session).
|
||||
No Telegram or HTTP dependencies; repository handles persistence.
|
||||
"""
|
||||
|
||||
from services.group_duty_pin_service import (
|
||||
format_duty_message,
|
||||
get_duty_message_text,
|
||||
get_next_shift_end_utc,
|
||||
save_pin,
|
||||
delete_pin,
|
||||
get_message_id,
|
||||
get_all_pin_chat_ids,
|
||||
)
|
||||
from services.import_service import run_import
|
||||
|
||||
__all__ = [
|
||||
"format_duty_message",
|
||||
"get_duty_message_text",
|
||||
"get_next_shift_end_utc",
|
||||
"save_pin",
|
||||
"delete_pin",
|
||||
"get_message_id",
|
||||
"get_all_pin_chat_ids",
|
||||
"run_import",
|
||||
]
|
||||
Reference in New Issue
Block a user