Skip to content

Changelog

Changelog

TG-043 — Person Pass QR Verification (Mini App)

  • Telegram Mini App apps/verify: security scans a person pass QR with the camera
  • Public Web API POST /miniapp/person-passes/verify-qr with Telegram initData auth (HMAC-SHA256)
  • The QR carries only the pass identifier pp_<token>; the DB stores only a SHA-256 hash (person_passes.qr_token_hash, migration)
  • A QR image is sent to the creator on creation; the “🔁 QR” button regenerates it (the old code is invalidated instantly), including in /my_passes
  • Internal API: POST /internal/person-passes/:id/qr, GET /internal/person-passes/mine
  • Rate limit: 30/min per user, 60/min per IP (Redis in prod, in-memory on stage)
  • CORS allowlist (MINIAPP_ORIGIN) and security headers for /miniapp/*
  • Bot menu button setChatMenuButton (“🔍 Проверка QR”) for guard/admin/super_admin
  • Audit person_pass.verified with method="qr" without the name (152-FZ)

TG-041 — Person Passes (guests, staff, contractors)

  • New kind of passes for people (not vehicles): categories guest / staff / contractor
  • Types: one_time (burned on first entry), temporary, permanent
  • /person_pass command — creation (resident → guest only, admin → all categories)
  • /verify_person command — verification by 6-digit code (primary) or name search (fallback)
  • Name-based burn — inline “Confirm entry” button in search results
  • Internal API: POST /internal/person-passes, GET /verify, GET /search, POST /:id/cancel
  • Audit: person_pass.created / person_pass.verified / person_pass.cancelled
  • person_passes table + migration, partial UNIQUE on the active code

v0.2.0 — Monitoring & Data Export

Implemented in tasks TG-027 — TG-031

Observability (TG-027)

  • @terma/observability package — OpenTelemetry SDK for all services
  • Auto-instrumentation HTTP (@opentelemetry/instrumentation-http)
  • PrometheusExporter — metrics on port 9090 (api) / 9091 (bot)
  • OTLPTraceExporter — traces to Jaeger
  • Grafana dashboards (auto-provisioned, 6 panels)
  • /api/health with OTel status (initialized, tracer, meter)
  • Structured JSON logs (pino) with traceId / spanId
  • Jaeger: OTLP HTTP (port 4318), UI (port 16686)

Trace Propagation (TG-029)

  • W3C Trace Context (traceparent) on every HTTP call
  • Bot → API: createApiClient with automatic propagation.inject()
  • Manual spans for Grammy commands: withSpan("grammy.command.{name}", ...)
  • Filter traces by error=true and http.status_code>=500

Metric Instruments (TG-030)

  • http.server.duration — latency histogram (ms), p50/p95/p99
  • http.server.request_count — request counter by route/status
  • process.memory.usage — memory consumption
  • process.cpu.utilization — CPU load
  • Grafana dashboard with tabs: metrics, tracing, logs
  • Last 5xx Errors with clickable traceId links to Jaeger

CSV Export/Import (TG-031)

  • /export_passes — export all passes to CSV
  • /export_blacklist — export blacklist to CSV
  • /export_period — export passes for a date range (CSV)
  • /import_passes — import passes from CSV

v1.0.0 — Initial Release

Implemented in tasks TG-001 — TG-007

Foundation (TG-001, TG-002)

  • Turborepo + pnpm monorepo
  • Fastify REST API (TypeScript)
  • PostgreSQL + Drizzle ORM, Redis
  • Grammy Telegram Bot
  • Astro Starlight documentation

User & Role Management (TG-003)

  • /start, /menu commands
  • Invite system: /invite_resident, /invite_guard, /invite_admin
  • Deep-link role activation: https://t.me/bot?start=inv_<token>
  • /requests — view active invitations
  • Roles: user, resident, guard, admin

Pass Management (TG-005)

  • /pass_create — create pass (permanent / one-time / temporary)
    • Vehicle types: car, truck, special
    • Russian and foreign plate support
    • Blacklist check on creation
  • /my_passes — resident’s active passes list
  • /pass_cancel — cancel pass (via inline buttons)
  • /verify_pass — guard pass verification

Blacklist (TG-006)

  • /block_car — block vehicle with photo and reason
    • Automatic cancellation of all passes for the plate
    • Pass owner Telegram notification
  • /check_block — check plate blacklist status
  • /unblock_car — unblock vehicle (admin only)

Documentation & Mini App (TG-007)

  • Full user documentation RU/EN
  • /miniapp command → opens docs as Telegram Mini App
  • Mermaid flow diagrams
  • Multilingual search (Pagefind)
  • Docker docs service on nginx (port 4321)