From 7ebe631f9fcd70a6bb0ce0d0743f3a5bc16413a6 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Tue, 20 Aug 2024 22:57:06 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D0=B5=D1=82=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=B1=D0=BB=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message_db_logger/__init__.py | 35 ---------- .../message_db_logger/db/__init__.py | 1 - .../message_db_logger/db/piccolo_app.py | 20 ------ .../db/piccolo_migrations/__init__.py | 0 ...ge_db_logger_2024_08_20t10_53_55_083110.py | 67 ------------------- ...ge_db_logger_2024_08_20t11_05_48_151041.py | 38 ----------- .../message_db_logger/db/tables.py | 8 --- .../experimental/message_db_logger/info.json | 14 ---- 8 files changed, 183 deletions(-) delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/__init__.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/__init__.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_app.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/__init__.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t10_53_55_083110.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t11_05_48_151041.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/tables.py delete mode 100644 src/karkas_blocks/karkas_blocks/experimental/message_db_logger/info.json diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/__init__.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/__init__.py deleted file mode 100644 index 8af4508..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -from aiogram import F, Router -from aiogram.types import Message - -from karkas_core.modules_system.public_api import get_module, register_router - -from .db.tables import MessageLogger - - -async def log_to_db(message: Message): - await MessageLogger.insert( - MessageLogger( - message_text=message.text, - chat_id=message.chat.id, - user_id=message.from_user.id, - ) - ) - - pass - - -def module_init(): - from .db import APP_CONFIG - - register_app_config = get_module("experimental.database", "register_app_config") - register_app_config(APP_CONFIG) - - router = Router() - - router.message.register(log_to_db, F.text) - - register_router(router) - - -def module_late_init(): - pass diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/__init__.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/__init__.py deleted file mode 100644 index e3e4a0b..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .piccolo_app import APP_CONFIG diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_app.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_app.py deleted file mode 100644 index d10c736..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_app.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -Import all of the Tables subclasses in your app here, and register them with -the APP_CONFIG. -""" - -import os - -from karkas_piccolo.conf.apps import AppConfig - -from .tables import MessageLogger - -CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) - -APP_CONFIG = AppConfig( - app_name="experimental.message_db_logger", - migrations_folder_path=os.path.join(CURRENT_DIRECTORY, "piccolo_migrations"), - table_classes=[MessageLogger], - migration_dependencies=[], - commands=[], -) diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/__init__.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t10_53_55_083110.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t10_53_55_083110.py deleted file mode 100644 index ba59238..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t10_53_55_083110.py +++ /dev/null @@ -1,67 +0,0 @@ -from piccolo.apps.migrations.auto.migration_manager import MigrationManager -from piccolo.columns.column_types import Integer, Varchar -from piccolo.columns.indexes import IndexMethod - -ID = "2024-08-20T10:53:55:083110" -VERSION = "1.16.0" -DESCRIPTION = "" - - -async def forwards(): - manager = MigrationManager( - migration_id=ID, - app_name="experimental.message_db_logger", - description=DESCRIPTION, - ) - - manager.add_table( - class_name="MessageLogger", - tablename="message_logger", - schema=None, - columns=None, - ) - - manager.add_column( - table_class_name="MessageLogger", - tablename="message_logger", - column_name="message_text", - db_column_name="message_text", - column_class_name="Varchar", - column_class=Varchar, - params={ - "length": 255, - "default": "", - "null": False, - "primary_key": False, - "unique": False, - "index": False, - "index_method": IndexMethod.btree, - "choices": None, - "db_column_name": None, - "secret": False, - }, - schema=None, - ) - - manager.add_column( - table_class_name="MessageLogger", - tablename="message_logger", - column_name="chat_id", - db_column_name="chat_id", - column_class_name="Integer", - column_class=Integer, - params={ - "default": 0, - "null": False, - "primary_key": False, - "unique": False, - "index": False, - "index_method": IndexMethod.btree, - "choices": None, - "db_column_name": None, - "secret": False, - }, - schema=None, - ) - - return manager diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t11_05_48_151041.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t11_05_48_151041.py deleted file mode 100644 index 2018059..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/piccolo_migrations/experimentalmessage_db_logger_2024_08_20t11_05_48_151041.py +++ /dev/null @@ -1,38 +0,0 @@ -from piccolo.apps.migrations.auto.migration_manager import MigrationManager -from piccolo.columns.column_types import Integer -from piccolo.columns.indexes import IndexMethod - -ID = "2024-08-20T11:05:48:151041" -VERSION = "1.16.0" -DESCRIPTION = "" - - -async def forwards(): - manager = MigrationManager( - migration_id=ID, - app_name="experimental.message_db_logger", - description=DESCRIPTION, - ) - - manager.add_column( - table_class_name="MessageLogger", - tablename="message_logger", - column_name="user_id", - db_column_name="user_id", - column_class_name="Integer", - column_class=Integer, - params={ - "default": 0, - "null": False, - "primary_key": False, - "unique": False, - "index": False, - "index_method": IndexMethod.btree, - "choices": None, - "db_column_name": None, - "secret": False, - }, - schema=None, - ) - - return manager diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/tables.py b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/tables.py deleted file mode 100644 index 1e22ee0..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/db/tables.py +++ /dev/null @@ -1,8 +0,0 @@ -from piccolo.columns import Integer, Varchar -from piccolo.table import Table - - -class MessageLogger(Table): - message_text = Varchar() - chat_id = Integer() - user_id = Integer() diff --git a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/info.json b/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/info.json deleted file mode 100644 index 26655fe..0000000 --- a/src/karkas_blocks/karkas_blocks/experimental/message_db_logger/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "experimental.message_db_logger", - "name": "Roles", - "description": "Модуль для работы с БД", - "author": "Karkas Team", - "version": "1.0.0", - "privileged": true, - "dependencies": {}, - "pythonDependencies": { - "required": { - "karkas_piccolo": "*" - } - } -}