documente_shared 0.1.81__py3-none-any.whl → 0.1.82__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.
Potentially problematic release.
This version of documente_shared might be problematic. Click here for more details.
- documente_shared/domain/entities/processing_case.py +1 -1
- documente_shared/domain/entities/processing_case_item.py +4 -1
- documente_shared/infrastructure/repositories/http_processing_case.py +13 -10
- documente_shared/infrastructure/repositories/http_processing_case_item.py +20 -12
- {documente_shared-0.1.81.dist-info → documente_shared-0.1.82.dist-info}/METADATA +1 -1
- {documente_shared-0.1.81.dist-info → documente_shared-0.1.82.dist-info}/RECORD +7 -7
- {documente_shared-0.1.81.dist-info → documente_shared-0.1.82.dist-info}/WHEEL +0 -0
|
@@ -106,7 +106,10 @@ class ProcessingCaseItem(object):
|
|
|
106
106
|
'case_id': self.case_id,
|
|
107
107
|
'digest': self.digest,
|
|
108
108
|
'status': str(self.status),
|
|
109
|
-
'document':
|
|
109
|
+
'document':(
|
|
110
|
+
self.document.to_dict
|
|
111
|
+
if self.document else None
|
|
112
|
+
),
|
|
110
113
|
'document_type': (
|
|
111
114
|
str(self.document_type)
|
|
112
115
|
if self.document_type else None
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import List, Optional
|
|
3
3
|
|
|
4
|
+
from requests import Response
|
|
5
|
+
|
|
4
6
|
from documente_shared.application.payloads import camel_to_snake
|
|
5
7
|
from documente_shared.domain.entities.processing_case import ProcessingCase
|
|
6
8
|
from documente_shared.domain.entities.processing_case_filters import ProcessingCaseFilters
|
|
@@ -16,9 +18,7 @@ class HttpProcessingCaseRepository(
|
|
|
16
18
|
def find(self, uuid: str, include_items: bool = False) -> Optional[ProcessingCase]:
|
|
17
19
|
response = self.session.get(f"{self.api_url}/v1/processing-cases/{uuid}/")
|
|
18
20
|
if response.status_code == 200:
|
|
19
|
-
|
|
20
|
-
instance_data = response_json.get('data', {})
|
|
21
|
-
return ProcessingCase.from_persist_dict(camel_to_snake(instance_data))
|
|
21
|
+
return self._build_processing_case(response)
|
|
22
22
|
return None
|
|
23
23
|
|
|
24
24
|
def persist(self, instance: ProcessingCase) -> ProcessingCase:
|
|
@@ -29,9 +29,7 @@ class HttpProcessingCaseRepository(
|
|
|
29
29
|
if response.status_code not in [200, 201]:
|
|
30
30
|
raise Exception(f'Error persisting processing case: {response.text}')
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
instance_data = response_json.get('data', {})
|
|
34
|
-
return ProcessingCase.from_persist_dict(camel_to_snake(instance_data))
|
|
32
|
+
return self._build_processing_case(response)
|
|
35
33
|
|
|
36
34
|
def remove(self, instance: ProcessingCase):
|
|
37
35
|
self.session.delete(f"{self.api_url}/v1/processing-cases/{instance.uuid}/")
|
|
@@ -45,9 +43,14 @@ class HttpProcessingCaseRepository(
|
|
|
45
43
|
)
|
|
46
44
|
if response.status_code == 200:
|
|
47
45
|
raw_response = response.json()
|
|
48
|
-
instaces_data = raw_response.get('data', [])
|
|
49
46
|
return [
|
|
50
|
-
ProcessingCase.from_persist_dict(item_data)
|
|
51
|
-
for item_data in
|
|
47
|
+
ProcessingCase.from_persist_dict(camel_to_snake(item_data))
|
|
48
|
+
for item_data in raw_response.get('data', [])
|
|
52
49
|
]
|
|
53
|
-
return []
|
|
50
|
+
return []
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def _build_processing_case(cls, response: Response) -> ProcessingCase:
|
|
54
|
+
response_json = response.json()
|
|
55
|
+
instance_data = response_json.get('data', {})
|
|
56
|
+
return ProcessingCase.from_persist_dict(camel_to_snake(instance_data))
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import List, Optional
|
|
3
3
|
|
|
4
|
+
from requests import Response
|
|
5
|
+
|
|
6
|
+
from documente_shared.application.payloads import camel_to_snake
|
|
4
7
|
from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
|
|
5
8
|
from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
|
|
6
9
|
from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
|
|
@@ -12,41 +15,46 @@ class HttpProcessingCaseItemRepository(
|
|
|
12
15
|
DocumenteClientMixin,
|
|
13
16
|
ProcessingCaseItemRepository,
|
|
14
17
|
):
|
|
15
|
-
|
|
16
18
|
def find(self, uuid: str) -> Optional[ProcessingCaseItem]:
|
|
17
|
-
response = self.session.get(f"{self.api_url}/processing-case-items/{uuid}/")
|
|
19
|
+
response = self.session.get(f"{self.api_url}/v1/processing-case-items/{uuid}/")
|
|
18
20
|
if response.status_code == 200:
|
|
19
|
-
return
|
|
21
|
+
return self._build_processing_case_item(response)
|
|
20
22
|
return None
|
|
21
23
|
|
|
22
24
|
def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
|
|
23
|
-
response = self.session.get(f"{self.api_url}/processing-case-items/{digest}/")
|
|
25
|
+
response = self.session.get(f"{self.api_url}/v1/processing-case-items/{digest}/")
|
|
24
26
|
if response.status_code == 200:
|
|
25
|
-
return
|
|
27
|
+
return self._build_processing_case_item(response)
|
|
26
28
|
return None
|
|
27
29
|
|
|
28
30
|
def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
|
|
29
|
-
response = self.session.put(
|
|
30
|
-
url=f"{self.api_url}/processing-case-items/{instance.uuid}/",
|
|
31
|
+
response: Response = self.session.put(
|
|
32
|
+
url=f"{self.api_url}/v1/processing-case-items/{instance.uuid}/",
|
|
31
33
|
json=instance.to_persist_dict,
|
|
32
34
|
)
|
|
33
35
|
if response.status_code in [200, 201]:
|
|
34
|
-
return
|
|
36
|
+
return self._build_processing_case_item(response)
|
|
35
37
|
return instance
|
|
36
38
|
|
|
37
39
|
def remove(self, instance: ProcessingCaseItem):
|
|
38
|
-
self.session.delete(f"{self.api_url}/processing-case-items/{instance.uuid}/")
|
|
40
|
+
self.session.delete(f"{self.api_url}/v1/processing-case-items/{instance.uuid}/")
|
|
39
41
|
|
|
40
42
|
def filter(
|
|
41
43
|
self,
|
|
42
44
|
tenant_slug: str,
|
|
43
45
|
filters: ProcessingCaseItemFilters,
|
|
44
46
|
) -> List[ProcessingCaseItem]:
|
|
45
|
-
response = self.session.get(f"{self.api_url}/processing-case-items/")
|
|
47
|
+
response = self.session.get(f"{self.api_url}/v1/processing-case-items/")
|
|
46
48
|
if response.status_code == 200:
|
|
47
49
|
raw_response = response.json()
|
|
48
50
|
return [
|
|
49
|
-
ProcessingCaseItem.
|
|
50
|
-
for
|
|
51
|
+
ProcessingCaseItem.from_dict(camel_to_snake(item_data))
|
|
52
|
+
for item_data in raw_response.get('data', [])
|
|
51
53
|
]
|
|
52
54
|
return []
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def _build_processing_case_item(cls, response: Response) -> ProcessingCaseItem:
|
|
58
|
+
response_json = response.json()
|
|
59
|
+
instance_data = response_json.get('data', {})
|
|
60
|
+
return ProcessingCaseItem.from_dict(camel_to_snake(instance_data))
|
|
@@ -14,9 +14,9 @@ documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
14
14
|
documente_shared/domain/entities/document.py,sha256=AthTUyA-QZE3WAT7lMoKVr_Z8mO_3qERuCnZge0DTLQ,12595
|
|
15
15
|
documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
|
|
16
16
|
documente_shared/domain/entities/in_memory_result.py,sha256=0sLNUrovKFQx4M-E9e4DrAiVgch2i4AKA-9BQBRaeI8,1482
|
|
17
|
-
documente_shared/domain/entities/processing_case.py,sha256=
|
|
17
|
+
documente_shared/domain/entities/processing_case.py,sha256=_UTMCSQjTSttNWa-NC7eWJITkNm6NZuGGT9gNm9D1mA,4970
|
|
18
18
|
documente_shared/domain/entities/processing_case_filters.py,sha256=FgyxB4mQb0nEGjIbUB9OiazkKL4yHRRC6bvmjD5NT8k,1915
|
|
19
|
-
documente_shared/domain/entities/processing_case_item.py,sha256=
|
|
19
|
+
documente_shared/domain/entities/processing_case_item.py,sha256=U_g99AJdlRRJpJ0NPfmXzlr2x04l5hc53oNLxx_Q7XQ,9734
|
|
20
20
|
documente_shared/domain/entities/processing_case_item_filters.py,sha256=-cAQTSWOepMMcGCBg2X3dd0W_8XHuBTlvOB1d-3sVVM,1971
|
|
21
21
|
documente_shared/domain/entities/processing_event.py,sha256=m1O0gcNaE_SszeIhxM3uYPHSpyOUmize6mfRw1_bYZo,1723
|
|
22
22
|
documente_shared/domain/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -34,10 +34,10 @@ documente_shared/infrastructure/repositories/__init__.py,sha256=47DEQpj8HBSa-_TI
|
|
|
34
34
|
documente_shared/infrastructure/repositories/dynamo_document.py,sha256=_Yp4gtA-n-hJ2w2wAM5BMCs2Mf46Q2Kq3eHqlxudkL4,1443
|
|
35
35
|
documente_shared/infrastructure/repositories/dynamo_processing_case.py,sha256=IoIHtlaEe4G5TqIV9IvG45a3HRBVHLfNC9sSgQjabUk,1464
|
|
36
36
|
documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=4guM8V3YfP7kzYcuVWunGJGmXi0kSSUW8otks39g1vs,1754
|
|
37
|
-
documente_shared/infrastructure/repositories/http_processing_case.py,sha256=
|
|
38
|
-
documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=
|
|
37
|
+
documente_shared/infrastructure/repositories/http_processing_case.py,sha256=FcOnzPUu-iWjj6O5syzqN61u6xogMoQMfbSnALqeK-c,2258
|
|
38
|
+
documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=babWakDZfHxWgB1OUwZsPTr8nhDwC-CDBn-vYtgUtUM,2494
|
|
39
39
|
documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
|
|
40
40
|
documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
|
|
41
|
-
documente_shared-0.1.
|
|
42
|
-
documente_shared-0.1.
|
|
43
|
-
documente_shared-0.1.
|
|
41
|
+
documente_shared-0.1.82.dist-info/METADATA,sha256=v7-OTNk652qUjZgdJ1Ltfa7g3j3K0Huy_yRaGLOQfb4,881
|
|
42
|
+
documente_shared-0.1.82.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
43
|
+
documente_shared-0.1.82.dist-info/RECORD,,
|
|
File without changes
|