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:
@@ -0,0 +1,3 @@
|
||||
"""# Summary
|
||||
|
||||
Appointments domain slice."""
|
||||
68
standards/mcp/templates/app/domain/appointments/models.py
Normal file
68
standards/mcp/templates/app/domain/appointments/models.py
Normal file
@@ -0,0 +1,68 @@
|
||||
"""# Summary
|
||||
|
||||
Appointments domain — scheduled visits linking a pet, a vet and a treatment.
|
||||
"""
|
||||
from pydantic import BaseModel
|
||||
|
||||
from domain.parents.models import Metadata
|
||||
|
||||
|
||||
class ProcedureNote(BaseModel):
|
||||
"""A single procedure note; ``noteType`` selects the shape.
|
||||
|
||||
Attributes:
|
||||
noteType (str): Discriminator (basic, heart_rate, dental, vaccine,
|
||||
preop, surgery).
|
||||
summary (str | None): Short summary. Defaults to None.
|
||||
details (str | None): Longer details. Defaults to None.
|
||||
"""
|
||||
|
||||
noteType: str
|
||||
summary: str | None = None
|
||||
details: str | None = None
|
||||
|
||||
model_config = {"extra": "ignore"}
|
||||
|
||||
|
||||
class Procedure(BaseModel):
|
||||
"""A procedure performed during an appointment.
|
||||
|
||||
Attributes:
|
||||
name (str): Procedure name.
|
||||
description (str | None): Procedure description. Defaults to None.
|
||||
cost (float | None): Cost of the procedure. Defaults to None.
|
||||
notes (ProcedureNote | None): Typed procedure note. Defaults to None.
|
||||
"""
|
||||
|
||||
name: str
|
||||
description: str | None = None
|
||||
cost: float | None = None
|
||||
notes: ProcedureNote | None = None
|
||||
|
||||
model_config = {"extra": "ignore"}
|
||||
|
||||
|
||||
class Appointment(BaseModel):
|
||||
"""A scheduled appointment.
|
||||
|
||||
Attributes:
|
||||
id (int | None): Server-assigned identifier. Defaults to None.
|
||||
date (str): ISO date-time of the appointment.
|
||||
notes (str | None): Additional notes. Defaults to None.
|
||||
procedures (list[Procedure]): Procedures performed. Defaults to empty.
|
||||
pet (dict | int | None): Embedded pet object or pet id.
|
||||
vet (dict | int | None): Embedded vet object or vet id.
|
||||
treatment (dict | int | None): Embedded treatment or treatment id.
|
||||
metadata (Metadata | None): Presentation metadata. Defaults to None.
|
||||
"""
|
||||
|
||||
id: int | None = None
|
||||
date: str
|
||||
notes: str | None = None
|
||||
procedures: list[Procedure] = []
|
||||
pet: dict | int | None = None
|
||||
vet: dict | int | None = None
|
||||
treatment: dict | int | None = None
|
||||
metadata: Metadata | None = None
|
||||
|
||||
model_config = {"extra": "ignore"}
|
||||
@@ -0,0 +1,3 @@
|
||||
"""# Summary
|
||||
|
||||
Appointments domain ports."""
|
||||
25
standards/mcp/templates/app/domain/appointments/ports/db.py
Normal file
25
standards/mcp/templates/app/domain/appointments/ports/db.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""# Summary
|
||||
|
||||
Appointments persistence ports — integer-id document and repository factory.
|
||||
"""
|
||||
from mongo_ops import BaseDocument
|
||||
from pydantic import Field
|
||||
|
||||
from domain.appointments.models import Appointment
|
||||
from infra.db.repos import create_repo
|
||||
|
||||
|
||||
class AppointmentDocument(Appointment, BaseDocument):
|
||||
"""Persisted appointment document. The integer ``id`` shadows the ObjectId."""
|
||||
|
||||
id: int | None = Field(default=None, validation_alias="_id")
|
||||
|
||||
|
||||
def create_appointment_repo():
|
||||
"""Create the appointment repository selected by ``settings.repo_backend``.
|
||||
|
||||
Returns:
|
||||
IntIdMemoryRepository | IntIdMongoRepository: Repository wired to the
|
||||
``appointments`` collection/store.
|
||||
"""
|
||||
return create_repo("appointments", AppointmentDocument)
|
||||
@@ -0,0 +1,34 @@
|
||||
"""# Summary
|
||||
|
||||
CRUD service wiring for the appointment aggregate via the hexa container.
|
||||
"""
|
||||
from hexa import build
|
||||
|
||||
from domain.appointments.models import Appointment
|
||||
from domain.appointments.ports.db import AppointmentDocument
|
||||
from infra.adapters.service import CrudsServiceAdaptor
|
||||
|
||||
|
||||
class AppointmentCrudsService(CrudsServiceAdaptor[Appointment, AppointmentDocument]):
|
||||
"""Appointment CRUD service resolving :class:`AppointmentDocument` from a repo.
|
||||
|
||||
Notes:
|
||||
Instances are created by :func:`get_appointment_service`. The ``model``
|
||||
and ``schema`` class attributes bind the domain model and its document.
|
||||
"""
|
||||
|
||||
model = Appointment
|
||||
schema = AppointmentDocument
|
||||
|
||||
|
||||
def get_appointment_service(repo) -> AppointmentCrudsService:
|
||||
"""Build an appointment CRUD service wired to ``repo``.
|
||||
|
||||
Args:
|
||||
repo (Any): Integer-id appointment repository from
|
||||
:func:`create_appointment_repo`.
|
||||
|
||||
Returns:
|
||||
AppointmentCrudsService: Ready-to-use appointment CRUD service.
|
||||
"""
|
||||
return build(AppointmentCrudsService, instances={"repo": repo})
|
||||
Reference in New Issue
Block a user