constec 0.4.0__tar.gz → 0.4.1__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.
- {constec-0.4.0 → constec-0.4.1}/PKG-INFO +1 -1
- constec-0.4.1/constec/db/migrations/0005_event.py +46 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/__init__.py +5 -0
- constec-0.4.1/constec/db/models/automation.py +99 -0
- {constec-0.4.0 → constec-0.4.1}/constec.egg-info/PKG-INFO +1 -1
- {constec-0.4.0 → constec-0.4.1}/constec.egg-info/SOURCES.txt +2 -0
- {constec-0.4.0 → constec-0.4.1}/pyproject.toml +1 -1
- {constec-0.4.0 → constec-0.4.1}/LICENSE +0 -0
- {constec-0.4.0 → constec-0.4.1}/README.md +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/__init__.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/apps.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/migrations/0001_initial.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/migrations/0002_module_level.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/migrations/0003_remove_module_level.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/migrations/0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/migrations/__init__.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/base.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/company.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/contact.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/erp.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/erp_entity.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/flow.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/group.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/module.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/organization.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/person.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/session.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/tag.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/db/models/user.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/py.typed +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/services/__init__.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/services/encryption.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/shared/__init__.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/shared/exceptions.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/utils/__init__.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/utils/cuit.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec/utils/password.py +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec.egg-info/dependency_links.txt +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec.egg-info/requires.txt +0 -0
- {constec-0.4.0 → constec-0.4.1}/constec.egg-info/top_level.txt +0 -0
- {constec-0.4.0 → constec-0.4.1}/setup.cfg +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Generated manually on 2026-02-02 for automations schema
|
|
2
|
+
|
|
3
|
+
import uuid
|
|
4
|
+
from django.conf import settings
|
|
5
|
+
from django.db import migrations, models
|
|
6
|
+
import django.db.models.deletion
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
('constec_db', '0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more'),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.CreateModel(
|
|
17
|
+
name='Event',
|
|
18
|
+
fields=[
|
|
19
|
+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
20
|
+
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
21
|
+
('updated_at', models.DateTimeField(auto_now=True)),
|
|
22
|
+
('event_type', models.CharField(choices=[('notification', 'Notification'), ('automation', 'Automation')], max_length=50)),
|
|
23
|
+
('title', models.CharField(max_length=255)),
|
|
24
|
+
('description', models.TextField(blank=True)),
|
|
25
|
+
('status', models.CharField(choices=[('active', 'Active'), ('paused', 'Paused'), ('completed', 'Completed'), ('failed', 'Failed'), ('cancelled', 'Cancelled')], default='active', max_length=20)),
|
|
26
|
+
('recurrence_type', models.CharField(choices=[('punctual', 'Punctual'), ('periodic', 'Periodic')], help_text='Tipo de recurrencia: puntual (fechas específicas) o periódico', max_length=20)),
|
|
27
|
+
('recurrence_config', models.JSONField(help_text='Configuración de recurrencia en formato JSON')),
|
|
28
|
+
('config', models.JSONField(default=dict, help_text='Configuración específica según event_type (mensaje, URL, etc.)')),
|
|
29
|
+
('next_execution_at', models.DateTimeField(blank=True, db_index=True, help_text='Próxima fecha/hora de ejecución calculada', null=True)),
|
|
30
|
+
('last_executed_at', models.DateTimeField(blank=True, help_text='Última vez que se ejecutó', null=True)),
|
|
31
|
+
('execution_count', models.IntegerField(default=0, help_text='Cantidad de veces que se ha ejecutado')),
|
|
32
|
+
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='constec_db.company')),
|
|
33
|
+
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_events', to=settings.AUTH_USER_MODEL)),
|
|
34
|
+
],
|
|
35
|
+
options={
|
|
36
|
+
'db_table': '"automations"."events"',
|
|
37
|
+
'ordering': ['next_execution_at'],
|
|
38
|
+
'indexes': [
|
|
39
|
+
models.Index(fields=['company', 'event_type'], name='automations_company_ebe85a_idx'),
|
|
40
|
+
models.Index(fields=['status', 'next_execution_at'], name='automations_status_a3d45f_idx'),
|
|
41
|
+
models.Index(fields=['recurrence_type'], name='automations_recurre_5d8b2c_idx'),
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
bases=(models.Model,),
|
|
45
|
+
),
|
|
46
|
+
]
|
|
@@ -41,6 +41,9 @@ ErpEntity = Entity
|
|
|
41
41
|
from .flow import FlowTemplate, Flow
|
|
42
42
|
from .session import Session, Message
|
|
43
43
|
|
|
44
|
+
# Automations models (automations schema)
|
|
45
|
+
from .automation import Event
|
|
46
|
+
|
|
44
47
|
|
|
45
48
|
__all__ = [
|
|
46
49
|
# Base
|
|
@@ -89,4 +92,6 @@ __all__ = [
|
|
|
89
92
|
'Flow',
|
|
90
93
|
'Session',
|
|
91
94
|
'Message',
|
|
95
|
+
# Automations (automations schema)
|
|
96
|
+
'Event',
|
|
92
97
|
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Automation models for event scheduling and task automation."""
|
|
2
|
+
|
|
3
|
+
import uuid
|
|
4
|
+
from django.db import models
|
|
5
|
+
from .base import UUIDModel
|
|
6
|
+
from .company import Company
|
|
7
|
+
from .user import User
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Event(UUIDModel):
|
|
11
|
+
"""
|
|
12
|
+
Evento programado con soporte para múltiples tipos y recurrencia flexible.
|
|
13
|
+
|
|
14
|
+
Tipos soportados:
|
|
15
|
+
- notification: Notificaciones programadas
|
|
16
|
+
- automation: Automatizaciones programadas (acciones HTTP, workflows, etc.)
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
EVENT_TYPE_CHOICES = [
|
|
20
|
+
('notification', 'Notification'),
|
|
21
|
+
('automation', 'Automation'),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
STATUS_CHOICES = [
|
|
25
|
+
('active', 'Active'), # Activo y programado
|
|
26
|
+
('paused', 'Paused'), # Pausado temporalmente
|
|
27
|
+
('completed', 'Completed'), # Completado (para puntuales)
|
|
28
|
+
('failed', 'Failed'), # Falló la última ejecución
|
|
29
|
+
('cancelled', 'Cancelled'), # Cancelado permanentemente
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
RECURRENCE_TYPE_CHOICES = [
|
|
33
|
+
('punctual', 'Punctual'), # Una o más veces en fechas específicas
|
|
34
|
+
('periodic', 'Periodic'), # Recurrente
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
# FKs
|
|
38
|
+
company = models.ForeignKey(Company, on_delete=models.CASCADE, db_index=True)
|
|
39
|
+
|
|
40
|
+
# Tipo de evento
|
|
41
|
+
event_type = models.CharField(max_length=50, choices=EVENT_TYPE_CHOICES)
|
|
42
|
+
|
|
43
|
+
# Info básica
|
|
44
|
+
title = models.CharField(max_length=255)
|
|
45
|
+
description = models.TextField(blank=True)
|
|
46
|
+
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='active')
|
|
47
|
+
|
|
48
|
+
# Recurrencia
|
|
49
|
+
recurrence_type = models.CharField(
|
|
50
|
+
max_length=20,
|
|
51
|
+
choices=RECURRENCE_TYPE_CHOICES,
|
|
52
|
+
help_text="Tipo de recurrencia: puntual (fechas específicas) o periódico"
|
|
53
|
+
)
|
|
54
|
+
recurrence_config = models.JSONField(
|
|
55
|
+
help_text="Configuración de recurrencia en formato JSON"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Configuración específica del tipo de evento
|
|
59
|
+
config = models.JSONField(
|
|
60
|
+
default=dict,
|
|
61
|
+
help_text="Configuración específica según event_type (mensaje, URL, etc.)"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Control de ejecución
|
|
65
|
+
next_execution_at = models.DateTimeField(
|
|
66
|
+
null=True,
|
|
67
|
+
blank=True,
|
|
68
|
+
db_index=True,
|
|
69
|
+
help_text="Próxima fecha/hora de ejecución calculada"
|
|
70
|
+
)
|
|
71
|
+
last_executed_at = models.DateTimeField(
|
|
72
|
+
null=True,
|
|
73
|
+
blank=True,
|
|
74
|
+
help_text="Última vez que se ejecutó"
|
|
75
|
+
)
|
|
76
|
+
execution_count = models.IntegerField(
|
|
77
|
+
default=0,
|
|
78
|
+
help_text="Cantidad de veces que se ha ejecutado"
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Auditoría
|
|
82
|
+
created_by = models.ForeignKey(
|
|
83
|
+
User,
|
|
84
|
+
on_delete=models.CASCADE,
|
|
85
|
+
related_name='created_events'
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
class Meta:
|
|
89
|
+
db_table = '"automations"."events"'
|
|
90
|
+
app_label = 'constec_db'
|
|
91
|
+
indexes = [
|
|
92
|
+
models.Index(fields=['company', 'event_type']),
|
|
93
|
+
models.Index(fields=['status', 'next_execution_at']),
|
|
94
|
+
models.Index(fields=['recurrence_type']),
|
|
95
|
+
]
|
|
96
|
+
ordering = ['next_execution_at']
|
|
97
|
+
|
|
98
|
+
def __str__(self):
|
|
99
|
+
return f"{self.event_type}: {self.title}"
|
|
@@ -13,8 +13,10 @@ constec/db/migrations/0001_initial.py
|
|
|
13
13
|
constec/db/migrations/0002_module_level.py
|
|
14
14
|
constec/db/migrations/0003_remove_module_level.py
|
|
15
15
|
constec/db/migrations/0004_rename_entities_company_cuit_idx_entities_company_e2c50f_idx_and_more.py
|
|
16
|
+
constec/db/migrations/0005_event.py
|
|
16
17
|
constec/db/migrations/__init__.py
|
|
17
18
|
constec/db/models/__init__.py
|
|
19
|
+
constec/db/models/automation.py
|
|
18
20
|
constec/db/models/base.py
|
|
19
21
|
constec/db/models/company.py
|
|
20
22
|
constec/db/models/contact.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "constec"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.1"
|
|
8
8
|
description = "Base library for the Constec ecosystem - shared utilities, models, and namespace foundation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|