GeneralManager 0.0.0__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 (56) hide show
  1. generalmanager-0.0.0/GeneralManager.egg-info/PKG-INFO +207 -0
  2. generalmanager-0.0.0/GeneralManager.egg-info/SOURCES.txt +54 -0
  3. generalmanager-0.0.0/GeneralManager.egg-info/dependency_links.txt +1 -0
  4. generalmanager-0.0.0/GeneralManager.egg-info/requires.txt +26 -0
  5. generalmanager-0.0.0/GeneralManager.egg-info/top_level.txt +1 -0
  6. generalmanager-0.0.0/LICENSE +29 -0
  7. generalmanager-0.0.0/PKG-INFO +207 -0
  8. generalmanager-0.0.0/README.md +142 -0
  9. generalmanager-0.0.0/pyproject.toml +43 -0
  10. generalmanager-0.0.0/setup.cfg +4 -0
  11. generalmanager-0.0.0/src/general_manager/__init__.py +0 -0
  12. generalmanager-0.0.0/src/general_manager/api/graphql.py +732 -0
  13. generalmanager-0.0.0/src/general_manager/api/mutation.py +143 -0
  14. generalmanager-0.0.0/src/general_manager/api/property.py +20 -0
  15. generalmanager-0.0.0/src/general_manager/apps.py +83 -0
  16. generalmanager-0.0.0/src/general_manager/auxiliary/__init__.py +2 -0
  17. generalmanager-0.0.0/src/general_manager/auxiliary/argsToKwargs.py +25 -0
  18. generalmanager-0.0.0/src/general_manager/auxiliary/filterParser.py +97 -0
  19. generalmanager-0.0.0/src/general_manager/auxiliary/noneToZero.py +12 -0
  20. generalmanager-0.0.0/src/general_manager/cache/cacheDecorator.py +72 -0
  21. generalmanager-0.0.0/src/general_manager/cache/cacheTracker.py +33 -0
  22. generalmanager-0.0.0/src/general_manager/cache/dependencyIndex.py +300 -0
  23. generalmanager-0.0.0/src/general_manager/cache/pathMapping.py +151 -0
  24. generalmanager-0.0.0/src/general_manager/cache/signals.py +48 -0
  25. generalmanager-0.0.0/src/general_manager/factory/__init__.py +5 -0
  26. generalmanager-0.0.0/src/general_manager/factory/factories.py +287 -0
  27. generalmanager-0.0.0/src/general_manager/factory/lazy_methods.py +38 -0
  28. generalmanager-0.0.0/src/general_manager/interface/__init__.py +3 -0
  29. generalmanager-0.0.0/src/general_manager/interface/baseInterface.py +308 -0
  30. generalmanager-0.0.0/src/general_manager/interface/calculationInterface.py +406 -0
  31. generalmanager-0.0.0/src/general_manager/interface/databaseInterface.py +726 -0
  32. generalmanager-0.0.0/src/general_manager/manager/__init__.py +3 -0
  33. generalmanager-0.0.0/src/general_manager/manager/generalManager.py +136 -0
  34. generalmanager-0.0.0/src/general_manager/manager/groupManager.py +288 -0
  35. generalmanager-0.0.0/src/general_manager/manager/input.py +48 -0
  36. generalmanager-0.0.0/src/general_manager/manager/meta.py +75 -0
  37. generalmanager-0.0.0/src/general_manager/measurement/__init__.py +2 -0
  38. generalmanager-0.0.0/src/general_manager/measurement/measurement.py +233 -0
  39. generalmanager-0.0.0/src/general_manager/measurement/measurementField.py +152 -0
  40. generalmanager-0.0.0/src/general_manager/permission/__init__.py +1 -0
  41. generalmanager-0.0.0/src/general_manager/permission/basePermission.py +178 -0
  42. generalmanager-0.0.0/src/general_manager/permission/fileBasedPermission.py +0 -0
  43. generalmanager-0.0.0/src/general_manager/permission/managerBasedPermission.py +171 -0
  44. generalmanager-0.0.0/src/general_manager/permission/permissionChecks.py +53 -0
  45. generalmanager-0.0.0/src/general_manager/permission/permissionDataManager.py +55 -0
  46. generalmanager-0.0.0/src/general_manager/rule/__init__.py +1 -0
  47. generalmanager-0.0.0/src/general_manager/rule/handler.py +122 -0
  48. generalmanager-0.0.0/src/general_manager/rule/rule.py +313 -0
  49. generalmanager-0.0.0/tests/test_argsToKwargs.py +45 -0
  50. generalmanager-0.0.0/tests/test_basePermission.py +146 -0
  51. generalmanager-0.0.0/tests/test_graph_ql.py +358 -0
  52. generalmanager-0.0.0/tests/test_managerBasedPermission.py +293 -0
  53. generalmanager-0.0.0/tests/test_measurement.py +140 -0
  54. generalmanager-0.0.0/tests/test_measurement_field.py +122 -0
  55. generalmanager-0.0.0/tests/test_rules.py +189 -0
  56. generalmanager-0.0.0/tests/test_settings.py +19 -0
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: GeneralManager
3
+ Version: 0.0.0
4
+ Summary: Kurzbeschreibung deines Pakets
5
+ Author-email: Tim Kleindick <tkleindick@yahoo.de>
6
+ License: Non-Commercial MIT License
7
+
8
+ Copyright (c) 2025 Tim Kleindick
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the “Software”), to deal
12
+ in the Software **solely for non-commercial purposes**, including without
13
+ limitation the rights to use, copy, modify, merge, publish, distribute,
14
+ sublicense, and/or sell copies of the Software **for non-commercial use only**,
15
+ and to permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ 1. Non-Commercial Use Only
19
+ The Software may **not** be used for commercial purposes. “Commercial” means
20
+ any activity intended for or directed toward commercial advantage or
21
+ monetary compensation.
22
+
23
+ 2. Copyright Notice & License Text
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ 3. Disclaimer of Warranty
28
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL
31
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+ Requires-Python: >=3.12
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: asgiref>=3.8.1
39
+ Requires-Dist: Django>=5.2
40
+ Requires-Dist: django-simple-history>=3.8.0
41
+ Requires-Dist: exrex>=0.12.0
42
+ Requires-Dist: factory_boy>=3.3.3
43
+ Requires-Dist: Faker>=37.1.0
44
+ Requires-Dist: flexcache>=0.3
45
+ Requires-Dist: flexparser>=0.4
46
+ Requires-Dist: gitdb>=4.0.12
47
+ Requires-Dist: GitPython>=3.1.41
48
+ Requires-Dist: graphene>=3.4.3
49
+ Requires-Dist: graphene-django>=3.2.3
50
+ Requires-Dist: graphql-core>=3.2.6
51
+ Requires-Dist: graphql-relay>=3.2.0
52
+ Requires-Dist: numpy>=2.2.5
53
+ Requires-Dist: Pint>=0.24.4
54
+ Requires-Dist: platformdirs>=4.3.7
55
+ Requires-Dist: promise>=2.3
56
+ Requires-Dist: python-dateutil>=2.9.0.post0
57
+ Requires-Dist: setuptools>=75.6.0
58
+ Requires-Dist: six>=1.17.0
59
+ Requires-Dist: smmap>=5.0.2
60
+ Requires-Dist: sqlparse>=0.5.3
61
+ Requires-Dist: text-unidecode>=1.3
62
+ Requires-Dist: typing_extensions>=4.13.2
63
+ Requires-Dist: tzdata>=2025.2
64
+ Dynamic: license-file
65
+
66
+ # GeneralManager
67
+
68
+ ## Überblick
69
+
70
+ Das GeneralManager-Modul ist ein leistungsstarkes und flexibles Framework, das speziell für die Verwaltung und Verarbeitung von Daten entwickelt wurde. Es bietet eine modulare Struktur, die es Entwicklern ermöglicht, komplexe Geschäftslogiken effizient zu implementieren und zu verwalten. Das Modul ist vollständig in Python geschrieben und nutzt Django als Backend-Framework.
71
+
72
+ ## Hauptfunktionen
73
+
74
+ ### 1. **Datenmanagement**
75
+ - **Flexibilität**: Unterstützt die Verwaltung aller Arten von Daten, nicht nur Projekte und Derivate.
76
+ - **Datenbank-Integration**: Nahtlose Integration mit dem Django ORM für Datenbankoperationen.
77
+ - **Externe Schnittstellen**: Unterstützung für Schnittstellen zu anderen Programmen, wie z. B. Excel-Interfaces.
78
+
79
+ ### 2. **Datenmodellierung**
80
+ - **Django-Modelle**: Die Datenstruktur basiert auf Django-Modellen, die durch benutzerdefinierte Felder wie `MeasurementField` erweitert werden.
81
+ - **Regeln und Validierungen**: Definieren Sie Regeln für Datenvalidierungen, z. B. dass das Startdatum eines Projekts vor dem Enddatum liegen muss.
82
+
83
+ ### 3. **GraphQL-Integration**
84
+ - Automatische Generierung von GraphQL-Schnittstellen für alle Modelle.
85
+ - Unterstützung für benutzerdefinierte Abfragen und Mutationen.
86
+
87
+ ### 4. **Berechtigungssystem**
88
+ - **ManagerBasedPermission**: Ein flexibles Berechtigungssystem, das auf Benutzerrollen und Attributen basiert.
89
+ - Unterstützung für CRUD-Berechtigungen auf Attributebene.
90
+
91
+ ### 5. **Interfaces**
92
+ - **CalculationInterface**: Ermöglicht die Implementierung von Berechnungslogiken.
93
+ - **DatabaseInterface**: Bietet eine standardisierte Schnittstelle für Datenbankoperationen.
94
+ - **ReadOnlyInterface**: Für schreibgeschützte Datenzugriffe.
95
+
96
+ ### 6. **Datenverteilung und Berechnung**
97
+ - **Volumenverteilung**: Automatische Berechnung und Verteilung von Volumen über mehrere Jahre.
98
+ - **Kommerzielle Berechnungen**: Berechnung von Gesamtvolumen, Versandkosten und Einnahmen für Projekte.
99
+
100
+ ## Anwendung
101
+
102
+ ### Installation
103
+
104
+ Installieren Sie das Modul über `pip`:
105
+
106
+ ```bash
107
+ pip install GeneralManager
108
+ ```
109
+
110
+ ### Beispielcode
111
+
112
+ Hier ist ein Beispiel, wie Sie einen GeneralManager erstellen und Testdaten (in diesem Fall 10 Projekte) generieren können:
113
+
114
+ ```python
115
+ from general_manager import GeneralManager
116
+ from general_manager.interface.database import DatabaseInterface
117
+ from general_manager.measurement import MeasurementField, Measurement
118
+ from general_manager.permission import ManagerBasedPermission
119
+
120
+ class Project(GeneralManager):
121
+ name: str
122
+ start_date: Optional[date]
123
+ end_date: Optional[date]
124
+ total_capex: Optional[Measurement]
125
+ derivative_list: DatabaseBucket[Derivative]
126
+
127
+ class Interface(DatabaseInterface):
128
+ name = CharField(max_length=50)
129
+ number = CharField(max_length=7, validators=[RegexValidator(r"^AP\d{4,5}$")])
130
+ description = TextField(null=True, blank=True)
131
+ start_date = DateField(null=True, blank=True)
132
+ end_date = DateField(null=True, blank=True)
133
+ total_capex = MeasurementField(base_unit="EUR", null=True, blank=True)
134
+
135
+ class Meta:
136
+ constraints = [
137
+ constraints.UniqueConstraint(
138
+ fields=["name", "number"], name="unique_booking"
139
+ )
140
+ ]
141
+
142
+ rules = [
143
+ Rule["Project"](
144
+ lambda x: cast(date, x.start_date) < cast(date, x.end_date)
145
+ ),
146
+ Rule["Project"](lambda x: cast(Measurement, x.total_capex) >= "0 EUR"),
147
+ ]
148
+
149
+ class Factory:
150
+ name = LazyProjectName()
151
+ end_date = LazyDeltaDate(365 * 6, "start_date")
152
+ total_capex = LazyMeasurement(75_000, 1_000_000, "EUR")
153
+
154
+ class Permission(ManagerBasedPermission):
155
+ __read__ = ["ends_with:name:X-771", "public"]
156
+ __create__ = ["admin", "isMatchingKeyAccount"]
157
+ __update__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
158
+ __delete__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
159
+
160
+ total_capex = {"update": ["isSalesResponsible", "isProjectManager"]}
161
+
162
+ Project.Factory.createBatch(10)
163
+ ```
164
+
165
+ ### GraphQL-Integration
166
+
167
+ Das Modul generiert automatisch GraphQL-Schnittstellen für alle Modelle. Sie können Abfragen und Mutationen über die GraphQL-URL ausführen, die in den Django-Einstellungen definiert ist.
168
+
169
+ Beispiel für eine GraphQL-Abfrage:
170
+
171
+ ```graphql
172
+ query {
173
+ projectList {
174
+ name
175
+ startDate
176
+ endDate
177
+ totalCapex {
178
+ value
179
+ unit
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ ## Vorteile
186
+
187
+ - **Modularität**: Einfach erweiterbar und anpassbar.
188
+ - **Flexibilität**: Unterstützt komplexe Geschäftslogiken und Berechnungen.
189
+ - **Integration**: Nahtlose Integration mit Django und GraphQL.
190
+ - **Berechtigungen**: Fein abgestimmte Berechtigungen für Benutzer und Attribute.
191
+ - **Datenvalidierung**: Automatische Validierung von Daten durch Regeln und Constraints.
192
+ - **Caching**: Automatische Cache-Generierung mit @cached Decorator, um die Leistung zu verbessern.
193
+
194
+ ## Anforderungen
195
+
196
+ - Python >= 3.12
197
+ - Django >= 5.2
198
+ - Zusätzliche Abhängigkeiten (siehe `requirements.txt`):
199
+ - `graphene`
200
+ - `numpy`
201
+ - `Pint`
202
+ - `factory_boy`
203
+ - uvm.
204
+
205
+ ## Lizenz
206
+
207
+ Dieses Projekt steht unter der **Non-Commercial MIT License**. Es darf nur für nicht-kommerzielle Zwecke verwendet werden. Weitere Details finden Sie in der [LICENSE](./LICENSE).
@@ -0,0 +1,54 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ GeneralManager.egg-info/PKG-INFO
5
+ GeneralManager.egg-info/SOURCES.txt
6
+ GeneralManager.egg-info/dependency_links.txt
7
+ GeneralManager.egg-info/requires.txt
8
+ GeneralManager.egg-info/top_level.txt
9
+ src/general_manager/__init__.py
10
+ src/general_manager/apps.py
11
+ src/general_manager/api/graphql.py
12
+ src/general_manager/api/mutation.py
13
+ src/general_manager/api/property.py
14
+ src/general_manager/auxiliary/__init__.py
15
+ src/general_manager/auxiliary/argsToKwargs.py
16
+ src/general_manager/auxiliary/filterParser.py
17
+ src/general_manager/auxiliary/noneToZero.py
18
+ src/general_manager/cache/cacheDecorator.py
19
+ src/general_manager/cache/cacheTracker.py
20
+ src/general_manager/cache/dependencyIndex.py
21
+ src/general_manager/cache/pathMapping.py
22
+ src/general_manager/cache/signals.py
23
+ src/general_manager/factory/__init__.py
24
+ src/general_manager/factory/factories.py
25
+ src/general_manager/factory/lazy_methods.py
26
+ src/general_manager/interface/__init__.py
27
+ src/general_manager/interface/baseInterface.py
28
+ src/general_manager/interface/calculationInterface.py
29
+ src/general_manager/interface/databaseInterface.py
30
+ src/general_manager/manager/__init__.py
31
+ src/general_manager/manager/generalManager.py
32
+ src/general_manager/manager/groupManager.py
33
+ src/general_manager/manager/input.py
34
+ src/general_manager/manager/meta.py
35
+ src/general_manager/measurement/__init__.py
36
+ src/general_manager/measurement/measurement.py
37
+ src/general_manager/measurement/measurementField.py
38
+ src/general_manager/permission/__init__.py
39
+ src/general_manager/permission/basePermission.py
40
+ src/general_manager/permission/fileBasedPermission.py
41
+ src/general_manager/permission/managerBasedPermission.py
42
+ src/general_manager/permission/permissionChecks.py
43
+ src/general_manager/permission/permissionDataManager.py
44
+ src/general_manager/rule/__init__.py
45
+ src/general_manager/rule/handler.py
46
+ src/general_manager/rule/rule.py
47
+ tests/test_argsToKwargs.py
48
+ tests/test_basePermission.py
49
+ tests/test_graph_ql.py
50
+ tests/test_managerBasedPermission.py
51
+ tests/test_measurement.py
52
+ tests/test_measurement_field.py
53
+ tests/test_rules.py
54
+ tests/test_settings.py
@@ -0,0 +1,26 @@
1
+ asgiref>=3.8.1
2
+ Django>=5.2
3
+ django-simple-history>=3.8.0
4
+ exrex>=0.12.0
5
+ factory_boy>=3.3.3
6
+ Faker>=37.1.0
7
+ flexcache>=0.3
8
+ flexparser>=0.4
9
+ gitdb>=4.0.12
10
+ GitPython>=3.1.41
11
+ graphene>=3.4.3
12
+ graphene-django>=3.2.3
13
+ graphql-core>=3.2.6
14
+ graphql-relay>=3.2.0
15
+ numpy>=2.2.5
16
+ Pint>=0.24.4
17
+ platformdirs>=4.3.7
18
+ promise>=2.3
19
+ python-dateutil>=2.9.0.post0
20
+ setuptools>=75.6.0
21
+ six>=1.17.0
22
+ smmap>=5.0.2
23
+ sqlparse>=0.5.3
24
+ text-unidecode>=1.3
25
+ typing_extensions>=4.13.2
26
+ tzdata>=2025.2
@@ -0,0 +1 @@
1
+ general_manager
@@ -0,0 +1,29 @@
1
+ Non-Commercial MIT License
2
+
3
+ Copyright (c) 2025 Tim Kleindick
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software **solely for non-commercial purposes**, including without
8
+ limitation the rights to use, copy, modify, merge, publish, distribute,
9
+ sublicense, and/or sell copies of the Software **for non-commercial use only**,
10
+ and to permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ 1. Non-Commercial Use Only
14
+ The Software may **not** be used for commercial purposes. “Commercial” means
15
+ any activity intended for or directed toward commercial advantage or
16
+ monetary compensation.
17
+
18
+ 2. Copyright Notice & License Text
19
+ The above copyright notice and this permission notice shall be included in
20
+ all copies or substantial portions of the Software.
21
+
22
+ 3. Disclaimer of Warranty
23
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL
26
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: GeneralManager
3
+ Version: 0.0.0
4
+ Summary: Kurzbeschreibung deines Pakets
5
+ Author-email: Tim Kleindick <tkleindick@yahoo.de>
6
+ License: Non-Commercial MIT License
7
+
8
+ Copyright (c) 2025 Tim Kleindick
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the “Software”), to deal
12
+ in the Software **solely for non-commercial purposes**, including without
13
+ limitation the rights to use, copy, modify, merge, publish, distribute,
14
+ sublicense, and/or sell copies of the Software **for non-commercial use only**,
15
+ and to permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ 1. Non-Commercial Use Only
19
+ The Software may **not** be used for commercial purposes. “Commercial” means
20
+ any activity intended for or directed toward commercial advantage or
21
+ monetary compensation.
22
+
23
+ 2. Copyright Notice & License Text
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ 3. Disclaimer of Warranty
28
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL
31
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+ Requires-Python: >=3.12
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: asgiref>=3.8.1
39
+ Requires-Dist: Django>=5.2
40
+ Requires-Dist: django-simple-history>=3.8.0
41
+ Requires-Dist: exrex>=0.12.0
42
+ Requires-Dist: factory_boy>=3.3.3
43
+ Requires-Dist: Faker>=37.1.0
44
+ Requires-Dist: flexcache>=0.3
45
+ Requires-Dist: flexparser>=0.4
46
+ Requires-Dist: gitdb>=4.0.12
47
+ Requires-Dist: GitPython>=3.1.41
48
+ Requires-Dist: graphene>=3.4.3
49
+ Requires-Dist: graphene-django>=3.2.3
50
+ Requires-Dist: graphql-core>=3.2.6
51
+ Requires-Dist: graphql-relay>=3.2.0
52
+ Requires-Dist: numpy>=2.2.5
53
+ Requires-Dist: Pint>=0.24.4
54
+ Requires-Dist: platformdirs>=4.3.7
55
+ Requires-Dist: promise>=2.3
56
+ Requires-Dist: python-dateutil>=2.9.0.post0
57
+ Requires-Dist: setuptools>=75.6.0
58
+ Requires-Dist: six>=1.17.0
59
+ Requires-Dist: smmap>=5.0.2
60
+ Requires-Dist: sqlparse>=0.5.3
61
+ Requires-Dist: text-unidecode>=1.3
62
+ Requires-Dist: typing_extensions>=4.13.2
63
+ Requires-Dist: tzdata>=2025.2
64
+ Dynamic: license-file
65
+
66
+ # GeneralManager
67
+
68
+ ## Überblick
69
+
70
+ Das GeneralManager-Modul ist ein leistungsstarkes und flexibles Framework, das speziell für die Verwaltung und Verarbeitung von Daten entwickelt wurde. Es bietet eine modulare Struktur, die es Entwicklern ermöglicht, komplexe Geschäftslogiken effizient zu implementieren und zu verwalten. Das Modul ist vollständig in Python geschrieben und nutzt Django als Backend-Framework.
71
+
72
+ ## Hauptfunktionen
73
+
74
+ ### 1. **Datenmanagement**
75
+ - **Flexibilität**: Unterstützt die Verwaltung aller Arten von Daten, nicht nur Projekte und Derivate.
76
+ - **Datenbank-Integration**: Nahtlose Integration mit dem Django ORM für Datenbankoperationen.
77
+ - **Externe Schnittstellen**: Unterstützung für Schnittstellen zu anderen Programmen, wie z. B. Excel-Interfaces.
78
+
79
+ ### 2. **Datenmodellierung**
80
+ - **Django-Modelle**: Die Datenstruktur basiert auf Django-Modellen, die durch benutzerdefinierte Felder wie `MeasurementField` erweitert werden.
81
+ - **Regeln und Validierungen**: Definieren Sie Regeln für Datenvalidierungen, z. B. dass das Startdatum eines Projekts vor dem Enddatum liegen muss.
82
+
83
+ ### 3. **GraphQL-Integration**
84
+ - Automatische Generierung von GraphQL-Schnittstellen für alle Modelle.
85
+ - Unterstützung für benutzerdefinierte Abfragen und Mutationen.
86
+
87
+ ### 4. **Berechtigungssystem**
88
+ - **ManagerBasedPermission**: Ein flexibles Berechtigungssystem, das auf Benutzerrollen und Attributen basiert.
89
+ - Unterstützung für CRUD-Berechtigungen auf Attributebene.
90
+
91
+ ### 5. **Interfaces**
92
+ - **CalculationInterface**: Ermöglicht die Implementierung von Berechnungslogiken.
93
+ - **DatabaseInterface**: Bietet eine standardisierte Schnittstelle für Datenbankoperationen.
94
+ - **ReadOnlyInterface**: Für schreibgeschützte Datenzugriffe.
95
+
96
+ ### 6. **Datenverteilung und Berechnung**
97
+ - **Volumenverteilung**: Automatische Berechnung und Verteilung von Volumen über mehrere Jahre.
98
+ - **Kommerzielle Berechnungen**: Berechnung von Gesamtvolumen, Versandkosten und Einnahmen für Projekte.
99
+
100
+ ## Anwendung
101
+
102
+ ### Installation
103
+
104
+ Installieren Sie das Modul über `pip`:
105
+
106
+ ```bash
107
+ pip install GeneralManager
108
+ ```
109
+
110
+ ### Beispielcode
111
+
112
+ Hier ist ein Beispiel, wie Sie einen GeneralManager erstellen und Testdaten (in diesem Fall 10 Projekte) generieren können:
113
+
114
+ ```python
115
+ from general_manager import GeneralManager
116
+ from general_manager.interface.database import DatabaseInterface
117
+ from general_manager.measurement import MeasurementField, Measurement
118
+ from general_manager.permission import ManagerBasedPermission
119
+
120
+ class Project(GeneralManager):
121
+ name: str
122
+ start_date: Optional[date]
123
+ end_date: Optional[date]
124
+ total_capex: Optional[Measurement]
125
+ derivative_list: DatabaseBucket[Derivative]
126
+
127
+ class Interface(DatabaseInterface):
128
+ name = CharField(max_length=50)
129
+ number = CharField(max_length=7, validators=[RegexValidator(r"^AP\d{4,5}$")])
130
+ description = TextField(null=True, blank=True)
131
+ start_date = DateField(null=True, blank=True)
132
+ end_date = DateField(null=True, blank=True)
133
+ total_capex = MeasurementField(base_unit="EUR", null=True, blank=True)
134
+
135
+ class Meta:
136
+ constraints = [
137
+ constraints.UniqueConstraint(
138
+ fields=["name", "number"], name="unique_booking"
139
+ )
140
+ ]
141
+
142
+ rules = [
143
+ Rule["Project"](
144
+ lambda x: cast(date, x.start_date) < cast(date, x.end_date)
145
+ ),
146
+ Rule["Project"](lambda x: cast(Measurement, x.total_capex) >= "0 EUR"),
147
+ ]
148
+
149
+ class Factory:
150
+ name = LazyProjectName()
151
+ end_date = LazyDeltaDate(365 * 6, "start_date")
152
+ total_capex = LazyMeasurement(75_000, 1_000_000, "EUR")
153
+
154
+ class Permission(ManagerBasedPermission):
155
+ __read__ = ["ends_with:name:X-771", "public"]
156
+ __create__ = ["admin", "isMatchingKeyAccount"]
157
+ __update__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
158
+ __delete__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
159
+
160
+ total_capex = {"update": ["isSalesResponsible", "isProjectManager"]}
161
+
162
+ Project.Factory.createBatch(10)
163
+ ```
164
+
165
+ ### GraphQL-Integration
166
+
167
+ Das Modul generiert automatisch GraphQL-Schnittstellen für alle Modelle. Sie können Abfragen und Mutationen über die GraphQL-URL ausführen, die in den Django-Einstellungen definiert ist.
168
+
169
+ Beispiel für eine GraphQL-Abfrage:
170
+
171
+ ```graphql
172
+ query {
173
+ projectList {
174
+ name
175
+ startDate
176
+ endDate
177
+ totalCapex {
178
+ value
179
+ unit
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ ## Vorteile
186
+
187
+ - **Modularität**: Einfach erweiterbar und anpassbar.
188
+ - **Flexibilität**: Unterstützt komplexe Geschäftslogiken und Berechnungen.
189
+ - **Integration**: Nahtlose Integration mit Django und GraphQL.
190
+ - **Berechtigungen**: Fein abgestimmte Berechtigungen für Benutzer und Attribute.
191
+ - **Datenvalidierung**: Automatische Validierung von Daten durch Regeln und Constraints.
192
+ - **Caching**: Automatische Cache-Generierung mit @cached Decorator, um die Leistung zu verbessern.
193
+
194
+ ## Anforderungen
195
+
196
+ - Python >= 3.12
197
+ - Django >= 5.2
198
+ - Zusätzliche Abhängigkeiten (siehe `requirements.txt`):
199
+ - `graphene`
200
+ - `numpy`
201
+ - `Pint`
202
+ - `factory_boy`
203
+ - uvm.
204
+
205
+ ## Lizenz
206
+
207
+ Dieses Projekt steht unter der **Non-Commercial MIT License**. Es darf nur für nicht-kommerzielle Zwecke verwendet werden. Weitere Details finden Sie in der [LICENSE](./LICENSE).
@@ -0,0 +1,142 @@
1
+ # GeneralManager
2
+
3
+ ## Überblick
4
+
5
+ Das GeneralManager-Modul ist ein leistungsstarkes und flexibles Framework, das speziell für die Verwaltung und Verarbeitung von Daten entwickelt wurde. Es bietet eine modulare Struktur, die es Entwicklern ermöglicht, komplexe Geschäftslogiken effizient zu implementieren und zu verwalten. Das Modul ist vollständig in Python geschrieben und nutzt Django als Backend-Framework.
6
+
7
+ ## Hauptfunktionen
8
+
9
+ ### 1. **Datenmanagement**
10
+ - **Flexibilität**: Unterstützt die Verwaltung aller Arten von Daten, nicht nur Projekte und Derivate.
11
+ - **Datenbank-Integration**: Nahtlose Integration mit dem Django ORM für Datenbankoperationen.
12
+ - **Externe Schnittstellen**: Unterstützung für Schnittstellen zu anderen Programmen, wie z. B. Excel-Interfaces.
13
+
14
+ ### 2. **Datenmodellierung**
15
+ - **Django-Modelle**: Die Datenstruktur basiert auf Django-Modellen, die durch benutzerdefinierte Felder wie `MeasurementField` erweitert werden.
16
+ - **Regeln und Validierungen**: Definieren Sie Regeln für Datenvalidierungen, z. B. dass das Startdatum eines Projekts vor dem Enddatum liegen muss.
17
+
18
+ ### 3. **GraphQL-Integration**
19
+ - Automatische Generierung von GraphQL-Schnittstellen für alle Modelle.
20
+ - Unterstützung für benutzerdefinierte Abfragen und Mutationen.
21
+
22
+ ### 4. **Berechtigungssystem**
23
+ - **ManagerBasedPermission**: Ein flexibles Berechtigungssystem, das auf Benutzerrollen und Attributen basiert.
24
+ - Unterstützung für CRUD-Berechtigungen auf Attributebene.
25
+
26
+ ### 5. **Interfaces**
27
+ - **CalculationInterface**: Ermöglicht die Implementierung von Berechnungslogiken.
28
+ - **DatabaseInterface**: Bietet eine standardisierte Schnittstelle für Datenbankoperationen.
29
+ - **ReadOnlyInterface**: Für schreibgeschützte Datenzugriffe.
30
+
31
+ ### 6. **Datenverteilung und Berechnung**
32
+ - **Volumenverteilung**: Automatische Berechnung und Verteilung von Volumen über mehrere Jahre.
33
+ - **Kommerzielle Berechnungen**: Berechnung von Gesamtvolumen, Versandkosten und Einnahmen für Projekte.
34
+
35
+ ## Anwendung
36
+
37
+ ### Installation
38
+
39
+ Installieren Sie das Modul über `pip`:
40
+
41
+ ```bash
42
+ pip install GeneralManager
43
+ ```
44
+
45
+ ### Beispielcode
46
+
47
+ Hier ist ein Beispiel, wie Sie einen GeneralManager erstellen und Testdaten (in diesem Fall 10 Projekte) generieren können:
48
+
49
+ ```python
50
+ from general_manager import GeneralManager
51
+ from general_manager.interface.database import DatabaseInterface
52
+ from general_manager.measurement import MeasurementField, Measurement
53
+ from general_manager.permission import ManagerBasedPermission
54
+
55
+ class Project(GeneralManager):
56
+ name: str
57
+ start_date: Optional[date]
58
+ end_date: Optional[date]
59
+ total_capex: Optional[Measurement]
60
+ derivative_list: DatabaseBucket[Derivative]
61
+
62
+ class Interface(DatabaseInterface):
63
+ name = CharField(max_length=50)
64
+ number = CharField(max_length=7, validators=[RegexValidator(r"^AP\d{4,5}$")])
65
+ description = TextField(null=True, blank=True)
66
+ start_date = DateField(null=True, blank=True)
67
+ end_date = DateField(null=True, blank=True)
68
+ total_capex = MeasurementField(base_unit="EUR", null=True, blank=True)
69
+
70
+ class Meta:
71
+ constraints = [
72
+ constraints.UniqueConstraint(
73
+ fields=["name", "number"], name="unique_booking"
74
+ )
75
+ ]
76
+
77
+ rules = [
78
+ Rule["Project"](
79
+ lambda x: cast(date, x.start_date) < cast(date, x.end_date)
80
+ ),
81
+ Rule["Project"](lambda x: cast(Measurement, x.total_capex) >= "0 EUR"),
82
+ ]
83
+
84
+ class Factory:
85
+ name = LazyProjectName()
86
+ end_date = LazyDeltaDate(365 * 6, "start_date")
87
+ total_capex = LazyMeasurement(75_000, 1_000_000, "EUR")
88
+
89
+ class Permission(ManagerBasedPermission):
90
+ __read__ = ["ends_with:name:X-771", "public"]
91
+ __create__ = ["admin", "isMatchingKeyAccount"]
92
+ __update__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
93
+ __delete__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
94
+
95
+ total_capex = {"update": ["isSalesResponsible", "isProjectManager"]}
96
+
97
+ Project.Factory.createBatch(10)
98
+ ```
99
+
100
+ ### GraphQL-Integration
101
+
102
+ Das Modul generiert automatisch GraphQL-Schnittstellen für alle Modelle. Sie können Abfragen und Mutationen über die GraphQL-URL ausführen, die in den Django-Einstellungen definiert ist.
103
+
104
+ Beispiel für eine GraphQL-Abfrage:
105
+
106
+ ```graphql
107
+ query {
108
+ projectList {
109
+ name
110
+ startDate
111
+ endDate
112
+ totalCapex {
113
+ value
114
+ unit
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ## Vorteile
121
+
122
+ - **Modularität**: Einfach erweiterbar und anpassbar.
123
+ - **Flexibilität**: Unterstützt komplexe Geschäftslogiken und Berechnungen.
124
+ - **Integration**: Nahtlose Integration mit Django und GraphQL.
125
+ - **Berechtigungen**: Fein abgestimmte Berechtigungen für Benutzer und Attribute.
126
+ - **Datenvalidierung**: Automatische Validierung von Daten durch Regeln und Constraints.
127
+ - **Caching**: Automatische Cache-Generierung mit @cached Decorator, um die Leistung zu verbessern.
128
+
129
+ ## Anforderungen
130
+
131
+ - Python >= 3.12
132
+ - Django >= 5.2
133
+ - Zusätzliche Abhängigkeiten (siehe `requirements.txt`):
134
+ - `graphene`
135
+ - `numpy`
136
+ - `Pint`
137
+ - `factory_boy`
138
+ - uvm.
139
+
140
+ ## Lizenz
141
+
142
+ Dieses Projekt steht unter der **Non-Commercial MIT License**. Es darf nur für nicht-kommerzielle Zwecke verwendet werden. Weitere Details finden Sie in der [LICENSE](./LICENSE).