add title/folder to EntitySchema

This commit is contained in:
phernandez
2025-01-31 19:29:16 -06:00
parent f0fd1ee942
commit eafe563cfa
13 changed files with 230 additions and 158 deletions
+8 -2
View File
@@ -182,15 +182,21 @@ class Entity(BaseModel):
- Optional description for high-level overview
"""
file_path: str
entity_type: EntityType = "note"
title: str
content: Optional[str] = None
folder: str
entity_type: EntityType = "note"
entity_metadata: Optional[Dict] = Field(default=None, description="Optional metadata")
content_type: ContentType = Field(
description="MIME type of the content (e.g. text/markdown, image/jpeg)",
examples=["text/markdown", "image/jpeg"], default="text/markdown"
)
@property
def file_path(self):
"""Get the file path for this entity based on its permalink."""
return f"{self.folder}/{self.title}.md" if self.folder else f"{self.title}.md"
@property
def permalink(self) -> PathId:
"""Get the path ID in format {snake_case_title}."""
+1
View File
@@ -117,6 +117,7 @@ class EntityResponse(SQLAlchemyModel):
"""
permalink: PathId
title: str
file_path: str
entity_type: EntityType
entity_metadata: Optional[Dict] = None