mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
get tests working
This commit is contained in:
@@ -11,12 +11,6 @@ from basic_memory.schemas import EntityTypeList, ObservationCategoryList, TypedE
|
||||
router = APIRouter(prefix="/discovery", tags=["discovery"])
|
||||
|
||||
|
||||
@router.get("/entity-types", response_model=EntityTypeList)
|
||||
async def get_entity_types(entity_service: EntityServiceDep) -> EntityTypeList:
|
||||
"""Get list of all unique entity types in the system."""
|
||||
logger.debug("Getting all entity types")
|
||||
types = await entity_service.get_entity_types()
|
||||
return EntityTypeList(types=types)
|
||||
|
||||
|
||||
@router.get("/observation-categories", response_model=ObservationCategoryList)
|
||||
@@ -26,25 +20,3 @@ async def get_observation_categories(observation_service: ObservationServiceDep)
|
||||
categories = await observation_service.observation_categories()
|
||||
return ObservationCategoryList(categories=categories)
|
||||
|
||||
|
||||
@router.get("/entities/{entity_type}", response_model=TypedEntityList)
|
||||
async def list_entities_by_type(
|
||||
entity_service: EntityServiceDep,
|
||||
entity_type: str,
|
||||
include_related: bool = False,
|
||||
sort_by: Optional[str] = "updated_at",
|
||||
) -> TypedEntityList:
|
||||
"""List all entities of a specific type."""
|
||||
logger.debug(f"Listing entities of type: {entity_type}")
|
||||
entities = await entity_service.list_entities(
|
||||
entity_type=entity_type,
|
||||
sort_by=sort_by,
|
||||
include_related=include_related
|
||||
)
|
||||
return TypedEntityList(
|
||||
entity_type=entity_type,
|
||||
entities=[EntityResponse.model_validate(e) for e in entities],
|
||||
total=len(entities),
|
||||
sort_by=sort_by,
|
||||
include_related=include_related
|
||||
)
|
||||
Reference in New Issue
Block a user