Skip to content
Snippets Groups Projects
Commit 934180ef authored by teplyakov's avatar teplyakov
Browse files

feat: AUTO-3805 CollectionProps type

parent 5725a6cc
No related branches found
No related tags found
1 merge request!77feat: AUTO-3805 CollectionProps type
from perxis.collections import collections_pb2 from perxis.collections import collections_pb2
from typing import TypedDict from dataclasses import dataclass, asdict
from typing_extensions import deprecated from typing_extensions import deprecated
...@@ -22,11 +22,18 @@ def make_collection_instances( ...@@ -22,11 +22,18 @@ def make_collection_instances(
return collections return collections
class CollectionProps(TypedDict): @dataclass
single: bool class CollectionProps:
system: bool single: bool = False
no_data: bool system: bool = False
hidden: bool 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( def init_collections(
...@@ -41,7 +48,7 @@ def init_collections( ...@@ -41,7 +48,7 @@ def init_collections(
collection_schema = file.read() collection_schema = file.read()
kwargs = { kwargs = {
**(collections_settings_mapping.get(collection_id) or {}), **(collections_settings_mapping.get(collection_id).to_dict()),
"id": collection_id, "id": collection_id,
"name": collection_name, "name": collection_name,
"schema": collection_schema, "schema": collection_schema,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment