feat: add team calendar ICS endpoint and related functionality
All checks were successful
CI / lint-and-test (push) Successful in 23s

- Implemented a new API endpoint to generate an ICS calendar for team duty shifts, accessible via a valid token.
- Enhanced the `calendar_link` command to return both personal and team calendar URLs.
- Added a new function to build the team ICS file, ensuring each event includes the duty holder's name in the description.
- Updated tests to cover the new team calendar functionality, including validation for token formats and response content.
- Revised internationalization messages to reflect the new team calendar links.
This commit is contained in:
2026-02-21 23:41:00 +03:00
parent 0c93fe3372
commit 77a94fa91b
8 changed files with 183 additions and 17 deletions

View File

@@ -15,10 +15,12 @@ MESSAGES: dict[str, dict[str, str]] = {
"help.pin_duty": "/pin_duty — In a group: pin the duty message (bot needs admin with Pin messages)",
"calendar_link.private_only": "The /calendar_link command is only available in private chat.",
"calendar_link.access_denied": "Access denied.",
"calendar_link.success": "Your personal calendar URL:\n{url}",
"calendar_link.success": (
"Personal (your duties only):\n{url_personal}\n\n"
"Team (all duties):\n{url_team}"
),
"calendar_link.help_hint": (
"Subscribe to this URL in Google Calendar, Apple Calendar, or Outlook to "
"see only your duties."
"Subscribe to these URLs in Google Calendar, Apple Calendar, or Outlook."
),
"calendar_link.error": "Could not generate link. Please try again later.",
"help.import_schedule": "/import_duty_schedule — Import duty schedule (JSON)",
@@ -82,8 +84,13 @@ MESSAGES: dict[str, dict[str, str]] = {
"help.pin_duty": "/pin_duty — В группе: закрепить сообщение о дежурстве (нужны права админа у бота)",
"calendar_link.private_only": "Команда /calendar_link доступна только в личке.",
"calendar_link.access_denied": "Доступ запрещён.",
"calendar_link.success": "Ссылка на ваш календарь:\n{url}",
"calendar_link.help_hint": "Подпишитесь на эту ссылку в Google Календаре, Календаре Apple или Outlook, чтобы видеть только свои дежурства.",
"calendar_link.success": (
"Персональный (только ваши дежурства):\n{url_personal}\n\n"
"Общий (все дежурства):\n{url_team}"
),
"calendar_link.help_hint": (
"Подпишитесь на эти ссылки в Google Календаре, Календаре Apple или Outlook."
),
"calendar_link.error": "Не удалось сформировать ссылку. Попробуйте позже.",
"help.import_schedule": "/import_duty_schedule — Импорт расписания дежурств (JSON)",
"help.set_role": "/set_role — Выдать роль пользователю (user | admin)",