mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
Scoped codemod over surfsense_backend/app (excluding routes/, Wave E): renames search_space_id -> workspace_id, search_space -> workspace, SearchSpace -> Workspace across services, utils, tasks, agents, gateway, event_bus, notifications, podcasts, automations, observability params, and prompt .md files. Also flips the camelCase payload key searchSpaceId -> workspaceId (no backend reader; hard cutover). Preserved carve-outs (verbatim): Celery task names "delete_search_space_background" and "ai_sort_search_space" (wire names), and the OTel/metric key "search_space.id" (dashboards depend on it). Enum values 'SEARCH_SPACE' and SearchSourceConnector untouched.
25 lines
791 B
Python
25 lines
791 B
Python
from pydantic import BaseModel, Field, field_validator
|
|
|
|
from app.db import DocumentType
|
|
|
|
|
|
class ConnectorDocument(BaseModel):
|
|
"""Canonical data transfer object produced by connector adapters and consumed by the indexing pipeline."""
|
|
|
|
title: str
|
|
source_markdown: str
|
|
unique_id: str
|
|
document_type: DocumentType
|
|
workspace_id: int = Field(gt=0)
|
|
should_use_code_chunker: bool = False
|
|
metadata: dict = {}
|
|
connector_id: int | None = None
|
|
created_by_id: str
|
|
folder_id: int | None = None
|
|
|
|
@field_validator("title", "source_markdown", "unique_id", "created_by_id")
|
|
@classmethod
|
|
def not_empty(cls, v: str, info) -> str:
|
|
if not v.strip():
|
|
raise ValueError(f"{info.field_name} must not be empty or whitespace")
|
|
return v
|