This repository has been archived on 2025-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
RIS/App/Requests/requests_model.py
2024-11-14 15:13:57 +03:00

31 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from dataclasses import dataclass
from db.select import select_list
from db.sql_provider import SQLProvider
from flask import current_app
from os import path
sql_provider = SQLProvider(path.join(path.dirname(__file__), 'sql'))
@dataclass
class InfoRespronse:
result: tuple
error_message: str
status: bool
def sklad(input_data) -> InfoRespronse:
_sql = sql_provider.get('sklad_material.sql', input_data)
print("sql = ", _sql)
result = select_list(current_app.config['db_config'], _sql)
if result is None:
return InfoRespronse((),
error_message = 'Ошибка в подключении к базе данных. Свяжитесь с администратором',
status=False)
return InfoRespronse(result, error_message='', status=True)
def materials_per_seller(input_data) -> InfoRespronse:
_sql = sql_provider.get('ship_seller.sql', input_data)
result = select_list(current_app.config['db_config'], _sql)
if result is None:
return InfoRespronse((),
error_message = 'Ошибка в подключении к базе данных. Свяжитесь с администратором',
status=False)
return InfoRespronse(result, error_message='', status=True)