"""# Summary CRUD service wiring for the pet aggregate via the hexa container. """ from hexa import build from domain.pets.models import Pet from domain.pets.ports.db import PetDocument from infra.adapters.service import CrudsServiceAdaptor class PetCrudsService(CrudsServiceAdaptor[Pet, PetDocument]): """Pet CRUD service resolving :class:`PetDocument` from a repo. Notes: Instances are created by :func:`get_pet_service`. The ``model`` and ``schema`` class attributes bind the domain model and its document type. """ model = Pet schema = PetDocument def get_pet_service(repo) -> PetCrudsService: """Build a pet CRUD service wired to ``repo``. Args: repo (Any): Integer-id pet repository from :func:`create_pet_repo`. Returns: PetCrudsService: Ready-to-use pet CRUD service. """ return build(PetCrudsService, instances={"repo": repo})