Initial upload: Agentic Codebase Memory Manager v0.1.0
This commit is contained in:
69
src/memory_manager/api/schemas.py
Normal file
69
src/memory_manager/api/schemas.py
Normal file
@@ -0,0 +1,69 @@
|
||||
"""Pydantic schemas for API."""
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class MemoryEntryCreate(BaseModel):
|
||||
title: str = Field(..., min_length=1, max_length=255)
|
||||
content: str = Field(..., min_length=1)
|
||||
category: str = Field(...)
|
||||
tags: List[str] = Field(default_factory=list)
|
||||
agent_id: Optional[str] = Field(default="unknown")
|
||||
project_path: Optional[str] = Field(default=".")
|
||||
parent_id: Optional[int] = None
|
||||
|
||||
|
||||
class MemoryEntryUpdate(BaseModel):
|
||||
title: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
content: Optional[str] = Field(None, min_length=1)
|
||||
category: Optional[str] = None
|
||||
tags: Optional[List[str]] = None
|
||||
|
||||
|
||||
class MemoryEntryResponse(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
content: str
|
||||
category: str
|
||||
tags: List[str]
|
||||
agent_id: str
|
||||
project_path: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
parent_id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class CommitCreate(BaseModel):
|
||||
message: str = Field(..., min_length=1)
|
||||
agent_id: Optional[str] = Field(default="unknown")
|
||||
project_path: Optional[str] = Field(default=".")
|
||||
|
||||
|
||||
class CommitResponse(BaseModel):
|
||||
id: int
|
||||
hash: str
|
||||
message: str
|
||||
agent_id: str
|
||||
project_path: str
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class DiffResponse(BaseModel):
|
||||
hash1: str
|
||||
hash2: str
|
||||
added: List[dict]
|
||||
removed: List[dict]
|
||||
modified: List[dict]
|
||||
|
||||
|
||||
class StatsResponse(BaseModel):
|
||||
total_entries: int
|
||||
total_commits: int
|
||||
category_counts: dict
|
||||
Reference in New Issue
Block a user