Files
basicmachines-co-basic-memory/src/basic_memory/schemas/directory.py
T
Paul Hernandez c44291830c chore: rename entity_type to note_type (#600)
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:28:57 -06:00

32 lines
980 B
Python

"""Schemas for directory tree operations."""
from datetime import datetime
from typing import List, Optional, Literal
from pydantic import BaseModel
class DirectoryNode(BaseModel):
"""Directory node in file system."""
name: str
file_path: Optional[str] = None # Original path without leading slash (matches DB)
directory_path: str # Path with leading slash for directory navigation
type: Literal["directory", "file"]
children: List["DirectoryNode"] = [] # Default to empty list
title: Optional[str] = None
permalink: Optional[str] = None
external_id: Optional[str] = None # UUID (primary API identifier for v2)
entity_id: Optional[int] = None # Internal numeric ID
note_type: Optional[str] = None
content_type: Optional[str] = None
updated_at: Optional[datetime] = None
@property
def has_children(self) -> bool:
return bool(self.children)
# Support for recursive model
DirectoryNode.model_rebuild()