mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-25 14:48:06 +02:00
Fixing user fields
This commit is contained in:
parent
cf5041eeb0
commit
0bc97b9374
4 changed files with 13 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ Collection management for the librarian - uses config service for storage
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import dataclasses
|
||||
import logging
|
||||
import json
|
||||
import uuid
|
||||
|
|
@ -173,10 +174,17 @@ class CollectionManager:
|
|||
if response.error:
|
||||
raise RuntimeError(f"Config query failed: {response.error.message}")
|
||||
|
||||
# Every value in this workspace is a collection for this user
|
||||
# Every value in this workspace is a collection.
|
||||
# Filter to fields the current schema knows about — older
|
||||
# persisted values may carry fields that have since been
|
||||
# dropped (e.g. `user` from the pre-workspace-refactor era).
|
||||
known_fields = {f.name for f in dataclasses.fields(CollectionMetadata)}
|
||||
collections = []
|
||||
for config_value in response.values:
|
||||
metadata_dict = json.loads(config_value.value)
|
||||
metadata_dict = {
|
||||
k: v for k, v in metadata_dict.items() if k in known_fields
|
||||
}
|
||||
metadata = CollectionMetadata(**metadata_dict)
|
||||
collections.append(metadata)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue