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/Waybill/model.py

23 lines
794 B
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 .db.sql_provider import SQLProvider
from .db.work import select_list
from flask import current_app
from dataclasses import dataclass
import os
@dataclass
class InfoRespronse:
result: tuple
error_message: str
status: bool
sql_provider = SQLProvider(os.path.join(os.path.dirname(__file__), 'sql'))
def waybill_model() -> InfoRespronse:
_sql = sql_provider.get('goods.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)