Рефакторинг структуры проекта: перемещение функций и логики работы с базой данных в новый файл helpers_bff.py. Обновлены импорты в fill_db.py и main.py для использования новых функций. Удалены устаревшие функции и классы из main.py, улучшена организация кода.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import random
|
||||
from uuid import uuid4
|
||||
from sqlmodel import Session
|
||||
from main import AUTH_DB_ENGINE, TgAgent, Ref, Sale, Account, Company, AgentTransaction, PartnerTransaction, CompanyBalance, AgentBalance
|
||||
from sql_models import TgAgent, Ref, Sale, Account, Company, AgentTransaction, PartnerTransaction, CompanyBalance, AgentBalance
|
||||
from sqlalchemy import text
|
||||
from datetime import datetime, timedelta
|
||||
from hashlib import sha256
|
||||
from passlib.context import CryptContext
|
||||
from helpers_bff import AUTH_DB_ENGINE, get_password_hash
|
||||
|
||||
|
||||
# Константа: список user_ids
|
||||
@@ -63,11 +63,6 @@ LOGINS = [
|
||||
ALL_DESCRIPTIONS = DESCRIPTIONS
|
||||
|
||||
# ---
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
|
||||
def get_password_hash(password):
|
||||
return pwd_context.hash(password)
|
||||
|
||||
def get_date_list(days=7):
|
||||
today = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
return [today - timedelta(days=i) for i in range(days, -1, -1)]
|
||||
|
||||
Reference in New Issue
Block a user