Phase 7: serve the vet sample from the template tools and docs
- build.py: _TEMPLATE_COMPONENTS rewritten around the vet sample (53 kinds —
per-resource slices, jobs, worked appointment_reminder family, tests);
seed tokens dropped from the manifest ('sample: vet' instead)
- registry.py: get_app_component(kind) no longer renames item/example seeds;
prompts and tool docs updated to 'copy a slice and adapt'
- templates/README.md, 01_build_recipe, 40_ui_admin, wiki/03 updated off the
old seed scheme; repo inventory/config now exclude vet (docs move under
standards; react/vet itself is deleted in a later phase)
- regenerated MCP bundle, vendored templates, and site output
This commit is contained in:
3
standards/mcp/templates/app/domain/vets/__init__.py
Normal file
3
standards/mcp/templates/app/domain/vets/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""# Summary
|
||||
|
||||
Vets domain slice."""
|
||||
29
standards/mcp/templates/app/domain/vets/models.py
Normal file
29
standards/mcp/templates/app/domain/vets/models.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""# Summary
|
||||
|
||||
Vets domain — veterinarians referenced by appointments.
|
||||
"""
|
||||
from pydantic import BaseModel
|
||||
|
||||
from domain.parents.models import Metadata
|
||||
|
||||
|
||||
class Vet(BaseModel):
|
||||
"""A veterinarian.
|
||||
|
||||
Attributes:
|
||||
id (int | None): Server-assigned identifier. Defaults to None.
|
||||
name (str): Veterinarian's full name.
|
||||
specialty (str | None): Area of specialization. Defaults to None.
|
||||
email (str | None): Email address. Defaults to None.
|
||||
phone (str | None): Contact phone number. Defaults to None.
|
||||
metadata (Metadata | None): Presentation metadata. Defaults to None.
|
||||
"""
|
||||
|
||||
id: int | None = None
|
||||
name: str
|
||||
specialty: str | None = None
|
||||
email: str | None = None
|
||||
phone: str | None = None
|
||||
metadata: Metadata | None = None
|
||||
|
||||
model_config = {"extra": "ignore"}
|
||||
@@ -0,0 +1,3 @@
|
||||
"""# Summary
|
||||
|
||||
Vets domain ports."""
|
||||
25
standards/mcp/templates/app/domain/vets/ports/db.py
Normal file
25
standards/mcp/templates/app/domain/vets/ports/db.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""# Summary
|
||||
|
||||
Vets persistence ports — integer-id document and repository factory.
|
||||
"""
|
||||
from mongo_ops import BaseDocument
|
||||
from pydantic import Field
|
||||
|
||||
from domain.vets.models import Vet
|
||||
from infra.db.repos import create_repo
|
||||
|
||||
|
||||
class VetDocument(Vet, BaseDocument):
|
||||
"""Persisted vet document. The integer ``id`` shadows the ObjectId."""
|
||||
|
||||
id: int | None = Field(default=None, validation_alias="_id")
|
||||
|
||||
|
||||
def create_vet_repo():
|
||||
"""Create the vet repository selected by ``settings.repo_backend``.
|
||||
|
||||
Returns:
|
||||
IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the
|
||||
``vets`` collection/store.
|
||||
"""
|
||||
return create_repo("vets", VetDocument)
|
||||
33
standards/mcp/templates/app/domain/vets/ports/service.py
Normal file
33
standards/mcp/templates/app/domain/vets/ports/service.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""# Summary
|
||||
|
||||
CRUD service wiring for the vet aggregate via the hexa container.
|
||||
"""
|
||||
from hexa import build
|
||||
|
||||
from domain.vets.models import Vet
|
||||
from domain.vets.ports.db import VetDocument
|
||||
from infra.adapters.service import CrudsServiceAdaptor
|
||||
|
||||
|
||||
class VetCrudsService(CrudsServiceAdaptor[Vet, VetDocument]):
|
||||
"""Vet CRUD service resolving :class:`VetDocument` from a repo.
|
||||
|
||||
Notes:
|
||||
Instances are created by :func:`get_vet_service`. The ``model`` and
|
||||
``schema`` class attributes bind the domain model and its document type.
|
||||
"""
|
||||
|
||||
model = Vet
|
||||
schema = VetDocument
|
||||
|
||||
|
||||
def get_vet_service(repo) -> VetCrudsService:
|
||||
"""Build a vet CRUD service wired to ``repo``.
|
||||
|
||||
Args:
|
||||
repo (Any): Integer-id vet repository from :func:`create_vet_repo`.
|
||||
|
||||
Returns:
|
||||
VetCrudsService: Ready-to-use vet CRUD service.
|
||||
"""
|
||||
return build(VetCrudsService, instances={"repo": repo})
|
||||
Reference in New Issue
Block a user