constec 0.2.1__tar.gz → 0.3.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.
Files changed (36) hide show
  1. {constec-0.2.1 → constec-0.3.1}/PKG-INFO +1 -1
  2. {constec-0.2.1 → constec-0.3.1}/constec/db/migrations/0001_initial.py +14 -2
  3. {constec-0.2.1 → constec-0.3.1}/constec/db/models/company.py +1 -0
  4. {constec-0.2.1 → constec-0.3.1}/constec/db/models/contact.py +3 -0
  5. {constec-0.2.1 → constec-0.3.1}/constec/db/models/erp_entity.py +17 -2
  6. {constec-0.2.1 → constec-0.3.1}/constec/db/models/tag.py +2 -0
  7. {constec-0.2.1 → constec-0.3.1}/constec/db/models/user.py +2 -0
  8. {constec-0.2.1 → constec-0.3.1}/constec.egg-info/PKG-INFO +1 -1
  9. {constec-0.2.1 → constec-0.3.1}/pyproject.toml +1 -1
  10. {constec-0.2.1 → constec-0.3.1}/LICENSE +0 -0
  11. {constec-0.2.1 → constec-0.3.1}/README.md +0 -0
  12. {constec-0.2.1 → constec-0.3.1}/constec/db/__init__.py +0 -0
  13. {constec-0.2.1 → constec-0.3.1}/constec/db/apps.py +0 -0
  14. {constec-0.2.1 → constec-0.3.1}/constec/db/migrations/__init__.py +0 -0
  15. {constec-0.2.1 → constec-0.3.1}/constec/db/models/__init__.py +0 -0
  16. {constec-0.2.1 → constec-0.3.1}/constec/db/models/base.py +0 -0
  17. {constec-0.2.1 → constec-0.3.1}/constec/db/models/erp.py +0 -0
  18. {constec-0.2.1 → constec-0.3.1}/constec/db/models/flow.py +0 -0
  19. {constec-0.2.1 → constec-0.3.1}/constec/db/models/group.py +0 -0
  20. {constec-0.2.1 → constec-0.3.1}/constec/db/models/module.py +0 -0
  21. {constec-0.2.1 → constec-0.3.1}/constec/db/models/organization.py +0 -0
  22. {constec-0.2.1 → constec-0.3.1}/constec/db/models/person.py +0 -0
  23. {constec-0.2.1 → constec-0.3.1}/constec/db/models/session.py +0 -0
  24. {constec-0.2.1 → constec-0.3.1}/constec/py.typed +0 -0
  25. {constec-0.2.1 → constec-0.3.1}/constec/services/__init__.py +0 -0
  26. {constec-0.2.1 → constec-0.3.1}/constec/services/encryption.py +0 -0
  27. {constec-0.2.1 → constec-0.3.1}/constec/shared/__init__.py +0 -0
  28. {constec-0.2.1 → constec-0.3.1}/constec/shared/exceptions.py +0 -0
  29. {constec-0.2.1 → constec-0.3.1}/constec/utils/__init__.py +0 -0
  30. {constec-0.2.1 → constec-0.3.1}/constec/utils/cuit.py +0 -0
  31. {constec-0.2.1 → constec-0.3.1}/constec/utils/password.py +0 -0
  32. {constec-0.2.1 → constec-0.3.1}/constec.egg-info/SOURCES.txt +0 -0
  33. {constec-0.2.1 → constec-0.3.1}/constec.egg-info/dependency_links.txt +0 -0
  34. {constec-0.2.1 → constec-0.3.1}/constec.egg-info/requires.txt +0 -0
  35. {constec-0.2.1 → constec-0.3.1}/constec.egg-info/top_level.txt +0 -0
  36. {constec-0.2.1 → constec-0.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: constec
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: Base library for the Constec ecosystem - shared utilities, models, and namespace foundation
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/TpmyCT/constec-python
@@ -34,6 +34,7 @@ class Migration(migrations.Migration):
34
34
  ],
35
35
  options={
36
36
  'db_table': 'erp"."entities',
37
+ 'verbose_name_plural': 'Entities',
37
38
  },
38
39
  ),
39
40
  migrations.CreateModel(
@@ -121,12 +122,14 @@ class Migration(migrations.Migration):
121
122
  ],
122
123
  options={
123
124
  'db_table': 'core"."companies',
125
+ 'verbose_name_plural': 'Companies',
124
126
  },
125
127
  ),
126
128
  migrations.CreateModel(
127
129
  name='Contact',
128
130
  fields=[
129
131
  ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
132
+ ('label', models.CharField(blank=True, help_text="Optional label (e.g. 'Personal', 'Work')", max_length=100)),
130
133
  ('value', models.CharField(max_length=255)),
131
134
  ('metadata', models.JSONField(blank=True, default=dict)),
132
135
  ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to='constec_db.contacttype')),
@@ -236,6 +239,11 @@ class Migration(migrations.Migration):
236
239
  'db_table': 'core"."persons',
237
240
  },
238
241
  ),
242
+ migrations.AddField(
243
+ model_name='entity',
244
+ name='company',
245
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='erp_entities', to='constec_db.company'),
246
+ ),
239
247
  migrations.AddField(
240
248
  model_name='entity',
241
249
  name='person',
@@ -372,6 +380,8 @@ class Migration(migrations.Migration):
372
380
  ],
373
381
  options={
374
382
  'db_table': 'core"."tag_categories',
383
+ 'verbose_name': 'Tag category',
384
+ 'verbose_name_plural': 'Tag categories',
375
385
  },
376
386
  ),
377
387
  migrations.AddField(
@@ -430,6 +440,8 @@ class Migration(migrations.Migration):
430
440
  ],
431
441
  options={
432
442
  'db_table': 'core"."user_company_access',
443
+ 'verbose_name': 'User company access',
444
+ 'verbose_name_plural': 'User company access',
433
445
  },
434
446
  ),
435
447
  migrations.AddIndex(
@@ -498,11 +510,11 @@ class Migration(migrations.Migration):
498
510
  ),
499
511
  migrations.AddIndex(
500
512
  model_name='entity',
501
- index=models.Index(fields=['system', 'cuit'], name='entities_system__347218_idx'),
513
+ index=models.Index(fields=['company', 'cuit'], name='entities_company_cuit_idx'),
502
514
  ),
503
515
  migrations.AlterUniqueTogether(
504
516
  name='entity',
505
- unique_together={('system', 'role', 'external_id')},
517
+ unique_together={('company', 'role', 'external_id')},
506
518
  ),
507
519
  migrations.AlterUniqueTogether(
508
520
  name='connection',
@@ -27,6 +27,7 @@ class Company(UUIDModel):
27
27
  class Meta:
28
28
  app_label = 'constec_db'
29
29
  db_table = 'core"."companies'
30
+ verbose_name_plural = 'Companies'
30
31
 
31
32
  def __str__(self):
32
33
  return self.name
@@ -23,6 +23,7 @@ class Contact(UUIDModel):
23
23
  on_delete=models.CASCADE,
24
24
  related_name="contacts",
25
25
  )
26
+ label = models.CharField(max_length=100, blank=True, help_text="Optional label (e.g. 'Personal', 'Work')")
26
27
  value = models.CharField(max_length=255)
27
28
  metadata = models.JSONField(default=dict, blank=True)
28
29
 
@@ -31,6 +32,8 @@ class Contact(UUIDModel):
31
32
  db_table = 'core"."contacts'
32
33
 
33
34
  def __str__(self):
35
+ if self.label:
36
+ return f"{self.label}: {self.value} ({self.type.name})"
34
37
  return f"{self.value} ({self.type.name})"
35
38
 
36
39
 
@@ -1,5 +1,7 @@
1
+ from django.core.exceptions import ValidationError
1
2
  from django.db import models
2
3
  from .base import UUIDModel
4
+ from .company import Company
3
5
  from .erp import System
4
6
  from .person import Person
5
7
 
@@ -30,6 +32,11 @@ class Entity(UUIDModel):
30
32
  but no Core account yet). When they authenticate via CUIT, we can
31
33
  optionally link them to a Person later.
32
34
  """
35
+ company = models.ForeignKey(
36
+ Company,
37
+ on_delete=models.CASCADE,
38
+ related_name="erp_entities",
39
+ )
33
40
  person = models.ForeignKey(
34
41
  Person,
35
42
  on_delete=models.CASCADE,
@@ -63,12 +70,20 @@ class Entity(UUIDModel):
63
70
  class Meta:
64
71
  app_label = 'constec_db'
65
72
  db_table = '"erp"."entities"'
66
- unique_together = [['system', 'role', 'external_id']]
73
+ verbose_name_plural = 'Entities'
74
+ unique_together = [['company', 'role', 'external_id']]
67
75
  indexes = [
68
76
  models.Index(fields=['cuit']),
69
- models.Index(fields=['system', 'cuit']),
77
+ models.Index(fields=['company', 'cuit']),
70
78
  ]
71
79
 
80
+ def clean(self):
81
+ from .erp import CompanySystem
82
+ if not CompanySystem.objects.filter(company=self.company, system=self.system).exists():
83
+ raise ValidationError(
84
+ f"Company {self.company} is not associated with System {self.system}"
85
+ )
86
+
72
87
  def __str__(self):
73
88
  person_info = f"({self.person.full_name})" if self.person else "(no person linked)"
74
89
  return f"[{self.system.name}] {self.role.name} {self.external_id} {person_info}"
@@ -17,6 +17,8 @@ class TagCategory(UUIDModel):
17
17
  class Meta:
18
18
  app_label = 'constec_db'
19
19
  db_table = 'core"."tag_categories'
20
+ verbose_name = 'Tag category'
21
+ verbose_name_plural = 'Tag categories'
20
22
 
21
23
  def __str__(self):
22
24
  return f"{self.name}"
@@ -66,6 +66,8 @@ class UserCompanyAccess(UUIDModel):
66
66
  class Meta:
67
67
  app_label = 'constec_db'
68
68
  db_table = 'core"."user_company_access'
69
+ verbose_name = 'User company access'
70
+ verbose_name_plural = 'User company access'
69
71
  unique_together = [['user', 'company']]
70
72
 
71
73
  def __str__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: constec
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: Base library for the Constec ecosystem - shared utilities, models, and namespace foundation
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/TpmyCT/constec-python
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "constec"
7
- version = "0.2.1"
7
+ version = "0.3.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