Unify parsing workers, analytics API with PostgreSQL, map UI, and PI distribution into centers/ with Docker Compose. Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
from sqlalchemy.orm import Session
|
|
|
|
from .models import MapObject
|
|
|
|
from datetime import datetime, timezone
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
from .models import MapObject
|
|
|
|
SEED_OBJECTS = [
|
|
{
|
|
"name": "Красная площадь",
|
|
"description": "Главная площадь Москвы, исторический центр города.",
|
|
"type": "marker",
|
|
"latitude": 55.7539,
|
|
"longitude": 37.6208,
|
|
"created_at": datetime(2018, 5, 9, 12, 0, tzinfo=timezone.utc),
|
|
},
|
|
{
|
|
"name": "ВДНХ",
|
|
"description": "Выставка достижений народного хозяйства — крупный выставочный комплекс.",
|
|
"type": "zone",
|
|
"latitude": 55.8298,
|
|
"longitude": 37.6361,
|
|
"created_at": datetime(2020, 8, 15, 10, 30, tzinfo=timezone.utc),
|
|
},
|
|
{
|
|
"name": "МГУ",
|
|
"description": "Московский государственный университет имени М.В. Ломоносова.",
|
|
"type": "point",
|
|
"latitude": 55.7033,
|
|
"longitude": 37.5307,
|
|
"created_at": datetime(2022, 2, 12, 14, 0, tzinfo=timezone.utc),
|
|
},
|
|
{
|
|
"name": "Парк Горького",
|
|
"description": "Центральный парк культуры и отдыха имени М. Горького.",
|
|
"type": "other",
|
|
"latitude": 55.7312,
|
|
"longitude": 37.6013,
|
|
"created_at": datetime(2024, 6, 1, 9, 0, tzinfo=timezone.utc),
|
|
},
|
|
]
|
|
|
|
|
|
def seed_objects(db: Session) -> None:
|
|
if db.query(MapObject).count() > 0:
|
|
return
|
|
|
|
for item in SEED_OBJECTS:
|
|
db.add(MapObject(**item))
|
|
|
|
db.commit()
|