Add CRM order queue: live sync, view modal, receipt tabs, delete
Wires the CRM (exoCRM GetOrders) into the dashboard as a locally persisted order queue instead of the previous static mockup: - CrmClient Protocol + ExoCrmClient/StubCrmClient for the CRM's signed JSON-RPC API - Order model + migration, synced from CRM on each queue view; soft-deleted orders stay hidden across re-syncs - GET/DELETE /api/v1/orders with "no receipt"/"receipt issued" tabs (the latter is empty until Checkbox fiscalization lands) - Dashboard: real order list, item-detail modal, tab switcher, one-click delete Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""Локальная копия заказов, синхронизированная из CRM
|
||||
|
||||
Revision ID: 0002
|
||||
Revises: 0001
|
||||
Create Date: 2026-09-22
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision: str = "0002"
|
||||
down_revision: str | None = "0001"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"orders",
|
||||
sa.Column("id", sa.String(length=32), nullable=False),
|
||||
sa.Column("create_date_time", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("recipient_name", sa.String(length=255), nullable=True),
|
||||
sa.Column("recipient_phone", sa.String(length=32), nullable=True),
|
||||
sa.Column("recipient_email", sa.String(length=320), nullable=True),
|
||||
sa.Column("waybill_number", sa.String(length=64), nullable=True),
|
||||
sa.Column("notes", sa.Text(), nullable=True),
|
||||
sa.Column("total_amount_kopecks", sa.BigInteger(), nullable=False),
|
||||
sa.Column("goods", postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column("is_deleted", sa.Boolean(), nullable=False),
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("receipt_created_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_orders")),
|
||||
)
|
||||
op.create_index(op.f("ix_orders_is_deleted"), "orders", ["is_deleted"])
|
||||
op.create_index(op.f("ix_orders_receipt_created_at"), "orders", ["receipt_created_at"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("orders")
|
||||
Reference in New Issue
Block a user