Commit Graph

25 Commits

Author SHA1 Message Date
5331fac334 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.
2026-02-18 12:35:11 +03:00
8697b9e30b Refactor duty authentication and event type handling
- Introduced a new function `get_authenticated_username` to centralize Mini App authentication logic, improving code readability and maintainability.
- Updated the duty fetching logic to map unknown event types to "duty" for consistent API responses.
- Enhanced the `get_duties` function to include duties starting on the last day of the specified date range.
- Improved session management in the database layer to ensure rollback on exceptions.
- Added tests to validate the new authentication flow and event type handling.
2026-02-18 09:24:51 +03:00
50347038e9 Implement group duty pinning and user phone management
- Added functionality to pin duty messages in group chats, including scheduling updates and handling bot add/remove events.
- Introduced a new `GroupDutyPin` model to store pinned message details and a `phone` field in the `User` model for user contact information.
- Implemented commands for users to set or clear their phone numbers in private chats.
- Enhanced the repository with functions to manage group duty pins and user phone data.
- Updated handlers to register new commands and manage duty pin updates effectively.
2026-02-18 01:00:31 +03:00
5237262dea Implement duty overlap detection and enhance duty list rendering
- Added functions to check if duties overlap with the local day and format dates for display.
- Enhanced the rendering of the duty list to highlight today's duties, including a current duty indicator.
- Introduced a refresh mechanism for today's duties to ensure real-time updates in the calendar view.
- Improved HTML structure for duty items to enhance visual presentation and user interaction.
2026-02-18 00:34:29 +03:00
6c355c4abe Enhance Telegram WebApp integration and update CSS styles
- Added functionality to set background and header colors for the Telegram WebApp to improve visual consistency.
- Updated CSS to hide scrollbars and enhance the overall user experience by preventing overscroll behavior.
- Adjusted box-shadow for the calendar sticky header for a more refined appearance.
2026-02-18 00:13:59 +03:00
eb4fb40423 Add swipe navigation for calendar month view
- Implemented touch event listeners to allow users to swipe left or right on the calendar for month navigation.
- Added a swipe threshold to prevent accidental navigation and ensure smooth user experience.
- Updated CSS to enable touch actions for better responsiveness on touch devices.
2026-02-17 23:54:22 +03:00
1a8ee72b8e Enhance calendar layout and duty list rendering
- Introduced a sticky header for the calendar to improve navigation.
- Updated the duty list display to highlight today's date with a distinct style.
- Added new CSS styles for better visual presentation of duty days and improved layout consistency.
2026-02-17 23:44:43 +03:00
8a7057a23f Update CSS styles for day markers and adjust layout behavior
- Changed the flex-wrap property of day markers from wrap to nowrap for improved layout consistency.
- Standardized the size of duty, unavailable, and vacation markers to 11px, ensuring uniformity in appearance.
- Adjusted font size of markers to 0.55rem for better readability.
2026-02-17 23:39:41 +03:00
e23d2247e0 Refactor calendar rendering and duty list display
- Updated the calendar cell rendering to conditionally show duty and event markers based on the month view.
- Introduced a new HTML structure for day markers to improve layout and styling.
- Enhanced the duty list rendering to filter duties based on the current month, ensuring only relevant duties are displayed.
- Added CSS styles for day markers to improve visual presentation and alignment.
2026-02-17 23:26:41 +03:00
3f4c7bf66c Implement date range handling for vacation and unavailable events
- Added helper functions to generate ISO 8601 formatted start and end times for calendar days.
- Introduced logic to merge consecutive vacation dates into a single record for improved data representation.
- Updated the duty schedule import process to utilize the new date handling functions for unavailable and vacation events.
- Enhanced integration tests to validate the correct handling of vacation periods and unavailable dates.
- Modified the web application to display formatted date ranges for vacation and unavailable events.
2026-02-17 23:06:23 +03:00
7a963eccd1 Add event type handling for duties in the system
- Introduced a new `event_type` column in the `duties` table to categorize duties as 'duty', 'unavailable', or 'vacation'.
- Updated the duty schedule import functionality to parse and store event types from the JSON input.
- Enhanced the API response to include event types for each duty, improving the calendar display logic.
- Modified the web application to visually differentiate between duty types in the calendar and duty list.
- Updated tests to cover new event type functionality and ensure correct parsing and storage of duties.
- Revised README documentation to reflect changes in duty event types and their representation in the system.
2026-02-17 23:01:07 +03:00
78a1696a69 Enhance calendar duty display and tooltip functionality
- Updated the calendar rendering to use a duty marker with improved accessibility attributes for duty names and titles.
- Introduced a new function `bindDutyMarkerTooltips` to display tooltips with duty names on hover over duty markers.
- Enhanced CSS styles for duty markers to improve visibility and user interaction.
- Ensured tooltips are dynamically positioned and hidden appropriately to enhance user experience.
2026-02-17 22:47:06 +03:00
ef5dbca5df Implement duty schedule import functionality and enhance user management
- Added a new command `/import_duty_schedule` for importing duty schedules via JSON, restricted to admin users.
- Introduced a two-step import process: specifying handover time and uploading a JSON file.
- Updated the database schema to allow `telegram_user_id` to be nullable for user creation by full name.
- Implemented repository functions for user management, including `get_or_create_user_by_full_name` and `delete_duties_in_range`.
- Enhanced README documentation with details on the new import command and JSON format requirements.
- Added comprehensive tests for the duty schedule parser and integration tests for the import functionality.
2026-02-17 21:45:23 +03:00
120d609b2e Enhance tooltip positioning and styling for calendar events
- Introduced a new function `positionHint` to dynamically position the event hint tooltip based on button location and viewport constraints.
- Updated tooltip CSS to allow for responsive width and added a new style for tooltips positioned below the button.
- Improved tooltip visibility logic to ensure it remains within the viewport while providing a better user experience.
2026-02-17 21:10:40 +03:00
bf9fc59a3f Implement external calendar integration and enhance API functionality
- Added support for fetching and parsing external ICS calendars, allowing events to be displayed on the duty grid.
- Introduced a new API endpoint `/api/calendar-events` to retrieve calendar events within a specified date range.
- Updated configuration to include `EXTERNAL_CALENDAR_ICS_URL` for specifying the ICS calendar URL.
- Enhanced the web application to visually indicate days with events and provide event summaries on hover.
- Improved documentation in the README to include details about the new calendar integration and configuration options.
- Updated tests to cover the new calendar functionality and ensure proper integration.
2026-02-17 20:58:59 +03:00
4e6756025d Enhance database initialization and improve command handling
- Added `__all__` declaration in `db/__init__.py` for better module export management.
- Simplified command text formatting in `handlers/commands.py` for improved readability.
- Refactored error handler function signature in `handlers/errors.py` for better code style.
- Introduced comprehensive tests for API duties and Telegram authentication in new test files.
2026-02-17 20:05:49 +03:00
5cfc699c3d Refactor Telegram bot and web application for improved functionality
- Disabled the default menu button in the Telegram bot, allowing users to access the app via a direct link.
- Updated the initData validation process to ensure URL-decoded values are used in the data-check string.
- Enhanced error handling in the web application to provide more informative access denial messages.
- Removed unnecessary debug information from the access denied section in the web app.
- Cleaned up the web application code by removing unused functions and improving CSS styles for hidden elements.
2026-02-17 19:50:08 +03:00
dd960dc5cc Enhance Telegram bot functionality and improve error handling
- Introduced a new function to set the default menu button for the Telegram bot's Web App.
- Updated the initData validation process to provide detailed error messages for authorization failures.
- Refactored the validate_init_data function to return both username and reason for validation failure.
- Enhanced the web application to handle access denial more gracefully, providing users with hints on how to access the calendar.
- Improved the README with additional instructions for configuring the bot's menu button and Web App URL.
- Updated tests to reflect changes in the validation process and error handling.
2026-02-17 19:08:14 +03:00
1948618394 Refactor configuration and enhance Telegram initData validation
- Improved formatting and readability in config.py and other files by adding line breaks.
- Introduced INIT_DATA_MAX_AGE_SECONDS to enforce replay protection for Telegram initData.
- Updated validate_init_data function to include max_age_seconds parameter for validation.
- Enhanced API to reject old initData based on the new max_age_seconds setting.
- Added tests for auth_date expiry and validation of initData in test_telegram_auth.py.
- Updated README with details on the new INIT_DATA_MAX_AGE_SECONDS configuration.
2026-02-17 17:31:20 +03:00
d20a285f09 Stop tracking duty_teller.db 2026-02-17 17:24:08 +03:00
5dc8c8f255 Enhance API and configuration for Telegram miniapp
- Added support for CORS origins and a new environment variable for miniapp access control.
- Implemented date validation for API requests to ensure correct date formats.
- Updated FastAPI app to allow access without Telegram initData for local development.
- Enhanced error handling and logging for better debugging.
- Added tests for API functionality and Telegram initData validation.
- Updated README with new environment variable details and testing instructions.
- Modified Docker and Git ignore files to include additional directories and files.
2026-02-17 17:21:35 +03:00
7cdf1edc34 Enhance API access control and update Docker configuration
- Added port mapping to docker-compose for local development.
- Modified the API to allow access from localhost without Telegram initData for local development.
- Updated the web application to check for localhost before denying access based on initData.
2026-02-17 14:15:06 +03:00
57c24a79af Update configuration and access control for Telegram miniapp
- Added ALLOWED_USERNAMES and ADMIN_USERNAMES to .env.example for user access control.
- Implemented validation of Telegram Web App initData in a new telegram_auth.py module.
- Enhanced API to check user access before fetching duties.
- Updated README with instructions for configuring miniapp access.
- Modified .dockerignore and .gitignore to include data directory and database files.
2026-02-17 13:10:45 +03:00
d60a4fdf3f Enhance Telegram bot with database integration and API features
- Added SQLite database support with Alembic for migrations.
- Implemented FastAPI for HTTP API to manage duties.
- Updated configuration to include database URL and HTTP port.
- Created entrypoint script for Docker to handle migrations and permissions.
- Expanded command handlers to register users and display duties.
- Developed a web application for calendar display of duties.
- Included necessary Pydantic schemas and SQLAlchemy models for data handling.
- Updated requirements.txt to include new dependencies for FastAPI and SQLAlchemy.
2026-02-17 12:51:01 +03:00
d90d3d1177 Add initial project structure for Telegram bot
- Created Docker configuration files for development and production.
- Added Dockerfile for building the bot image.
- Implemented configuration loading from environment variables.
- Developed main application logic and command handlers.
- Included README with setup instructions and usage details.
- Added .gitignore and .dockerignore files to exclude unnecessary files.
- Provided example environment file (.env.example) for bot token configuration.
- Established basic error handling for the bot.
2026-02-17 12:16:47 +03:00