Renamed src/database into src/db

This commit is contained in:
2023-01-03 11:59:06 +03:00
parent 70e9afe21d
commit 9ec66a3521
11 changed files with 35 additions and 35 deletions

22
src/db/change.py Normal file
View File

@ -0,0 +1,22 @@
import sqlmodel
from sqlalchemy.future import Engine
from . import models
def change_master_pass(
engine: Engine,
master_password: models.MasterPass,
) -> None:
"""Changes master password and salt in the database"""
statement = (
sqlmodel.update(models.MasterPass)
.where(models.MasterPass.user_id == master_password.user_id)
.values(
salt=master_password.salt,
password_hash=master_password.password_hash,
)
)
with sqlmodel.Session(engine) as session:
session.exec(statement)
session.commit()