Compare commits
No commits in common. "9690db982e4e97dbe695493ace02590be9d29541" and "b0599c14841fd881379cfd0a5d10f87a241bf4b7" have entirely different histories.
9690db982e
...
b0599c1484
@ -23,7 +23,7 @@ class _Accounts(pydantic.BaseModel):
|
|||||||
|
|
||||||
def _accounts_list_to_json(accounts: Iterator[tuple[str, str, str]]) -> str:
|
def _accounts_list_to_json(accounts: Iterator[tuple[str, str, str]]) -> str:
|
||||||
accounts = _Accounts(accounts=[_Account.from_tuple(i) for i in accounts])
|
accounts = _Accounts(accounts=[_Account.from_tuple(i) for i in accounts])
|
||||||
return accounts.json(ensure_ascii=False)
|
return accounts.json()
|
||||||
|
|
||||||
|
|
||||||
def json_to_accounts(json_: str) -> list[tuple[str, str, str]]:
|
def json_to_accounts(json_: str) -> list[tuple[str, str, str]]:
|
||||||
|
@ -49,8 +49,7 @@ def get_accounts(bot: telebot.TeleBot, engine: Engine, mes: Message) -> None:
|
|||||||
mes.chat.id,
|
mes.chat.id,
|
||||||
"Ваши аккаунты:\n"
|
"Ваши аккаунты:\n"
|
||||||
+ "\n".join(accounts)
|
+ "\n".join(accounts)
|
||||||
+ "\nНажмите на название, чтобы скопировать\n"
|
+ "\nНажмите на название, чтобы скопировать",
|
||||||
f"Всего {len(accounts)}",
|
|
||||||
30,
|
30,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,12 +24,8 @@ def get_master_pass(
|
|||||||
|
|
||||||
def get_accounts(engine: Engine, user_id: int) -> list[str]:
|
def get_accounts(engine: Engine, user_id: int) -> list[str]:
|
||||||
"""Gets list of account names"""
|
"""Gets list of account names"""
|
||||||
statement = (
|
statement = sqlmodel.select(models.Account).where(
|
||||||
sqlmodel.select(models.Account)
|
models.Account.user_id == user_id,
|
||||||
.where(
|
|
||||||
models.Account.user_id == user_id,
|
|
||||||
)
|
|
||||||
.order_by(models.Account.name)
|
|
||||||
)
|
)
|
||||||
with sqlmodel.Session(engine) as session:
|
with sqlmodel.Session(engine) as session:
|
||||||
result = session.exec(statement)
|
result = session.exec(statement)
|
||||||
@ -41,12 +37,8 @@ def get_all_accounts(
|
|||||||
) -> Iterator[tuple[str, bytes, bytes, bytes]]:
|
) -> Iterator[tuple[str, bytes, bytes, bytes]]:
|
||||||
"""Returns an iterator of tuples, where values represent account's
|
"""Returns an iterator of tuples, where values represent account's
|
||||||
name, salt, encrypted login and encrypted password"""
|
name, salt, encrypted login and encrypted password"""
|
||||||
statement = (
|
statement = sqlmodel.select(models.Account).where(
|
||||||
sqlmodel.select(models.Account)
|
models.Account.user_id == user_id,
|
||||||
.where(
|
|
||||||
models.Account.user_id == user_id,
|
|
||||||
)
|
|
||||||
.order_by(models.Account.name)
|
|
||||||
)
|
)
|
||||||
with sqlmodel.Session(engine) as session:
|
with sqlmodel.Session(engine) as session:
|
||||||
result = session.exec(statement)
|
result = session.exec(statement)
|
||||||
|
Reference in New Issue
Block a user