@@ -198,33 +198,14 @@ def thumbnail_url(value, info):
198198ThumbnailUrl = Annotated [str | None , Field (validate_default = True )]
199199
200200
201- class DocumentNode (BaseModel ):
202- """Document without versions
203-
204- The point of this class is to be used when listing folders/documents in
205- which case info about document versions (and their pages etc) is not
206- required (generating document version info in context of CDN is very
207- slow as for each page of each doc ver signed URL must be computed)
208- """
209- 201+ class DocumentBase (BaseModel ):
210202 id : UUID
211203 title : str
212204 ctype : Literal ["document" ]
213205 tags : list [Tag ] = Field (default_factory = list )
214- # created_at: datetime
215- # updated_at: datetime
216206 parent_id : UUID | None
217- document_type_id : UUID | None = None
218- breadcrumb : list [tuple [UUID , str ]] = Field (default_factory = list )
219- ocr : bool = True # will this document be OCRed?
220- ocr_status : OCRStatusEnum = OCRStatusEnum .unknown
221- thumbnail_url : ThumbnailUrl = None
222207 preview_status : str | None = None
223- user_id : UUID | None = None
224- group_id : UUID | None = None
225- owner_name : str | None = None
226- perms : list [str ] = Field (default_factory = list )
227- is_shared : bool = False
208+ thumbnail_url : ThumbnailUrl = None
228209
229210 @field_validator ("thumbnail_url" , mode = "before" )
230211 def thumbnail_url_validator (cls , value , info ):
@@ -250,10 +231,34 @@ def thumbnail_url_validator(cls, value, info):
250231 model_config = ConfigDict (from_attributes = True )
251232
252233
234+ class DocumentNode (DocumentBase ):
235+ """Document without versions
236+
237+ The point of this class is to be used when listing folders/documents in
238+ which case info about document versions (and their pages etc) is not
239+ required (generating document version info in context of CDN is very
240+ slow as for each page of each doc ver signed URL must be computed)
241+ """
242+ document_type_id : UUID | None = None
243+ breadcrumb : list [tuple [UUID , str ]] = Field (default_factory = list )
244+ ocr : bool = True # will this document be OCRed?
245+ ocr_status : OCRStatusEnum = OCRStatusEnum .unknown
246+ owner_name : str | None = None
247+ perms : list [str ] = Field (default_factory = list )
248+ is_shared : bool = False
249+ 250+ # Config
251+ model_config = ConfigDict (from_attributes = True )
252+ 253+ 253254class Document (DocumentNode ):
254255 versions : list [DocumentVersion ] = Field (default_factory = list )
255256
256257
258+ class DocumentShort (DocumentBase ):
259+ pass
260+ 261+ 257262class DocumentWithoutVersions (DocumentNode ):
258263 ...
259264
0 commit comments