constec 0.3.1__py3-none-any.whl → 0.3.3__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.
@@ -0,0 +1,38 @@
1
+ from django.db import migrations, models
2
+ import django.db.models.deletion
3
+ import uuid
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('constec_db', '0001_initial'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='module',
15
+ name='level',
16
+ field=models.CharField(
17
+ choices=[('organization', 'Organization Level'), ('company', 'Company Level')],
18
+ default='company',
19
+ max_length=20,
20
+ ),
21
+ ),
22
+ migrations.CreateModel(
23
+ name='OrganizationModule',
24
+ fields=[
25
+ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
26
+ ('created_at', models.DateTimeField(auto_now_add=True)),
27
+ ('updated_at', models.DateTimeField(auto_now=True)),
28
+ ('is_enabled', models.BooleanField(default=True)),
29
+ ('settings', models.JSONField(blank=True, default=dict)),
30
+ ('module', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_modules', to='constec_db.module')),
31
+ ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_modules', to='constec_db.organization')),
32
+ ],
33
+ options={
34
+ 'db_table': 'core"."organization_modules',
35
+ 'unique_together': {('organization', 'module')},
36
+ },
37
+ ),
38
+ ]
@@ -24,7 +24,7 @@ from .person import Person
24
24
  from .group import UserGroup
25
25
  from .contact import ContactType, Contact, PersonContact
26
26
  from .tag import TagCategory, PersonTag, PersonTagged
27
- from .module import Module, CompanyModule
27
+ from .module import Module, ModuleLevel, CompanyModule, OrganizationModule
28
28
 
29
29
  # ERP models (erp schema)
30
30
  from .erp import System, CompanySystem, Connection
@@ -69,7 +69,9 @@ __all__ = [
69
69
  'PersonTagged',
70
70
  # Module
71
71
  'Module',
72
+ 'ModuleLevel',
72
73
  'CompanyModule',
74
+ 'OrganizationModule',
73
75
  # ERP (erp schema)
74
76
  'System',
75
77
  'CompanySystem',
@@ -1,6 +1,12 @@
1
1
  from django.db import models
2
2
  from .base import UUIDModel
3
3
  from .company import Company
4
+ from .organization import Organization
5
+
6
+
7
+ class ModuleLevel(models.TextChoices):
8
+ ORGANIZATION = 'organization', 'Organization Level'
9
+ COMPANY = 'company', 'Company Level'
4
10
 
5
11
 
6
12
  class Module(UUIDModel):
@@ -10,6 +16,11 @@ class Module(UUIDModel):
10
16
  description = models.TextField(blank=True, null=True)
11
17
  version = models.CharField(max_length=20)
12
18
  is_active = models.BooleanField(default=True)
19
+ level = models.CharField(
20
+ max_length=20,
21
+ choices=ModuleLevel.choices,
22
+ default=ModuleLevel.COMPANY,
23
+ )
13
24
 
14
25
  class Meta:
15
26
  app_label = 'constec_db'
@@ -41,3 +52,27 @@ class CompanyModule(UUIDModel):
41
52
 
42
53
  def __str__(self):
43
54
  return f"{self.company.name} - {self.module.name}"
55
+
56
+
57
+ class OrganizationModule(UUIDModel):
58
+ """Modules enabled per organization."""
59
+ organization = models.ForeignKey(
60
+ Organization,
61
+ on_delete=models.CASCADE,
62
+ related_name="organization_modules",
63
+ )
64
+ module = models.ForeignKey(
65
+ Module,
66
+ on_delete=models.CASCADE,
67
+ related_name="organization_modules",
68
+ )
69
+ is_enabled = models.BooleanField(default=True)
70
+ settings = models.JSONField(default=dict, blank=True)
71
+
72
+ class Meta:
73
+ app_label = 'constec_db'
74
+ db_table = 'core"."organization_modules'
75
+ unique_together = [['organization', 'module']]
76
+
77
+ def __str__(self):
78
+ return f"{self.organization.name} - {self.module.name}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: constec
3
- Version: 0.3.1
3
+ Version: 0.3.3
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
@@ -2,8 +2,9 @@ constec/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  constec/db/__init__.py,sha256=wou_y3aqCg1xP8Gr13FKRy0kEI2avV-19G3P2g3bzjs,287
3
3
  constec/db/apps.py,sha256=zc-9lGNa049q9bvxV7957EwnZjuBozPLZq594cKAU24,221
4
4
  constec/db/migrations/0001_initial.py,sha256=ru0auCkdz83Qu3e7hGX24WjZXAlM6fE7RZtgAnzANzQ,28979
5
+ constec/db/migrations/0002_module_level.py,sha256=Es27KUOuI_qrlyL8xBTjwsJJHVduAErNxn4Sdi0a-0w,1526
5
6
  constec/db/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- constec/db/models/__init__.py,sha256=xsER3dtbsj14mSb52v1Mf1bE0RzKbvrvwD6xti2RN5s,2132
7
+ constec/db/models/__init__.py,sha256=1jnyjSYHkBbAxAkrPDieRP2zG5QIDHXeNC57q77r_ZE,2210
7
8
  constec/db/models/base.py,sha256=1t_eYXYyggoL5fKLcitRPKr1qUE1Ql3_sOmSHQMD3QE,359
8
9
  constec/db/models/company.py,sha256=9Mr2Q9iSwu4bhp_4KPZqZy4ciJ62rI_AxFWSs1wGGhE,1097
9
10
  constec/db/models/contact.py,sha256=VJ66YgzCqp09dzYM5IK9rZZV1jqBepJQO8YK28gA98k,2106
@@ -11,7 +12,7 @@ constec/db/models/erp.py,sha256=sN0U0XCMNW-pc9CNLZG_kPZeWXznq_XU3ML2zJ3arjA,3518
11
12
  constec/db/models/erp_entity.py,sha256=aussrOd7kyNaP2tRJ5SS_WLzpXcZ-SyBa7KnSCkL89g,3954
12
13
  constec/db/models/flow.py,sha256=K_UA7E4zJ2-UPNp5H9e-lfPeGn0wDEiOl0cRal4Dmb8,4414
13
14
  constec/db/models/group.py,sha256=ueCOIfpmzR683ojWf5vLb6IG_jawfVRM7IJcGK05I3Y,897
14
- constec/db/models/module.py,sha256=na_7pJw8Q2D2UkF86ZwK5VdJnV87yqUOMBvaBLw4KgI,1218
15
+ constec/db/models/module.py,sha256=iWz0ddrkWnYpLXsC0dR2Y1sI09Zdo_DKY6AboDkLKmY,2240
15
16
  constec/db/models/organization.py,sha256=9dbsh5UBShtDRAeyMqqQEPEaflhzS3aiZpRWUiEluBU,1731
16
17
  constec/db/models/person.py,sha256=B4BNdy2AgqmxrZrkWWvqnFxFHs4uO1n61Y_5sP6MsUo,848
17
18
  constec/db/models/session.py,sha256=HeIk5rK25IaxKBRX-XNuJ75ndjJZ08rAdSGTLvTwlLE,2695
@@ -24,8 +25,8 @@ constec/shared/exceptions.py,sha256=8Bih40RWoH0gVhto09mH2ppSQV_drHPnGWITcoD-0J0,
24
25
  constec/utils/__init__.py,sha256=brf-G4UvU-3CK_rKNPTaHwsVsxnoJSbml_QTZJSM7d0,458
25
26
  constec/utils/cuit.py,sha256=dQKGlA4pRQ5DyR-N4BiV8ZsvAle2Vgjif7PU72zHx_A,2753
26
27
  constec/utils/password.py,sha256=XNpTJ9xZQSoZNjXEAnexAEZuYkwW1dFgX4AY-B5Q0gA,1462
27
- constec-0.3.1.dist-info/licenses/LICENSE,sha256=a1R51ONDGq0UQfV-n3ybsNL7EGhcC2sQ1sXvRANaFVI,1064
28
- constec-0.3.1.dist-info/METADATA,sha256=poYgOsy9VNOF5y-075ox5qvgJa0GbvGLgRrOBBhlVoI,2954
29
- constec-0.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
30
- constec-0.3.1.dist-info/top_level.txt,sha256=bQ9AydOLlthShsr7tA7t7ivbLvlLPdhHOo0BdWgnh_Y,8
31
- constec-0.3.1.dist-info/RECORD,,
28
+ constec-0.3.3.dist-info/licenses/LICENSE,sha256=a1R51ONDGq0UQfV-n3ybsNL7EGhcC2sQ1sXvRANaFVI,1064
29
+ constec-0.3.3.dist-info/METADATA,sha256=GRSnfHUriUB8pQzhM3K754CIiG5fwvznL6l16SrYclw,2954
30
+ constec-0.3.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
31
+ constec-0.3.3.dist-info/top_level.txt,sha256=bQ9AydOLlthShsr7tA7t7ivbLvlLPdhHOo0BdWgnh_Y,8
32
+ constec-0.3.3.dist-info/RECORD,,