elody 0.0.182__tar.gz → 0.0.183__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {elody-0.0.182 → elody-0.0.183}/PKG-INFO +1 -1
- {elody-0.0.182 → elody-0.0.183}/pyproject.toml +1 -1
- {elody-0.0.182 → elody-0.0.183}/src/elody/error_codes.py +1 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/job.py +0 -1
- {elody-0.0.182 → elody-0.0.183}/src/elody/object_configurations/elody_configuration.py +41 -14
- {elody-0.0.182 → elody-0.0.183}/src/elody/object_configurations/job_configuration.py +1 -1
- {elody-0.0.182 → elody-0.0.183}/src/elody.egg-info/PKG-INFO +1 -1
- {elody-0.0.182 → elody-0.0.183}/LICENSE +0 -0
- {elody-0.0.182 → elody-0.0.183}/README.md +0 -0
- {elody-0.0.182 → elody-0.0.183}/setup.cfg +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/client.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/csv.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/exceptions.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/loader.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/migration/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/migration/base_object_migrator.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/object_configurations/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/object_configurations/base_object_configuration.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authentication/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authentication/base_user_tenant_validation_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authentication/multi_tenant_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/filter_generic_objects_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_detail_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_mediafiles_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_metadata_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_relations_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_request_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_request_policy_v2.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/mediafile_derivatives_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/mediafile_download_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/multi_tenant_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/tenant_request_policy.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/helpers.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/permission_handler.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/policies/tenant_id_resolver.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/schemas.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/util.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody/validator.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody.egg-info/SOURCES.txt +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody.egg-info/dependency_links.txt +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody.egg-info/requires.txt +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/elody.egg-info/top_level.txt +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/tests/__init_.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/tests/data.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/tests/unit/__init__.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/tests/unit/test_csv.py +0 -0
- {elody-0.0.182 → elody-0.0.183}/src/tests/unit/test_utils.py +0 -0
|
@@ -31,6 +31,7 @@ class ErrorCode(Enum):
|
|
|
31
31
|
NO_PERMISSION_TO_TENANT = ("1010", ["tenant_id", "line_number"])
|
|
32
32
|
XTENANT_NOT_FOUND = ("1011", ["x_tenant_id"])
|
|
33
33
|
NO_DOWNLOAD_PERMISSION = ("1012", [])
|
|
34
|
+
INVALID_TOKEN = ("1013", [])
|
|
34
35
|
|
|
35
36
|
# Database error codes
|
|
36
37
|
DATABASE_NOT_INITIALIZED = ("2000", [])
|
|
@@ -65,7 +65,6 @@ def init_job(
|
|
|
65
65
|
get_user_context=get_user_context
|
|
66
66
|
or (lambda: type("UserContext", (object,), {"email": user_email})()),
|
|
67
67
|
)
|
|
68
|
-
del job["computed_values"]["created_at"]
|
|
69
68
|
|
|
70
69
|
_post_crud_hook(
|
|
71
70
|
crud="create", document=job, parent_id=parent_id, get_rabbit=get_rabbit
|
|
@@ -17,6 +17,7 @@ class ElodyConfiguration(BaseObjectConfiguration):
|
|
|
17
17
|
"creator": lambda post_body, **kwargs: self._creator(post_body, **kwargs),
|
|
18
18
|
"post_crud_hook": lambda **kwargs: self._post_crud_hook(**kwargs),
|
|
19
19
|
"pre_crud_hook": lambda **kwargs: self._pre_crud_hook(**kwargs),
|
|
20
|
+
"sorting": lambda key_order_map, **kwargs: self._sorting(key_order_map, **kwargs),
|
|
20
21
|
}
|
|
21
22
|
return {**super().crud(), **crud}
|
|
22
23
|
|
|
@@ -55,10 +56,6 @@ class ElodyConfiguration(BaseObjectConfiguration):
|
|
|
55
56
|
|
|
56
57
|
template = {
|
|
57
58
|
"_id": _id,
|
|
58
|
-
"computed_values": {
|
|
59
|
-
"created_at": datetime.now(timezone.utc),
|
|
60
|
-
"event": "create",
|
|
61
|
-
},
|
|
62
59
|
"identifiers": list(
|
|
63
60
|
set([_id, *identifiers, *document_defaults.pop("identifiers", [])])
|
|
64
61
|
),
|
|
@@ -66,8 +63,6 @@ class ElodyConfiguration(BaseObjectConfiguration):
|
|
|
66
63
|
"relations": [],
|
|
67
64
|
"schema": {"type": self.SCHEMA_TYPE, "version": self.SCHEMA_VERSION},
|
|
68
65
|
}
|
|
69
|
-
if user_context_id := self._get_user_context_id():
|
|
70
|
-
template["computed_values"]["created_by"] = user_context_id
|
|
71
66
|
|
|
72
67
|
for key, object_list_key in self.document_info()["object_lists"].items():
|
|
73
68
|
if not key.startswith("lookup.virtual_relations"):
|
|
@@ -122,7 +117,7 @@ class ElodyConfiguration(BaseObjectConfiguration):
|
|
|
122
117
|
object_list_name="metadata",
|
|
123
118
|
object_list_value_field_name="value",
|
|
124
119
|
)
|
|
125
|
-
document = self.
|
|
120
|
+
document = self.__patch_document(crud, document)
|
|
126
121
|
document = self._sort_document_keys(document)
|
|
127
122
|
return document
|
|
128
123
|
|
|
@@ -135,12 +130,44 @@ class ElodyConfiguration(BaseObjectConfiguration):
|
|
|
135
130
|
if not element[object_list_value_field_name]:
|
|
136
131
|
sanitized_document[object_list_name].remove(element)
|
|
137
132
|
return sanitized_document
|
|
138
|
-
|
|
139
|
-
def
|
|
140
|
-
|
|
141
|
-
document["computed_values"] = {}
|
|
142
|
-
document["computed_values"].update({"event": crud})
|
|
143
|
-
document["computed_values"].update({"modified_at": datetime.now(timezone.utc)})
|
|
133
|
+
|
|
134
|
+
def __patch_document(self, crud, document):
|
|
135
|
+
document.update({"date_updated": datetime.now(timezone.utc)})
|
|
144
136
|
if email := self._get_user_context_id():
|
|
145
|
-
document
|
|
137
|
+
document.update({"last_editor": email})
|
|
146
138
|
return document
|
|
139
|
+
|
|
140
|
+
def _sorting(self, key_order_map, **_):
|
|
141
|
+
addFields, sort = {}, {}
|
|
142
|
+
for key, order in key_order_map.items():
|
|
143
|
+
if key != "created_at":
|
|
144
|
+
addFields.update(
|
|
145
|
+
{
|
|
146
|
+
key: {
|
|
147
|
+
"$arrayElemAt": [
|
|
148
|
+
{
|
|
149
|
+
"$map": {
|
|
150
|
+
"input": {
|
|
151
|
+
"$filter": {
|
|
152
|
+
"input": "$metadata",
|
|
153
|
+
"as": "metadata",
|
|
154
|
+
"cond": {
|
|
155
|
+
"$eq": ["$$metadata.key", key]
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"as": "metadata",
|
|
160
|
+
"in": "$$metadata.value",
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
0,
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
sort.update({key: order})
|
|
169
|
+
|
|
170
|
+
pipeline = [{"$sort": sort}]
|
|
171
|
+
if addFields:
|
|
172
|
+
pipeline.append({"$addFields": addFields})
|
|
173
|
+
return pipeline
|
|
@@ -31,7 +31,7 @@ class JobConfiguration(ElodyConfiguration):
|
|
|
31
31
|
def _creator(self, post_body, *, get_user_context={}, **_):
|
|
32
32
|
document = super()._creator(post_body)
|
|
33
33
|
if email := get_user_context().email:
|
|
34
|
-
document["
|
|
34
|
+
document["created_by"] = email
|
|
35
35
|
return document
|
|
36
36
|
|
|
37
37
|
def _post_crud_hook(self, *, crud, document, get_rabbit, **kwargs):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/object_configurations/base_object_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/filter_generic_objects_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/filter_generic_objects_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_detail_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_mediafiles_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_metadata_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_relations_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_request_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/generic_object_request_policy_v2.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/mediafile_derivatives_policy.py
RENAMED
|
File without changes
|
{elody-0.0.182 → elody-0.0.183}/src/elody/policies/authorization/mediafile_download_policy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|