Compare commits
No commits in common. "9f6430505058925457e252ecc805501890d7be70" and "c7675c231fbacfb7c4e308d01d4a5878ce7b2e38" have entirely different histories.
9f64305050
...
c7675c231f
@ -35,7 +35,7 @@ class _Accounts(pydantic.BaseModel):
|
|||||||
def _accounts_list_to_json(accounts: Iterable[DecryptedAccount]) -> str:
|
def _accounts_list_to_json(accounts: Iterable[DecryptedAccount]) -> str:
|
||||||
result = _Accounts(
|
result = _Accounts(
|
||||||
accounts=[_Account.from_usual_account(i) for i in accounts],
|
accounts=[_Account.from_usual_account(i) for i in accounts],
|
||||||
).json(ensure_ascii=False, indent=2)
|
).json(ensure_ascii=False)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,6 +540,7 @@ async def _export2(
|
|||||||
)
|
)
|
||||||
tasks.append(loop.run_in_executor(pool, function))
|
tasks.append(loop.run_in_executor(pool, function))
|
||||||
accounts = await asyncio.gather(*tasks)
|
accounts = await asyncio.gather(*tasks)
|
||||||
|
accounts.sort(key=lambda account: account.name)
|
||||||
json_io = accounts_to_json(accounts)
|
json_io = accounts_to_json(accounts)
|
||||||
await bot.send_document(
|
await bot.send_document(
|
||||||
mes.chat.id,
|
mes.chat.id,
|
||||||
|
@ -36,13 +36,9 @@ def get_account_names(
|
|||||||
|
|
||||||
def get_accounts(engine: Engine, user_id: int) -> list[models.Account]:
|
def get_accounts(engine: Engine, user_id: int) -> list[models.Account]:
|
||||||
"""Returns a list of accounts of a user"""
|
"""Returns a list of accounts of a user"""
|
||||||
statement = (
|
statement = sqlmodel.select(models.Account).where(
|
||||||
sqlmodel.select(models.Account)
|
|
||||||
.where(
|
|
||||||
models.Account.user_id == user_id,
|
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).fetchall()
|
result = session.exec(statement).fetchall()
|
||||||
return result
|
return result
|
||||||
|
@ -4,11 +4,7 @@ import sqlmodel
|
|||||||
class MasterPass(sqlmodel.SQLModel, table=True):
|
class MasterPass(sqlmodel.SQLModel, table=True):
|
||||||
__tablename__ = "master_passwords"
|
__tablename__ = "master_passwords"
|
||||||
user_id: int = sqlmodel.Field(
|
user_id: int = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(
|
sa_column=sqlmodel.Column(sqlmodel.INT(), primary_key=True)
|
||||||
sqlmodel.INT(),
|
|
||||||
primary_key=True,
|
|
||||||
autoincrement=False,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
salt: bytes = sqlmodel.Field(
|
salt: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
||||||
|
Reference in New Issue
Block a user