libretificacaotjcore 0.1.18__py3-none-any.whl → 0.1.20__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 libretificacaotjcore might be problematic. Click here for more details.

@@ -8,7 +8,7 @@ class ArquivoRepository:
8
8
 
9
9
  try:
10
10
  arquivo_no_db = await self.__db.arquivos.find_one(
11
- {"SolicitacaoId": arquivo["solicitacaoId"], "cpf": arquivo["cpf"]}
11
+ {"solicitacaoId": arquivo["solicitacaoId"], "cpf": arquivo["cpf"]}
12
12
  )
13
13
 
14
14
  if arquivo_no_db is None:
@@ -16,7 +16,7 @@ class ArquivoRepository:
16
16
  return True
17
17
 
18
18
  await self.__db.arquivos.delete_one(
19
- {"SolicitacaoId": arquivo["solicitacaoId"], "cpf": arquivo["cpf"]}
19
+ {"solicitacaoId": arquivo["solicitacaoId"], "cpf": arquivo["cpf"]}
20
20
  )
21
21
  await self.__db.arquivos.insert_one(arquivo)
22
22
  return True
@@ -29,7 +29,7 @@ class ArquivoRepository:
29
29
  if not arquivos:
30
30
  return False
31
31
 
32
- filtros = [{"SolicitacaoId": a["solicitacaoId"], "cpf": a["cpf"]} for a in arquivos]
32
+ filtros = [{"solicitacaoId": a["solicitacaoId"], "cpf": a["cpf"]} for a in arquivos]
33
33
  await self.__db.arquivos.delete_many({"$or": filtros})
34
34
 
35
35
  await self.__db.arquivos.insert_many(arquivos)
@@ -43,7 +43,7 @@ class ArquivoRepository:
43
43
 
44
44
  async def remover_arquivo(self, solicitacaoId: int) -> bool:
45
45
  try:
46
- await self.__db.arquivos.delete_many({"SolicitacaoId": solicitacaoId})
46
+ await self.__db.arquivos.delete_many({"solicitacaoId": solicitacaoId})
47
47
  return True
48
48
  except Exception as e:
49
49
  print(f"❌ Erro ao remover o arquivo: {e}")
@@ -24,18 +24,18 @@ class ConfigDb:
24
24
  await self.__db.create_collection("arquivos")
25
25
 
26
26
  await self.__db.arquivos.create_index([("cnpj", 1)])
27
- await self.__db.arquivos.create_index([("SolicitacaoId", 1)])
27
+ await self.__db.arquivos.create_index([("solicitacaoId", 1)])
28
28
  await self.__db.arquivos.create_index([("id", 1)], unique=True)
29
- await self.__db.arquivos.create_index([("SolicitacaoId", 1), ("cpf", 1)], unique=True)
29
+ await self.__db.arquivos.create_index([("solicitacaoId", 1), ("cpf", 1)], unique=True)
30
30
  self.db_initialized = True
31
31
 
32
32
  if "protocolos" not in (await self.__db.list_collection_names()):
33
33
  await self.__db.create_collection("protocolos")
34
34
 
35
- await self.__db.certificados.create_index([("cnpj", 1)], unique=True)
36
- await self.__db.protocolos.create_index([("SolicitacaoId", 1)])
35
+ await self.__db.protocolos.create_index([("cnpj", 1)], unique=True)
36
+ await self.__db.protocolos.create_index([("solicitacaoId", 1)])
37
37
  await self.__db.protocolos.create_index([("id", 1)], unique=True)
38
- await self.__db.protocolos.create_index([("SolicitacaoId", 1), ("evento", 1)], unique=True)
38
+ await self.__db.protocolos.create_index([("solicitacaoId", 1), ("evento", 1)], unique=True)
39
39
  self.db_initialized = True
40
40
 
41
41
  async def get_db(self):
@@ -7,18 +7,18 @@ class ProtocoloRepository:
7
7
  async def inserir_protocolo(self, protocolo: dict) -> bool:
8
8
 
9
9
  try:
10
- protocolo_no_db = await self.__db.protocolo.find_one(
11
- {"SolicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
10
+ protocolo_no_db = await self.__db.protocolos.find_one(
11
+ {"solicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
12
12
  )
13
13
 
14
14
  if protocolo_no_db is None:
15
- await self.__db.protocolo.insert_one(protocolo)
15
+ await self.__db.protocolos.insert_one(protocolo)
16
16
  return True
17
17
 
18
- await self.__db.protocolo.delete_one(
19
- {"SolicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
18
+ await self.__db.protocolos.delete_one(
19
+ {"solicitacaoId": protocolo["solicitacaoId"], "evento": protocolo["evento"]}
20
20
  )
21
- await self.__db.protocolo.insert_one(protocolo)
21
+ await self.__db.protocolos.insert_one(protocolo)
22
22
  return True
23
23
  except Exception as e:
24
24
  print(f"❌ Erro ao inserir o protocolo: {e}")
@@ -29,10 +29,10 @@ class ProtocoloRepository:
29
29
  if not protocolos:
30
30
  return False
31
31
 
32
- filtros = [{"SolicitacaoId": a["solicitacaoId"], "evento": a["evento"]} for a in protocolos]
33
- await self.__db.protocolo.delete_many({"$or": filtros})
32
+ filtros = [{"solicitacaoId": a["solicitacaoId"], "evento": a["evento"]} for a in protocolos]
33
+ await self.__db.protocolos.delete_many({"$or": filtros})
34
34
 
35
- await self.__db.protocolo.insert_many(protocolos)
35
+ await self.__db.protocolos.insert_many(protocolos)
36
36
  return True
37
37
  except BulkWriteError as bwe:
38
38
  print(f"❌ Erro de escrita em lote: {bwe.details}")
@@ -43,7 +43,7 @@ class ProtocoloRepository:
43
43
 
44
44
  async def remover_protocolo(self, solicitacaoId: int) -> bool:
45
45
  try:
46
- await self.__db.protocolo.delete_many({"SolicitacaoId": solicitacaoId})
46
+ await self.__db.protocolos.delete_many({"solicitacaoId": solicitacaoId})
47
47
  return True
48
48
  except Exception as e:
49
49
  print(f"❌ Erro ao remover o protocolo: {e}")
@@ -51,7 +51,14 @@ class ProtocoloRepository:
51
51
 
52
52
  async def buscar_por_solicitacao_id(self, solicitacaoId: int) -> list[dict]:
53
53
  try:
54
- return await self.__db.protocolo.find({"solicitacaoId": solicitacaoId}).to_list(length=None)
54
+ return await self.__db.protocolos.find({"solicitacaoId": solicitacaoId}).to_list(length=None)
55
55
  except Exception as e:
56
56
  print(f"❌ Erro ao buscar protocolo por solicitacaoId: {e}")
57
- return []
57
+ return []
58
+
59
+ async def buscar_por_solicitacao_id_e_evento(self, solicitacaoId: int, evento: str) -> dict | None:
60
+ try:
61
+ return await self.__db.protocolos.find_one({"solicitacaoId": solicitacaoId, "evento": evento}).to_list(length=None)
62
+ except Exception as e:
63
+ print(f"❌ Erro ao buscar protocolo por solicitacaoId e evento: {e}")
64
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.18
3
+ Version: 0.1.20
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
@@ -1,9 +1,9 @@
1
1
  libretificacaotjcore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  libretificacaotjcore/database/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
3
- libretificacaotjcore/database/arquivo_repository.py,sha256=yKyYXzTyp1xiQsI1Cjh9wrnJACrm7xrgn6hlWgBHe48,2154
3
+ libretificacaotjcore/database/arquivo_repository.py,sha256=Wv42CWjddS8RPVR3aAOGwuFuLyGqmgq-TXOc-V0BTvE,2154
4
4
  libretificacaotjcore/database/certificado_repository.py,sha256=LF3rV1rQmRGZVB4wPh_vmDj81Gf_env_5hqtTbxXNFM,1396
5
- libretificacaotjcore/database/config_db.py,sha256=0_yHP_K2xzp0dx-swpLruxGZxes0PY4lBiUsHxLI5nY,1846
6
- libretificacaotjcore/database/protocolo_repository.py,sha256=UQsu8WPsHoQkhw4QAZOObWB_ptLJOrgqdQYwTSgd7ag,2233
5
+ libretificacaotjcore/database/config_db.py,sha256=CylnnX2l7mzmxi-o7ZeIzhE7y72wHG9SJCS2fX6UsLc,1844
6
+ libretificacaotjcore/database/protocolo_repository.py,sha256=9DcZp_tblGBicz7bkL8KfBCWarbLdX9bVgHUe8GcQ_w,2636
7
7
  libretificacaotjcore/dtos/solicitacao_dto.py,sha256=QJYzI8ii_gTgYTnFN5KFFzKqy_1BkKmbEGdqFnpLq88,2509
8
8
  libretificacaotjcore/enums/e_eventos.py,sha256=x1LXcTLNCAAj1MuQP6jT5vu9cFkoAyGEzPAqQHj_8L8,185
9
9
  libretificacaotjcore/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -11,7 +11,7 @@ libretificacaotjcore/services/crypto_pass_service.py,sha256=9D0vyjan6f_8AfNxGkLp
11
11
  libretificacaotjcore/services/file_service.py,sha256=14CJokBbrsryQGmL0_unH2QKZpnteEAfxf5CPFdv6cE,2075
12
12
  libretificacaotjcore/services/rabbitmq_consumer.py,sha256=a25mRHjbkgO3lkdCJ5NpJfWAGHhVkQDCRDR2t8hMNAI,1710
13
13
  libretificacaotjcore/services/s3_service.py,sha256=HKR_jt2H3XdV1PCzo5R5bnhmoQ3I46Yn5IqAvVPhsjs,2946
14
- libretificacaotjcore-0.1.18.dist-info/METADATA,sha256=HdfZNDDLEWuGZt8-dM-nOCIOPCUD9aQvwfLk5BFRXLY,1468
15
- libretificacaotjcore-0.1.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- libretificacaotjcore-0.1.18.dist-info/top_level.txt,sha256=J9vnz_X9OUnxC-eXHiAzlc9xIrWBwZ5bgnIDQIIFY4c,21
17
- libretificacaotjcore-0.1.18.dist-info/RECORD,,
14
+ libretificacaotjcore-0.1.20.dist-info/METADATA,sha256=zhHUaO2QbzF1Ufh87_ezBGPHkGg4-I4tPklj0zG0z6E,1468
15
+ libretificacaotjcore-0.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ libretificacaotjcore-0.1.20.dist-info/top_level.txt,sha256=J9vnz_X9OUnxC-eXHiAzlc9xIrWBwZ5bgnIDQIIFY4c,21
17
+ libretificacaotjcore-0.1.20.dist-info/RECORD,,