service_man/api/infrastructure/dependencies/repositories.py

18 lines
440 B
Python
Raw Normal View History

2024-03-31 04:18:41 +03:00
from typing import Annotated
from fastapi import Depends
from sqlalchemy.ext.asyncio import AsyncSession
from api.domain.user import UserRepository
from api.infrastructure.persistence.repositories.user_repository import (
SqlAlchemyUserRepository,
)
from .stub import Stub
def get_user_repository(
session: Annotated[AsyncSession, Depends(Stub(AsyncSession))],
) -> UserRepository:
return SqlAlchemyUserRepository(session)