Files
MapMil/centers/analytics/api/app/seed.py
T
gitrusprusandCursor 1d6d54ab9f Refactor map tools and drop SocialParser runtime dependency.
Add filtered map API, creamy-caprice-style toolbar (dates, layers, search), Yandex ru tiles, and store Telegram session in MapMil/data instead of mounting SocialParser.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 20:56:30 +03:00

27 lines
703 B
Python

import os
from sqlalchemy.orm import Session
from .models import Consumer, ConsumerFilter
from .services.filtering import hash_api_key
def seed_objects(db: Session) -> None:
"""No demo map objects — map shows ingested events only."""
def seed_test_consumer(db: Session) -> None:
if db.query(Consumer).filter(Consumer.name == "test-pi").first():
return
api_key = os.getenv("TEST_PI_API_KEY", "test-pi-api-key-change-me")
consumer = Consumer(
name="test-pi",
api_key_hash=hash_api_key(api_key),
is_active=True,
)
db.add(consumer)
db.flush()
db.add(ConsumerFilter(consumer_id=consumer.id, regions=None, topics=None))
db.commit()