feat(): profiles

This commit is contained in:
doas root
2025-11-20 01:37:19 +03:00
parent 8c7ce13922
commit 52f3072729
17 changed files with 361 additions and 24 deletions
@@ -0,0 +1,20 @@
from typing import override
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from template_project.adapters.data_gateways.tables import profile_table
from template_project.application.user.entity import UserId
from template_project.application.user.profile.data_gateway import ProfileDataGateway
from template_project.application.user.profile.entity import Profile
class DefaultProfileDataGateway(ProfileDataGateway):
def __init__(self, session: AsyncSession) -> None:
self._session = session
@override
async def load_by_user_id(self, user_id: UserId) -> Profile | None:
statement = select(Profile).where(profile_table.c.user_id == user_id)
result = await self._session.execute(statement)
return result.scalar_one_or_none()