feat: Evotor + VK catalog sync, connections, and store/group filters
- Evotor catalog: background Celery task syncing stores/groups/products from Evotor API; UI pages with per-store and per-group sync toggles - VK connection: manual token + group ID entry with inline test button - Evotor connection: inline test button (calls /stores) - VK catalog: background task syncing VK Market albums and products; separate catalog UI at /vk-catalog/albums - SyncFilter extended to support entity_type=group with parent_entity_id - Migration 0004: vk_cached_albums + vk_cached_products tables - Beat schedule updated to run both refresh_catalog and refresh_vk_catalog - README updated with new schema, routes, tasks, and config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
56
web/migrations/versions/0004_vk_catalog_tables.py
Normal file
56
web/migrations/versions/0004_vk_catalog_tables.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""VK catalog tables (albums + products)
|
||||
|
||||
Revision ID: 0004
|
||||
Revises: 0003
|
||||
Create Date: 2026-05-01
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0004"
|
||||
down_revision: Union[str, None] = "0003"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"vk_cached_albums",
|
||||
sa.Column("id", sa.Integer, primary_key=True, autoincrement=True),
|
||||
sa.Column("user_id", sa.Integer, sa.ForeignKey("users.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("vk_group_id", sa.String(50), nullable=False),
|
||||
sa.Column("album_id", sa.String(50), nullable=False),
|
||||
sa.Column("title", sa.String(255), nullable=False),
|
||||
sa.Column("count", sa.Integer, nullable=True),
|
||||
sa.Column("fetched_at", sa.DateTime, nullable=False),
|
||||
sa.UniqueConstraint("user_id", "vk_group_id", "album_id", name="uq_vk_cached_albums"),
|
||||
)
|
||||
op.create_index("ix_vk_cached_albums_user_group", "vk_cached_albums", ["user_id", "vk_group_id"])
|
||||
|
||||
op.create_table(
|
||||
"vk_cached_products",
|
||||
sa.Column("id", sa.Integer, primary_key=True, autoincrement=True),
|
||||
sa.Column("user_id", sa.Integer, sa.ForeignKey("users.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("vk_group_id", sa.String(50), nullable=False),
|
||||
sa.Column("vk_product_id", sa.String(50), nullable=False),
|
||||
sa.Column("album_id", sa.String(50), nullable=True),
|
||||
sa.Column("name", sa.String(255), nullable=False),
|
||||
sa.Column("description", sa.Text, nullable=True),
|
||||
sa.Column("price", sa.Numeric(12, 2), nullable=True),
|
||||
sa.Column("availability", sa.Integer, nullable=True),
|
||||
sa.Column("thumb_url", sa.String(1024), nullable=True),
|
||||
sa.Column("fetched_at", sa.DateTime, nullable=False),
|
||||
sa.UniqueConstraint("user_id", "vk_group_id", "vk_product_id", name="uq_vk_cached_products"),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_vk_cached_products_user_group_album",
|
||||
"vk_cached_products", ["user_id", "vk_group_id", "album_id"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("vk_cached_products")
|
||||
op.drop_table("vk_cached_albums")
|
||||
Reference in New Issue
Block a user