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:
mguschin
2026-05-01 18:09:11 +03:00
parent 7a06045bef
commit 796cf49ff9
18 changed files with 1716 additions and 47 deletions

View File

@@ -81,6 +81,44 @@ class SyncFilter(Base):
)
class VkCachedAlbum(Base):
__tablename__ = "vk_cached_albums"
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
vk_group_id = Column(String(50), nullable=False)
album_id = Column(String(50), nullable=False)
title = Column(String(255), nullable=False)
count = Column(Integer, nullable=True)
fetched_at = Column(DateTime, nullable=False)
__table_args__ = (
UniqueConstraint("user_id", "vk_group_id", "album_id", name="uq_vk_cached_albums"),
Index("ix_vk_cached_albums_user_group", "user_id", "vk_group_id"),
)
class VkCachedProduct(Base):
__tablename__ = "vk_cached_products"
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
vk_group_id = Column(String(50), nullable=False)
vk_product_id = Column(String(50), nullable=False)
album_id = Column(String(50), nullable=True)
name = Column(String(255), nullable=False)
description = Column(Text, nullable=True)
price = Column(Numeric(12, 2), nullable=True)
availability = Column(Integer, nullable=True)
thumb_url = Column(String(1024), nullable=True)
fetched_at = Column(DateTime, nullable=False)
__table_args__ = (
UniqueConstraint("user_id", "vk_group_id", "vk_product_id", name="uq_vk_cached_products"),
Index("ix_vk_cached_products_user_group_album", "user_id", "vk_group_id", "album_id"),
)
class CachedStore(Base):
__tablename__ = "cached_stores"