core-framework 0.12.23__py3-none-any.whl → 0.12.24__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.
- core/__init__.py +1 -1
- core/migrations/state.py +60 -1
- core/views.py +3 -3
- {core_framework-0.12.23.dist-info → core_framework-0.12.24.dist-info}/METADATA +1 -1
- {core_framework-0.12.23.dist-info → core_framework-0.12.24.dist-info}/RECORD +7 -7
- {core_framework-0.12.23.dist-info → core_framework-0.12.24.dist-info}/WHEEL +0 -0
- {core_framework-0.12.23.dist-info → core_framework-0.12.24.dist-info}/entry_points.txt +0 -0
core/__init__.py
CHANGED
core/migrations/state.py
CHANGED
|
@@ -414,21 +414,80 @@ def _extract_enums_from_annotations(model_class: type["Model"]) -> dict[str, Enu
|
|
|
414
414
|
|
|
415
415
|
|
|
416
416
|
def models_to_schema_state(models: list[type["Model"]]) -> SchemaState:
|
|
417
|
-
"""Extrai estado do schema de uma lista de Models."""
|
|
417
|
+
"""Extrai estado do schema de uma lista de Models e tabelas de associação."""
|
|
418
418
|
state = SchemaState()
|
|
419
|
+
processed_tables = set()
|
|
419
420
|
|
|
421
|
+
# 1. Processa models explícitos
|
|
420
422
|
for model in models:
|
|
421
423
|
if hasattr(model, "__table__"):
|
|
422
424
|
table_state = model_to_table_state(model)
|
|
423
425
|
state.tables[table_state.name] = table_state
|
|
426
|
+
processed_tables.add(table_state.name)
|
|
424
427
|
|
|
425
428
|
# Extrai enums do model
|
|
426
429
|
model_enums = _extract_enums_from_annotations(model)
|
|
427
430
|
state.enums.update(model_enums)
|
|
428
431
|
|
|
432
|
+
# 2. Processa tabelas de associação do metadata (ex: PermissionsMixin)
|
|
433
|
+
# Estas são criadas via Table() e não herdam de Model
|
|
434
|
+
if models:
|
|
435
|
+
from core.models import Model as BaseModel
|
|
436
|
+
for table_name, table in BaseModel.metadata.tables.items():
|
|
437
|
+
if table_name in processed_tables:
|
|
438
|
+
continue
|
|
439
|
+
if table_name in INTERNAL_TABLES:
|
|
440
|
+
continue
|
|
441
|
+
if table_name.startswith("_"):
|
|
442
|
+
continue
|
|
443
|
+
|
|
444
|
+
# Extrai estado da tabela de associação
|
|
445
|
+
table_state = _table_to_state(table)
|
|
446
|
+
if table_state:
|
|
447
|
+
state.tables[table_state.name] = table_state
|
|
448
|
+
|
|
429
449
|
return state
|
|
430
450
|
|
|
431
451
|
|
|
452
|
+
def _table_to_state(table) -> TableState | None:
|
|
453
|
+
"""Extrai estado de uma tabela SQLAlchemy (não-model)."""
|
|
454
|
+
try:
|
|
455
|
+
columns = {}
|
|
456
|
+
for col in table.columns:
|
|
457
|
+
auto_inc = col.autoincrement
|
|
458
|
+
if auto_inc == "auto":
|
|
459
|
+
auto_inc = col.primary_key
|
|
460
|
+
else:
|
|
461
|
+
auto_inc = bool(auto_inc)
|
|
462
|
+
|
|
463
|
+
columns[col.name] = ColumnState(
|
|
464
|
+
name=col.name,
|
|
465
|
+
type=get_sqlalchemy_type_string(col.type),
|
|
466
|
+
nullable=col.nullable,
|
|
467
|
+
default=col.default.arg if col.default is not None else None,
|
|
468
|
+
primary_key=col.primary_key,
|
|
469
|
+
autoincrement=auto_inc,
|
|
470
|
+
unique=col.unique if col.unique else False,
|
|
471
|
+
index=col.index if col.index else False,
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
foreign_keys = []
|
|
475
|
+
for fk in table.foreign_keys:
|
|
476
|
+
foreign_keys.append(ForeignKeyState(
|
|
477
|
+
column=fk.parent.name,
|
|
478
|
+
references_table=fk.column.table.name,
|
|
479
|
+
references_column=fk.column.name,
|
|
480
|
+
))
|
|
481
|
+
|
|
482
|
+
return TableState(
|
|
483
|
+
name=table.name,
|
|
484
|
+
columns=columns,
|
|
485
|
+
foreign_keys=foreign_keys,
|
|
486
|
+
)
|
|
487
|
+
except Exception:
|
|
488
|
+
return None
|
|
489
|
+
|
|
490
|
+
|
|
432
491
|
# Tabelas internas do framework que devem ser ignoradas em migrações
|
|
433
492
|
# Estas tabelas são gerenciadas pelo Core Framework e não devem ser
|
|
434
493
|
# modificadas por makemigrations ou migrate
|
core/views.py
CHANGED
|
@@ -462,11 +462,11 @@ class ViewSet(Generic[ModelT, InputT, OutputT]):
|
|
|
462
462
|
except (ValueError, TypeError):
|
|
463
463
|
self._raise_invalid_lookup_error(value, "integer")
|
|
464
464
|
|
|
465
|
-
# UUID
|
|
466
|
-
if type_name in ('UUID', 'GUID') or isinstance(field_type, PG_UUID):
|
|
465
|
+
# UUID (includes core.fields.Uuid, SQLAlchemy UUID, PostgreSQL UUID)
|
|
466
|
+
if type_name in ('UUID', 'GUID', 'Uuid') or isinstance(field_type, PG_UUID):
|
|
467
467
|
try:
|
|
468
468
|
return uuid.UUID(value)
|
|
469
|
-
except (ValueError, TypeError):
|
|
469
|
+
except (ValueError, TypeError, AttributeError):
|
|
470
470
|
self._raise_invalid_lookup_error(value, "UUID")
|
|
471
471
|
|
|
472
472
|
# String - sem conversão necessária
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: core-framework
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.24
|
|
4
4
|
Summary: Core Framework - Django-inspired, FastAPI-powered. Alta performance, baixo acoplamento, produtividade extrema.
|
|
5
5
|
Project-URL: Homepage, https://github.com/SorPuti/core-framework
|
|
6
6
|
Project-URL: Documentation, https://github.com/SorPuti/core-framework#readme
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
core/__init__.py,sha256=
|
|
1
|
+
core/__init__.py,sha256=bTQFwvTF8Svt7YxyN_7eV7Zzq5K_ErSVTDhDrU_A35o,12232
|
|
2
2
|
core/app.py,sha256=SsMC5Vlj6PNgACXlfeccOm6CQEKfgh3q3X2p9ubRDlQ,23092
|
|
3
3
|
core/choices.py,sha256=rhcL3p2dB7RK99zIilpmoTFVcibQEIaRpz0CY0kImCE,10502
|
|
4
4
|
core/config.py,sha256=dq4O7QBdrdwj-fZRe2yhX1fKyi_Uetb6sx9-RovJ-9c,14771
|
|
@@ -17,7 +17,7 @@ core/serializers.py,sha256=gR5Y7wTACm1pECkUEpAKBUbPmONGLMDDwej4fyIiOdo,9438
|
|
|
17
17
|
core/tenancy.py,sha256=R4tNrLcAgRRDSqOvJS2IRXcD2J-zoCE4ng01ip9xWKI,9169
|
|
18
18
|
core/validation.py,sha256=F6sq6g2hzhgQ10nVMc9cdXqK4Og00nCjgdkAi5TlpJw,24533
|
|
19
19
|
core/validators.py,sha256=LCDyvqwIKnMaUEdaVx5kWveZt3XsydknZ_bxBL4ic5U,27895
|
|
20
|
-
core/views.py,sha256=
|
|
20
|
+
core/views.py,sha256=3qv4Gv9nf5uzVFjPyB7ufNVTn8Wa8DoPu6SEoGUTtpk,47032
|
|
21
21
|
core/auth/__init__.py,sha256=_yr4rMMvDt_uKujzkKfqlQZ6x9UiQ6jmRppw14hTQNc,4645
|
|
22
22
|
core/auth/backends.py,sha256=PkLk2RQN2rQdtYSiN0mn7cqSp95hnLjO9xTFZqSsPF8,10486
|
|
23
23
|
core/auth/base.py,sha256=Q7vXgwTmgdmyW7G8eJmDket2bKB_8YFnraZ_kK9_gTs,21425
|
|
@@ -66,7 +66,7 @@ core/migrations/cli.py,sha256=mR3lIFTlXSvupFOPVlfuC-urJyDfNFR9nqYZn4TjIco,12019
|
|
|
66
66
|
core/migrations/engine.py,sha256=upRqywA7-MhQXbEiAYdXL1IFQVbtb7M5xApOFrywmlQ,31816
|
|
67
67
|
core/migrations/migration.py,sha256=Xv5MSNLvGAR9wnuMc4GRwciUSuU22AxWlWZP-hsVliI,2748
|
|
68
68
|
core/migrations/operations.py,sha256=VtycE1v7iKr9hfrNzz_ARLB_H6FE9St8_AHldC_E7Eo,25749
|
|
69
|
-
core/migrations/state.py,sha256=
|
|
69
|
+
core/migrations/state.py,sha256=EZeNx-c6qCsJPg5ZSDJirC1Nl2AAhvMlRbOcOmIeqeU,19522
|
|
70
70
|
core/tasks/__init__.py,sha256=rDP4PD7Qtw8qbSbOtxMco9w2wBxRJl5uHiLUEDM0DYI,1662
|
|
71
71
|
core/tasks/base.py,sha256=0EWEzWTez0iF6nlI7Aw3stZtBk0Cr7zZ9btI89YdWPU,11762
|
|
72
72
|
core/tasks/config.py,sha256=1DFP5THa49-Dnr_-9oXR11BLZz4QXWaMCFQEbaFnICs,5602
|
|
@@ -87,7 +87,7 @@ example/auth.py,sha256=zBpLutb8lVKnGfQqQ2wnyygsSutHYZzeJBuhnFhxBaQ,4971
|
|
|
87
87
|
example/models.py,sha256=xKdx0kJ9n0tZ7sCce3KhV3BTvKvsh6m7G69eFm3ukf0,4549
|
|
88
88
|
example/schemas.py,sha256=wJ9QofnuHp4PjtM_IuMMBLVFVDJ4YlwcF6uQm1ooKiY,6139
|
|
89
89
|
example/views.py,sha256=GQwgQcW6yoeUIDbF7-lsaZV7cs8G1S1vGVtiwVpZIQE,14338
|
|
90
|
-
core_framework-0.12.
|
|
91
|
-
core_framework-0.12.
|
|
92
|
-
core_framework-0.12.
|
|
93
|
-
core_framework-0.12.
|
|
90
|
+
core_framework-0.12.24.dist-info/METADATA,sha256=uiEGuIslqlWME_GBME5rsZUfGXswtLcXAR19w9uBgXw,13021
|
|
91
|
+
core_framework-0.12.24.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
92
|
+
core_framework-0.12.24.dist-info/entry_points.txt,sha256=MJytamxHbn0CyH3HbxiP-PqOWekjYUo2CA6EWiKWuSI,78
|
|
93
|
+
core_framework-0.12.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|