Первый коммит

This commit is contained in:
2026-02-25 14:47:19 +03:00
commit 1e376aff24
170 changed files with 4893 additions and 0 deletions

54
app/schemas/indexing.py Normal file
View File

@@ -0,0 +1,54 @@
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field
from app.schemas.common import ErrorPayload
class FileSnapshot(BaseModel):
path: str = Field(min_length=1)
content: str
content_hash: str = Field(min_length=1)
class IndexSnapshotRequest(BaseModel):
project_id: str = Field(min_length=1)
files: list[FileSnapshot]
class ChangeOp(str, Enum):
UPSERT = "upsert"
DELETE = "delete"
class ChangedFile(BaseModel):
op: ChangeOp
path: str = Field(min_length=1)
content: Optional[str] = None
content_hash: Optional[str] = None
class IndexChangesRequest(BaseModel):
project_id: str = Field(min_length=1)
changed_files: list[ChangedFile]
class IndexJobQueuedResponse(BaseModel):
index_job_id: str
status: str
class IndexJobStatus(str, Enum):
QUEUED = "queued"
RUNNING = "running"
DONE = "done"
ERROR = "error"
class IndexJobResponse(BaseModel):
index_job_id: str
status: IndexJobStatus
indexed_files: int = 0
failed_files: int = 0
error: Optional[ErrorPayload] = None