00466a9801
Introduces a manifest contract so feature containers self-describe their settings (JSON Schema + access rules). Backend and frontend gain generic plugin proxy and dynamic Extensions UI with zero feature-specific code. Doc-service is the first plugin consumer: exposes /plugin/manifest and /plugin/settings, adds a watchdog-based file watcher that auto-ingests PDFs from a mounted directory, maps subfolders to categories, supports AI-suggested folder/filename (user-confirmed), and enforces a no-remove policy. Access is gated by is_superuser or doc-service-admin group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
1.2 KiB
Python
60 lines
1.2 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class CategoryOut(BaseModel):
|
|
id: str
|
|
name: str
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class DocumentOut(BaseModel):
|
|
id: str
|
|
user_id: str
|
|
filename: str
|
|
title: str | None
|
|
file_size: int
|
|
status: str
|
|
document_type: str | None
|
|
extracted_data: str | None # JSON string — frontend calls JSON.parse()
|
|
tags: str | None # JSON array string
|
|
error_message: str | None
|
|
created_at: datetime
|
|
processed_at: datetime | None
|
|
categories: list[CategoryOut] = []
|
|
source: str = "upload"
|
|
watch_path: str | None = None
|
|
suggested_folder: str | None = None
|
|
suggested_filename: str | None = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class DocumentPage(BaseModel):
|
|
items: list[DocumentOut]
|
|
total: int
|
|
page: int
|
|
pages: int
|
|
|
|
|
|
class DocumentStatusOut(BaseModel):
|
|
id: str
|
|
status: str
|
|
error_message: str | None
|
|
processed_at: datetime | None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class DocumentTypeUpdate(BaseModel):
|
|
document_type: str
|
|
|
|
|
|
class TagsUpdate(BaseModel):
|
|
tags: list[str]
|
|
|
|
|
|
class TitleUpdate(BaseModel):
|
|
title: str
|