You've already forked RekomenciBackend
feat(): profiles
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user