From a74119c93e8c83b5b13f43e13641792954d9267d Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Thu, 13 Feb 2025 17:31:37 +0000 Subject: [PATCH] Add fields to library schema --- trustgraph-base/trustgraph/schema/library.py | 6 +++++- trustgraph-flow/trustgraph/gateway/serialize.py | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/trustgraph-base/trustgraph/schema/library.py b/trustgraph-base/trustgraph/schema/library.py index 11006ad8..cdcc163b 100644 --- a/trustgraph-base/trustgraph/schema/library.py +++ b/trustgraph-base/trustgraph/schema/library.py @@ -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() diff --git a/trustgraph-flow/trustgraph/gateway/serialize.py b/trustgraph-flow/trustgraph/gateway/serialize.py index 4cad220e..5cb5d0fc 100644 --- a/trustgraph-flow/trustgraph/gateway/serialize.py +++ b/trustgraph-flow/trustgraph/gateway/serialize.py @@ -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):