libretificacaotjcore 0.1.16__tar.gz → 0.1.18__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.
Potentially problematic release.
This version of libretificacaotjcore might be problematic. Click here for more details.
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/PKG-INFO +1 -1
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/database/config_db.py +5 -3
- libretificacaotjcore-0.1.18/libretificacaotjcore/database/protocolo_repository.py +57 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/PKG-INFO +1 -1
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/SOURCES.txt +1 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/pyproject.toml +1 -1
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/README.md +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/__init__.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/database/__init__.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/database/arquivo_repository.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/database/certificado_repository.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/dtos/solicitacao_dto.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/enums/e_eventos.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/services/__init__.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/services/crypto_pass_service.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/services/file_service.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/services/rabbitmq_consumer.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/services/s3_service.py +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/dependency_links.txt +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/requires.txt +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/top_level.txt +0 -0
- {libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libretificacaotjcore
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.18
|
|
4
4
|
Summary: Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ
|
|
5
5
|
Author-email: Jhonatan Azevedo <dev.azevedo@outlook.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/seu-usuario/libretificacaotjcore
|
|
@@ -29,11 +29,13 @@ class ConfigDb:
|
|
|
29
29
|
await self.__db.arquivos.create_index([("SolicitacaoId", 1), ("cpf", 1)], unique=True)
|
|
30
30
|
self.db_initialized = True
|
|
31
31
|
|
|
32
|
-
if "
|
|
33
|
-
await self.__db.create_collection("
|
|
32
|
+
if "protocolos" not in (await self.__db.list_collection_names()):
|
|
33
|
+
await self.__db.create_collection("protocolos")
|
|
34
34
|
|
|
35
35
|
await self.__db.certificados.create_index([("cnpj", 1)], unique=True)
|
|
36
|
-
await self.__db.
|
|
36
|
+
await self.__db.protocolos.create_index([("SolicitacaoId", 1)])
|
|
37
|
+
await self.__db.protocolos.create_index([("id", 1)], unique=True)
|
|
38
|
+
await self.__db.protocolos.create_index([("SolicitacaoId", 1), ("evento", 1)], unique=True)
|
|
37
39
|
self.db_initialized = True
|
|
38
40
|
|
|
39
41
|
async def get_db(self):
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from pymongo.errors import BulkWriteError
|
|
2
|
+
|
|
3
|
+
class ProtocoloRepository:
|
|
4
|
+
def __init__(self, db):
|
|
5
|
+
self.__db = db
|
|
6
|
+
|
|
7
|
+
async def inserir_protocolo(self, protocolo: dict) -> bool:
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
protocolo_no_db = await self.__db.protocolo.find_one(
|
|
11
|
+
{"SolicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if protocolo_no_db is None:
|
|
15
|
+
await self.__db.protocolo.insert_one(protocolo)
|
|
16
|
+
return True
|
|
17
|
+
|
|
18
|
+
await self.__db.protocolo.delete_one(
|
|
19
|
+
{"SolicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
|
|
20
|
+
)
|
|
21
|
+
await self.__db.protocolo.insert_one(protocolo)
|
|
22
|
+
return True
|
|
23
|
+
except Exception as e:
|
|
24
|
+
print(f"❌ Erro ao inserir o protocolo: {e}")
|
|
25
|
+
return False
|
|
26
|
+
|
|
27
|
+
async def inserir_protocolos_em_lote(self, protocolos: list[dict]) -> bool:
|
|
28
|
+
try:
|
|
29
|
+
if not protocolos:
|
|
30
|
+
return False
|
|
31
|
+
|
|
32
|
+
filtros = [{"SolicitacaoId": a["solicitacaoId"], "evento": a["evento"]} for a in protocolos]
|
|
33
|
+
await self.__db.protocolo.delete_many({"$or": filtros})
|
|
34
|
+
|
|
35
|
+
await self.__db.protocolo.insert_many(protocolos)
|
|
36
|
+
return True
|
|
37
|
+
except BulkWriteError as bwe:
|
|
38
|
+
print(f"❌ Erro de escrita em lote: {bwe.details}")
|
|
39
|
+
return False
|
|
40
|
+
except Exception as e:
|
|
41
|
+
print(f"❌ Erro ao inserir protocolos em lote: {e}")
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
async def remover_protocolo(self, solicitacaoId: int) -> bool:
|
|
45
|
+
try:
|
|
46
|
+
await self.__db.protocolo.delete_many({"SolicitacaoId": solicitacaoId})
|
|
47
|
+
return True
|
|
48
|
+
except Exception as e:
|
|
49
|
+
print(f"❌ Erro ao remover o protocolo: {e}")
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
async def buscar_por_solicitacao_id(self, solicitacaoId: int) -> list[dict]:
|
|
53
|
+
try:
|
|
54
|
+
return await self.__db.protocolo.find({"solicitacaoId": solicitacaoId}).to_list(length=None)
|
|
55
|
+
except Exception as e:
|
|
56
|
+
print(f"❌ Erro ao buscar protocolo por solicitacaoId: {e}")
|
|
57
|
+
return []
|
{libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libretificacaotjcore
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.18
|
|
4
4
|
Summary: Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ
|
|
5
5
|
Author-email: Jhonatan Azevedo <dev.azevedo@outlook.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/seu-usuario/libretificacaotjcore
|
|
@@ -10,6 +10,7 @@ libretificacaotjcore/database/__init__.py
|
|
|
10
10
|
libretificacaotjcore/database/arquivo_repository.py
|
|
11
11
|
libretificacaotjcore/database/certificado_repository.py
|
|
12
12
|
libretificacaotjcore/database/config_db.py
|
|
13
|
+
libretificacaotjcore/database/protocolo_repository.py
|
|
13
14
|
libretificacaotjcore/dtos/solicitacao_dto.py
|
|
14
15
|
libretificacaotjcore/enums/e_eventos.py
|
|
15
16
|
libretificacaotjcore/services/__init__.py
|
|
@@ -11,7 +11,7 @@ keywords = ["tj", "tributo justo", "retificação", "automação", "pydantic", "
|
|
|
11
11
|
name = "libretificacaotjcore"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.12"
|
|
14
|
-
version = "0.1.
|
|
14
|
+
version = "0.1.18"
|
|
15
15
|
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
File without changes
|
{libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{libretificacaotjcore-0.1.16 → libretificacaotjcore-0.1.18}/libretificacaotjcore/enums/e_eventos.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
|