libretificacaotjcore 0.1.25__tar.gz → 0.1.27__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.25 → libretificacaotjcore-0.1.27}/PKG-INFO +1 -1
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/dtos/solicitacao_dto.py +13 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/enums/e_eventos.py +1 -1
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/services/rabbitmq_consumer.py +6 -5
- libretificacaotjcore-0.1.27/libretificacaotjcore/services/rabbitmq_publisher.py +53 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore.egg-info/PKG-INFO +1 -1
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore.egg-info/SOURCES.txt +1 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/pyproject.toml +1 -1
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/README.md +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/__init__.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/database/__init__.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/database/arquivo_repository.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/database/certificado_repository.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/database/config_db.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/database/protocolo_repository.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/dtos/__init__.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/dtos/arquivo_dto.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/enums/__init__.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/services/__init__.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/services/crypto_pass_service.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/services/file_service.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/services/s3_service.py +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore.egg-info/dependency_links.txt +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore.egg-info/requires.txt +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore.egg-info/top_level.txt +0 -0
- {libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/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.27
|
|
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
|
|
@@ -3,6 +3,8 @@ from datetime import date, datetime, timedelta
|
|
|
3
3
|
|
|
4
4
|
from pydantic import BaseModel, Field, field_validator
|
|
5
5
|
|
|
6
|
+
from libretificacaotjcore.enums.e_eventos import EEventos
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
class SolicitacaoDTO(BaseModel):
|
|
8
10
|
SolicitacaoId: int = Field(..., description="ID da solicitação")
|
|
@@ -10,6 +12,7 @@ class SolicitacaoDTO(BaseModel):
|
|
|
10
12
|
DataInicio: date = Field(..., description="Data de início no formato YYYY-MM-DD")
|
|
11
13
|
DataFim: date = Field(..., description="Data de fim no formato YYYY-MM-DD")
|
|
12
14
|
CertificadoId: int = Field(..., description="ID do certificado")
|
|
15
|
+
Evento: str | None = Field(None, description="Evento de retificação")
|
|
13
16
|
|
|
14
17
|
@field_validator("SolicitacaoId")
|
|
15
18
|
@classmethod
|
|
@@ -54,3 +57,13 @@ class SolicitacaoDTO(BaseModel):
|
|
|
54
57
|
else:
|
|
55
58
|
proximo_mes = datetime(ano, mes + 1, 1)
|
|
56
59
|
return (proximo_mes - timedelta(days=1)).date()
|
|
60
|
+
|
|
61
|
+
@field_validator("Evento")
|
|
62
|
+
@classmethod
|
|
63
|
+
def validar_eventos(cls, v: str) -> str | None:
|
|
64
|
+
if v is None:
|
|
65
|
+
return v
|
|
66
|
+
|
|
67
|
+
if v not in EEventos:
|
|
68
|
+
raise ValueError(f"Evento '{v}' não é válido.")
|
|
69
|
+
return v
|
|
@@ -5,11 +5,11 @@ import json
|
|
|
5
5
|
class RabbitMQConsumer:
|
|
6
6
|
def __init__(
|
|
7
7
|
self,
|
|
8
|
-
host,
|
|
9
|
-
queue,
|
|
10
|
-
username,
|
|
11
|
-
password,
|
|
12
|
-
vhost="/",
|
|
8
|
+
host: str,
|
|
9
|
+
queue: str,
|
|
10
|
+
username: str,
|
|
11
|
+
password: str,
|
|
12
|
+
vhost: str ="/",
|
|
13
13
|
):
|
|
14
14
|
self.host = host
|
|
15
15
|
self.queue = queue
|
|
@@ -18,6 +18,7 @@ class RabbitMQConsumer:
|
|
|
18
18
|
self.vhost = vhost
|
|
19
19
|
self.connection = None
|
|
20
20
|
self.channel = None
|
|
21
|
+
self.connect()
|
|
21
22
|
|
|
22
23
|
def connect(self):
|
|
23
24
|
credentials = pika.PlainCredentials(self.username, self.password)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import pika
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
class RabbitMQPublisher:
|
|
5
|
+
def __init__(
|
|
6
|
+
self,
|
|
7
|
+
host: str,
|
|
8
|
+
queue: str,
|
|
9
|
+
username: str,
|
|
10
|
+
password: str,
|
|
11
|
+
vhost: str = "/",
|
|
12
|
+
):
|
|
13
|
+
self.host = host
|
|
14
|
+
self.queue = queue
|
|
15
|
+
self.username = username
|
|
16
|
+
self.password = password
|
|
17
|
+
self.vhost = vhost
|
|
18
|
+
self.connection = None
|
|
19
|
+
self.channel = None
|
|
20
|
+
self.connect()
|
|
21
|
+
|
|
22
|
+
def connect(self):
|
|
23
|
+
credentials = pika.PlainCredentials(self.username, self.password)
|
|
24
|
+
parameters = pika.ConnectionParameters(
|
|
25
|
+
host=self.host,
|
|
26
|
+
credentials=credentials,
|
|
27
|
+
virtual_host=self.vhost,
|
|
28
|
+
heartbeat=60,
|
|
29
|
+
blocked_connection_timeout=300,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
self.connection = pika.BlockingConnection(parameters)
|
|
33
|
+
self.channel = self.connection.channel()
|
|
34
|
+
self.channel.queue_declare(queue=self.queue, durable=True)
|
|
35
|
+
|
|
36
|
+
def publish(self, message: dict):
|
|
37
|
+
if not self.channel:
|
|
38
|
+
raise RuntimeError("❌ Canal RabbitMQ não conectado. Chame connect() antes.")
|
|
39
|
+
|
|
40
|
+
body = json.dumps(message)
|
|
41
|
+
self.channel.basic_publish(
|
|
42
|
+
exchange="",
|
|
43
|
+
routing_key=self.queue,
|
|
44
|
+
body=body,
|
|
45
|
+
properties=pika.BasicProperties(
|
|
46
|
+
delivery_mode=2 # torna a mensagem persistente
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
print(f"✅ Mensagem publicada na fila '{self.queue}': {message}")
|
|
50
|
+
|
|
51
|
+
def close(self):
|
|
52
|
+
if self.connection:
|
|
53
|
+
self.connection.close()
|
{libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/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.27
|
|
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
|
|
@@ -20,4 +20,5 @@ libretificacaotjcore/services/__init__.py
|
|
|
20
20
|
libretificacaotjcore/services/crypto_pass_service.py
|
|
21
21
|
libretificacaotjcore/services/file_service.py
|
|
22
22
|
libretificacaotjcore/services/rabbitmq_consumer.py
|
|
23
|
+
libretificacaotjcore/services/rabbitmq_publisher.py
|
|
23
24
|
libretificacaotjcore/services/s3_service.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.27"
|
|
15
15
|
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
File without changes
|
{libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/dtos/__init__.py
RENAMED
|
File without changes
|
{libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/dtos/arquivo_dto.py
RENAMED
|
File without changes
|
{libretificacaotjcore-0.1.25 → libretificacaotjcore-0.1.27}/libretificacaotjcore/enums/__init__.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
|