Commit Graph
2 Commits
Author SHA1 Message Date
apuc b18e3ea703 Add a Telegram bot client with setup tooling for admin alerts
Bot API client (apps/integration/telegram.py):
- sendMessage, getMe, getUpdates over requests, no extra dependencies
- Telegram API errors are surfaced with the provider description
  ("chat not found", "bot was blocked") instead of a bare HTTP status
- messages longer than the Bot API limit are truncated with a marker

Notifications:
- notifications.py now goes through the client; failures are logged and
  never break the exchange

Setup helpers:
- telegram_check: verifies the token, prints the bot name, sends a test
  message, and suggests chats when chat_id is missing
- telegram_chats: lists chats that wrote to the bot, --apply saves the
  chat_id when exactly one chat is known
- admin action "Detect chat_id from bot messages" does the same in the UI,
  with explicit messages for no chats, many chats and API errors
- admin help text explains the BotFather -> /start -> test flow

Docs: Telegram setup section, command reference and limitations
(4096-char limit, negative chat_id for groups/channels, no internet =
no Telegram).

Tests: 12 new cases for the client, both commands and the admin action;
the suite is 45 passing.
2026-11-22 22:25:13 +03:00
apuc 756f40353b Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF):
- accounts: phone OTP login, JWT, profile, addresses
- catalog: categories, products, images, filters, search, hits/new/related
- orders: creation with Idempotency-Key, stock reservation, status history, cancel
- loyalty: bonus accounts, promo codes, gift certificates
- payments: payment records and YooKassa webhook handling
- content: static pages, banners, site settings
- integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses)
- common: error envelope, pagination, request-id, integration auth, admin dashboard

Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx),
requirements split by environment, OpenAPI contracts for site and 1C, architecture doc.

Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
2026-11-22 21:54:16 +03:00