Первый коммит
This commit is contained in:
54
app/schemas/indexing.py
Normal file
54
app/schemas/indexing.py
Normal 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
|
||||
Reference in New Issue
Block a user