diff --git a/perxis/collections/helpers.py b/perxis/collections/helpers.py index 44c99f8dceef08f1ca76c0983638528370056bb0..28a74e449686e759ba86fa23499b7bed2ee881a0 100644 --- a/perxis/collections/helpers.py +++ b/perxis/collections/helpers.py @@ -1,5 +1,5 @@ from perxis.collections import collections_pb2 -from typing import TypedDict +from dataclasses import dataclass, asdict from typing_extensions import deprecated @@ -22,11 +22,18 @@ def make_collection_instances( return collections -class CollectionProps(TypedDict): - single: bool - system: bool - no_data: bool - hidden: bool +@dataclass +class CollectionProps: + single: bool = False + system: bool = False + no_data: bool = False + hidden: bool = False + no_revisions: bool = False + no_archive: bool = False + no_publish: bool = False + + def to_dict(self) -> dict: + return asdict(self) # noqa def init_collections( @@ -41,7 +48,7 @@ def init_collections( collection_schema = file.read() kwargs = { - **(collections_settings_mapping.get(collection_id) or {}), + **(collections_settings_mapping.get(collection_id).to_dict()), "id": collection_id, "name": collection_name, "schema": collection_schema,