mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
c44291830c
Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
980 B
Python
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()
|