Add fields to library schema

This commit is contained in:
Cyber MacGeddon 2025-02-13 17:31:37 +00:00
parent 5575e885e5
commit a74119c93e
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,5 @@
from pulsar.schema import Record, Bytes, String, Array
from pulsar.schema import Record, Bytes, String, Array, Timestamp
from . types import Triple
from . topic import topic
from . types import Error
@ -24,12 +24,16 @@ class DocumentPackage(Record):
collection = String()
title = String()
comments = String()
time = Timestamp()
class DocumentInfo(Record):
metadata = Array(Triple())
kind = String()
user = String()
collection = String()
title = String()
comments = String()
time = Timestamp()
class Criteria(Record):
key = String()

View file

@ -126,10 +126,13 @@ def to_document_package(x):
return DocumentPackage(
metadata = to_subgraph(x["metadata"]),
document = x.get("document", None),
kind = x.get("kind", None),
user = x.get("user", None),
collection = x.get("collection", None),
title = x.get("title", None),
comments = x.get("comments", None),
time = x.get("time", None),
document = x.get("document", None),
)
def to_document_info(x):
@ -139,6 +142,9 @@ def to_document_info(x):
kind = x.get("kind", None),
user = x.get("user", None),
collection = x.get("collection", None),
title = x.get("title", None),
comments = x.get("comments", None),
time = x.get("time", None),
)
def to_criteria(x):