elody 0.0.183__py3-none-any.whl → 0.0.184__py3-none-any.whl

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.
@@ -17,7 +17,9 @@ 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
+ "sorting": lambda key_order_map, **kwargs: self._sorting(
21
+ key_order_map, **kwargs
22
+ ),
21
23
  }
22
24
  return {**super().crud(), **crud}
23
25
 
@@ -72,18 +74,10 @@ class ElodyConfiguration(BaseObjectConfiguration):
72
74
  object_list_key,
73
75
  )
74
76
  document = {**template, **document_defaults, **post_body}
75
-
76
- document = self._sanitize_document(
77
- document=document,
78
- object_list_name="metadata",
79
- object_list_value_field_name="value",
80
- )
81
- document = self._sort_document_keys(document)
77
+ document = self._pre_crud_hook(crud="create", document=document)
82
78
  return document
83
79
 
84
- def _document_content_patcher(
85
- self, *, document, content, overwrite=False, **kwargs
86
- ):
80
+ def _document_content_patcher(self, *, document, content, overwrite=False, **_):
87
81
  object_lists = self.document_info().get("object_lists", {})
88
82
  if overwrite:
89
83
  document = content
@@ -130,9 +124,9 @@ class ElodyConfiguration(BaseObjectConfiguration):
130
124
  if not element[object_list_value_field_name]:
131
125
  sanitized_document[object_list_name].remove(element)
132
126
  return sanitized_document
133
-
127
+
134
128
  def __patch_document(self, crud, document):
135
- document.update({"date_updated": datetime.now(timezone.utc)})
129
+ document.update({f"date_{crud}d": datetime.now(timezone.utc)})
136
130
  if email := self._get_user_context_id():
137
131
  document.update({"last_editor": email})
138
132
  return document
@@ -140,7 +134,7 @@ class ElodyConfiguration(BaseObjectConfiguration):
140
134
  def _sorting(self, key_order_map, **_):
141
135
  addFields, sort = {}, {}
142
136
  for key, order in key_order_map.items():
143
- if key != "created_at":
137
+ if key not in ["date_created", "date_updated", "last_editor"]:
144
138
  addFields.update(
145
139
  {
146
140
  key: {
@@ -166,7 +160,7 @@ class ElodyConfiguration(BaseObjectConfiguration):
166
160
  }
167
161
  )
168
162
  sort.update({key: order})
169
-
163
+
170
164
  pipeline = [{"$sort": sort}]
171
165
  if addFields:
172
166
  pipeline.append({"$addFields": addFields})
@@ -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["created_by"] = email
34
+ document["last_editor"] = email
35
35
  return document
36
36
 
37
37
  def _post_crud_hook(self, *, crud, document, get_rabbit, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: elody
3
- Version: 0.0.183
3
+ Version: 0.0.184
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -13,8 +13,8 @@ elody/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  elody/migration/base_object_migrator.py,sha256=n8uvgGfjEUy60G47RD7Y-oxp1vHLOauwPMDl87LcxtU,436
14
14
  elody/object_configurations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  elody/object_configurations/base_object_configuration.py,sha256=dXhzQLWtIEQHx3WSPs2R-dvN3ulcPA27G3oNGAsImBQ,6756
16
- elody/object_configurations/elody_configuration.py,sha256=Nv8HStd7Pu4bQKXehpYuPVU_P3wK8ofNaivSH86dNgE,6451
17
- elody/object_configurations/job_configuration.py,sha256=E8KAeBQfy0DU4Mq-2aD8qsgP1Dv8jMkTMNAWrU3IZVo,2038
16
+ elody/object_configurations/elody_configuration.py,sha256=Fzd9If44UNEI65i3iB5w42O4vkIgVOra8BVmwmTYpPo,6328
17
+ elody/object_configurations/job_configuration.py,sha256=HMDxaRUyfqhIy0q3yQDDMH9uW5iCd7VCmqknQofXNt0,2039
18
18
  elody/policies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  elody/policies/helpers.py,sha256=AV3wtvthJafW6ueEYGxggB5kk5knWTWzh3zq29Y1-ws,1434
20
20
  elody/policies/permission_handler.py,sha256=HIKWzl736qaeATJOhXSR_4f7taTEjYCR1t__9F6u39U,9606
@@ -40,8 +40,8 @@ tests/data.py,sha256=Q3oxduf-E3m-Z5G_p3fcs8jVy6g10I7zXKL1m94UVMI,2906
40
40
  tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  tests/unit/test_csv.py,sha256=NQaOhehfQ4GuXku0Y1SA8DYjJeqqidbF50zEHAi8RZA,15923
42
42
  tests/unit/test_utils.py,sha256=g63szcEZyHhCOtrW4BnNbcgVca3oYPIOLjBdIzNwwN0,8784
43
- elody-0.0.183.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
- elody-0.0.183.dist-info/METADATA,sha256=Xl9g2OM4-12_kJjTuMBnvx7qUYr8DZmvU8CjF4fzH9U,23336
45
- elody-0.0.183.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
46
- elody-0.0.183.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
- elody-0.0.183.dist-info/RECORD,,
43
+ elody-0.0.184.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
+ elody-0.0.184.dist-info/METADATA,sha256=zFLbm3NXLS9k_aJC8NgVBDM2z2blcrPlTwBHE2xHCDo,23336
45
+ elody-0.0.184.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
46
+ elody-0.0.184.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
+ elody-0.0.184.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5