Rework schema

This commit is contained in:
Cyber MacGeddon 2025-05-03 17:55:17 +01:00
parent 6e31d24fb1
commit 0a95fc1263

View file

@ -6,16 +6,52 @@ from . types import Error
from . metadata import Metadata
from . documents import Document, TextDocument
# add
# -> (id, document)
# add-document
# -> (document_id, document_metadata, content)
# <- ()
# <- (error)
# list
# -> (user, collection?)
# <- (info)
# remove-document
# -> (document_id)
# <- ()
# <- (error)
# update-document
# -> (document_id, document_metadata)
# <- ()
# <- (error)
# get-document-metadata
# -> (document_id)
# <- (document_metadata)
# <- (error)
# get-document-content
# -> (document_id)
# <- (content)
# <- (error)
# add-processing
# -> (processing_id, processing_metadata)
# <- ()
# <- (error)
# remove-processing
# -> (processing_id)
# <- ()
# <- (error)
# list-documents
# -> (user, collection?)
# <- (document_metadata[])
# <- (error)
# list-processing
# -> (user, collection?)
# <- (processing_metadata[])
# <- (error)
# OLD:
# add(Metadata, Bytes) : error?
# copy(id, user, collection)
# move(id, user, collection)
@ -26,17 +62,21 @@ from . documents import Document, TextDocument
# info(id[]) : DocumentInfo[]
# search(<key,op,value>[]) : id[]
class DocumentPackage(Record):
class DocumentMetadata(Record):
id = String()
flow = String()
document = Bytes()
time = Long()
kind = String()
user = String()
collection = String()
title = String()
comments = String()
time = Long()
metadata = Array(Triple())
tags = Array(String())
class ProcessingMetadata(Record):
document_id = String()
time = Long()
flow = String()
user = String()
collection = String()
class DocumentInfo(Record):
id = String()
@ -55,12 +95,35 @@ class Criteria(Record):
operator = String()
class LibrarianRequest(Record):
# add-document, remove-document, update-document, get-document-metadata,
# get-document-content, add-processing, remove-processing, list-documents,
# list-processing
operation = String()
id = String()
flow = String()
document = DocumentPackage()
# add-document, remove-document, update-document, get-document-metadata,
# get-document-content
document_id = String()
# add-processing, remove-processing
processing_id = String()
# add-document, update-document
document_metadata = DocumentMetadata()
# add-processing
processing_metadata = ProcessingMetadata()
# add-document
content = Bytes()
# list-documents, list-processing
user = String()
# list-documents?, list-processing?
collection = String()
#
criteria = Array(Criteria())
class LibrarianResponse(Record):