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:
2026-02-18 12:35:11 +03:00
parent 8697b9e30b
commit 5331fac334
25 changed files with 1032 additions and 397 deletions

24
utils/__init__.py Normal file
View File

@@ -0,0 +1,24 @@
"""Shared utilities: date/ISO helpers, user display names, handover time parsing.
Used by handlers, API, and services. No DB or Telegram dependencies.
"""
from utils.dates import (
day_end_iso,
day_start_iso,
duty_to_iso,
parse_iso_date,
validate_date_range,
)
from utils.user import build_full_name
from utils.handover import parse_handover_time
__all__ = [
"day_start_iso",
"day_end_iso",
"duty_to_iso",
"parse_iso_date",
"validate_date_range",
"build_full_name",
"parse_handover_time",
]