From dbe428e6e0c6408d179617743435c86c15b288f6 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 28 Oct 2023 15:21:47 +0300 Subject: [PATCH] Fix route --- apps/py-categories-service/main.py | 5 ++++- apps/py-categories-service/main2.py | 0 .../db/migrations/versions/3c651a0d1fe0_initial.py | 13 ++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 apps/py-categories-service/main2.py diff --git a/apps/py-categories-service/main.py b/apps/py-categories-service/main.py index ddb4111..79c623d 100644 --- a/apps/py-categories-service/main.py +++ b/apps/py-categories-service/main.py @@ -2,10 +2,13 @@ import asyncio from websockets.server import serve + + + async def handler(websocket): async for message in websocket: print('recv msg', message) - # await websocket.recv(message) + async def main(): diff --git a/apps/py-categories-service/main2.py b/apps/py-categories-service/main2.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/py-conveyor-service/db/migrations/versions/3c651a0d1fe0_initial.py b/apps/py-conveyor-service/db/migrations/versions/3c651a0d1fe0_initial.py index 25b0a8d..5199c56 100644 --- a/apps/py-conveyor-service/db/migrations/versions/3c651a0d1fe0_initial.py +++ b/apps/py-conveyor-service/db/migrations/versions/3c651a0d1fe0_initial.py @@ -49,14 +49,13 @@ def upgrade(): sa.UniqueConstraint('id', name=op.f('uq_conveer_id')) ) op.execute('''INSERT INTO camera(id,order_numb, camera_type) VALUES (1,1, 'По умолчанию')''') - for i in range(0, 12): - import random - from datetime import datetime, timedelta + import random + from datetime import datetime, timedelta - for _ in range(0, 100): - random_date = datetime.now() - timedelta(days=random.randint(1, 365)) # Генерация случайной даты за последний год - op.execute(f'''INSERT INTO conveer (metal, glass, plastic, wood, camera_id, created_at) - VALUES (floor(random() * 20 + 1), floor(random() * 10 + 1), floor(random() * 15 + 1), floor(random() * 30 + 1), 1,'{random_date}');''') + for _ in range(0, 100): + random_date = datetime.now() - timedelta(days=random.randint(1, 365)) # Генерация случайной даты за последний год + op.execute(f'''INSERT INTO conveer (metal, glass, plastic, wood, camera_id, created_at) + VALUES (floor(random() * 20 + 1), floor(random() * 10 + 1), floor(random() * 15 + 1), floor(random() * 30 + 1), 1,'{random_date}');''') def downgrade():