Реализовать ЛР 7 на оценку 4
Skeleton contracts / contracts (pull_request) Blocked by required conditions

This commit is contained in:
2026-12-04 16:15:18 +03:00
parent 7996ebbb48
commit 94a8a5c1da
29 changed files with 918 additions and 85 deletions
+9 -1
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
from datetime import datetime
from uuid import UUID
from sqlalchemy import select
from sqlalchemy import select, update
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
@@ -48,6 +48,14 @@ class UserRepository:
async with self._sessions() as session:
return await session.scalar(select(UserRow).where(UserRow.username == username))
async def update_password_hash(self, user_id: UUID, old_hash: str, new_hash: str) -> None:
async with self._sessions.begin() as session:
await session.execute(
update(UserRow)
.where(UserRow.id == user_id, UserRow.password_hash == old_hash)
.values(password_hash=new_hash)
)
@classmethod
def to_domain(cls, row: UserRow) -> User:
return cls._to_domain(row)