maleo-identity 0.0.43__py3-none-any.whl → 0.0.45__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.
Potentially problematic release.
This version of maleo-identity might be problematic. Click here for more details.
- maleo_identity/client/controllers/http/organization.py +87 -0
- maleo_identity/client/services/organization.py +380 -8
- maleo_identity/client/services/user.py +108 -9
- maleo_identity/constants/user.py +0 -9
- maleo_identity/constants/user_system_role.py +6 -8
- maleo_identity/enums/user_system_role.py +3 -0
- maleo_identity/models/__init__.py +2 -0
- maleo_identity/models/responses/organization.py +17 -5
- maleo_identity/models/schemas/__init__.py +14 -4
- maleo_identity/models/schemas/general.py +15 -0
- maleo_identity/models/schemas/{general/organization.py → organization.py} +10 -9
- maleo_identity/models/schemas/organization_role.py +15 -0
- maleo_identity/models/schemas/{general/user.py → user.py} +12 -11
- maleo_identity/models/schemas/user_organization.py +8 -0
- maleo_identity/models/schemas/user_organization_role.py +15 -0
- maleo_identity/models/schemas/{general/user_profile.py → user_profile.py} +5 -10
- maleo_identity/models/schemas/user_system_role.py +8 -0
- maleo_identity/models/tables/organization.py +16 -2
- maleo_identity/models/tables/user.py +13 -1
- maleo_identity/models/tables/user_profile.py +2 -0
- maleo_identity/models/tables/user_system_role.py +2 -0
- maleo_identity/models/transfers/general/organization.py +15 -13
- maleo_identity/models/transfers/general/organization_role.py +7 -6
- maleo_identity/models/transfers/general/user.py +8 -3
- maleo_identity/models/transfers/general/user_organization.py +3 -2
- maleo_identity/models/transfers/general/user_organization_role.py +8 -7
- maleo_identity/models/transfers/general/user_profile.py +18 -2
- maleo_identity/models/transfers/general/user_system_role.py +3 -2
- maleo_identity/models/transfers/parameters/client/organization.py +65 -14
- maleo_identity/models/transfers/parameters/client/organization_role.py +14 -12
- maleo_identity/models/transfers/parameters/client/user.py +20 -20
- maleo_identity/models/transfers/parameters/client/user_organization.py +18 -17
- maleo_identity/models/transfers/parameters/client/user_organization_role.py +17 -15
- maleo_identity/models/transfers/parameters/client/user_profile.py +10 -9
- maleo_identity/models/transfers/parameters/client/user_system_role.py +13 -12
- maleo_identity/models/transfers/parameters/general/organization.py +18 -13
- maleo_identity/models/transfers/parameters/general/organization_role.py +9 -8
- maleo_identity/models/transfers/parameters/general/user.py +23 -14
- maleo_identity/models/transfers/parameters/general/user_organization.py +14 -10
- maleo_identity/models/transfers/parameters/general/user_organization_role.py +10 -8
- maleo_identity/models/transfers/parameters/general/user_profile.py +30 -14
- maleo_identity/models/transfers/parameters/general/user_system_role.py +14 -10
- maleo_identity/models/transfers/parameters/service/organization.py +54 -14
- maleo_identity/models/transfers/parameters/service/organization_role.py +11 -9
- maleo_identity/models/transfers/parameters/service/user.py +20 -20
- maleo_identity/models/transfers/parameters/service/user_organization.py +12 -11
- maleo_identity/models/transfers/parameters/service/user_organization_role.py +13 -11
- maleo_identity/models/transfers/parameters/service/user_profile.py +10 -9
- maleo_identity/models/transfers/parameters/service/user_system_role.py +10 -9
- maleo_identity/models/transfers/results/client/organization.py +8 -2
- maleo_identity/models/transfers/results/general/organization.py +8 -2
- maleo_identity/models/transfers/results/repository/organization.py +10 -8
- maleo_identity/models/transfers/results/repository/organization_role.py +4 -8
- maleo_identity/models/transfers/results/repository/user.py +5 -15
- maleo_identity/models/transfers/results/repository/user_organization.py +4 -8
- maleo_identity/models/transfers/results/repository/user_organization_role.py +4 -8
- maleo_identity/models/transfers/results/repository/user_profile.py +4 -8
- maleo_identity/models/transfers/results/repository/user_system_role.py +4 -8
- maleo_identity/types/results/client/organization.py +11 -0
- maleo_identity/types/results/general/organization.py +12 -0
- maleo_identity/types/results/repository/organization.py +12 -0
- {maleo_identity-0.0.43.dist-info → maleo_identity-0.0.45.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.43.dist-info → maleo_identity-0.0.45.dist-info}/RECORD +65 -81
- {maleo_identity-0.0.43.dist-info → maleo_identity-0.0.45.dist-info}/WHEEL +1 -1
- maleo_identity/models/schemas/general/__init__.py +0 -17
- maleo_identity/models/schemas/general/organization_role.py +0 -29
- maleo_identity/models/schemas/general/user_organization.py +0 -20
- maleo_identity/models/schemas/general/user_organization_role.py +0 -35
- maleo_identity/models/schemas/general/user_system_role.py +0 -14
- maleo_identity/models/schemas/parameters/__init__.py +0 -17
- maleo_identity/models/schemas/parameters/organization.py +0 -10
- maleo_identity/models/schemas/parameters/organization_role.py +0 -7
- maleo_identity/models/schemas/parameters/user.py +0 -16
- maleo_identity/models/schemas/parameters/user_organization.py +0 -7
- maleo_identity/models/schemas/parameters/user_organization_role.py +0 -8
- maleo_identity/models/schemas/parameters/user_profile.py +0 -22
- maleo_identity/models/schemas/parameters/user_system_role.py +0 -8
- maleo_identity/models/schemas/results/__init__.py +0 -17
- maleo_identity/models/schemas/results/organization.py +0 -18
- maleo_identity/models/schemas/results/organization_role.py +0 -10
- maleo_identity/models/schemas/results/user.py +0 -22
- maleo_identity/models/schemas/results/user_organization.py +0 -7
- maleo_identity/models/schemas/results/user_organization_role.py +0 -11
- maleo_identity/models/schemas/results/user_profile.py +0 -34
- maleo_identity/models/schemas/results/user_system_role.py +0 -8
- {maleo_identity-0.0.43.dist-info → maleo_identity-0.0.45.dist-info}/top_level.txt +0 -0
|
@@ -72,13 +72,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
72
72
|
no_data_class=MaleoIdentityUserClientResultsTransfers.NoData
|
|
73
73
|
)
|
|
74
74
|
@cached(
|
|
75
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
75
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
76
76
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
77
77
|
"user",
|
|
78
78
|
type=BaseEnums.CacheType.CLIENT,
|
|
79
79
|
base_override=self.key
|
|
80
80
|
),
|
|
81
81
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
82
|
+
skip_cache_func=lambda x: (
|
|
83
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
84
|
+
or x is None
|
|
85
|
+
or (
|
|
86
|
+
isinstance(x, dict)
|
|
87
|
+
and (
|
|
88
|
+
x.get("success") in [False, None]
|
|
89
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
),
|
|
82
93
|
cache=Cache.REDIS,
|
|
83
94
|
serializer=JsonSerializer(),
|
|
84
95
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -158,13 +169,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
158
169
|
data_found_class=MaleoIdentityUserClientResultsTransfers.SingleData
|
|
159
170
|
)
|
|
160
171
|
@cached(
|
|
161
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
172
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
162
173
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
163
174
|
"user",
|
|
164
175
|
type=BaseEnums.CacheType.CLIENT,
|
|
165
176
|
base_override=self.key
|
|
166
177
|
),
|
|
167
178
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
179
|
+
skip_cache_func=lambda x: (
|
|
180
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
181
|
+
or x is None
|
|
182
|
+
or (
|
|
183
|
+
isinstance(x, dict)
|
|
184
|
+
and (
|
|
185
|
+
x.get("success") in [False, None]
|
|
186
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
),
|
|
168
190
|
cache=Cache.REDIS,
|
|
169
191
|
serializer=JsonSerializer(),
|
|
170
192
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -350,13 +372,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
350
372
|
data_found_class=MaleoIdentityUserClientResultsTransfers.SinglePassword
|
|
351
373
|
)
|
|
352
374
|
@cached(
|
|
353
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
375
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
354
376
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
355
377
|
"user",
|
|
356
378
|
type=BaseEnums.CacheType.CLIENT,
|
|
357
379
|
base_override=self.key
|
|
358
380
|
),
|
|
359
381
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
382
|
+
skip_cache_func=lambda x: (
|
|
383
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
384
|
+
or x is None
|
|
385
|
+
or (
|
|
386
|
+
isinstance(x, dict)
|
|
387
|
+
and (
|
|
388
|
+
x.get("success") in [False, None]
|
|
389
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
390
|
+
)
|
|
391
|
+
)
|
|
392
|
+
),
|
|
360
393
|
cache=Cache.REDIS,
|
|
361
394
|
serializer=JsonSerializer(),
|
|
362
395
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -429,13 +462,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
429
462
|
no_data_class=MaleoIdentityUserOrganizationClientResultsTransfers.NoData
|
|
430
463
|
)
|
|
431
464
|
@cached(
|
|
432
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
465
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
433
466
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
434
467
|
"user_organization",
|
|
435
468
|
type=BaseEnums.CacheType.CLIENT,
|
|
436
469
|
base_override=self.key
|
|
437
470
|
),
|
|
438
471
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
472
|
+
skip_cache_func=lambda x: (
|
|
473
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
474
|
+
or x is None
|
|
475
|
+
or (
|
|
476
|
+
isinstance(x, dict)
|
|
477
|
+
and (
|
|
478
|
+
x.get("success") in [False, None]
|
|
479
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
480
|
+
)
|
|
481
|
+
)
|
|
482
|
+
),
|
|
439
483
|
cache=Cache.REDIS,
|
|
440
484
|
serializer=JsonSerializer(),
|
|
441
485
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -515,13 +559,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
515
559
|
data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.SingleData
|
|
516
560
|
)
|
|
517
561
|
@cached(
|
|
518
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
562
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
519
563
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
520
564
|
"user_organization",
|
|
521
565
|
type=BaseEnums.CacheType.CLIENT,
|
|
522
566
|
base_override=self.key
|
|
523
567
|
),
|
|
524
568
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
569
|
+
skip_cache_func=lambda x: (
|
|
570
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
571
|
+
or x is None
|
|
572
|
+
or (
|
|
573
|
+
isinstance(x, dict)
|
|
574
|
+
and (
|
|
575
|
+
x.get("success") in [False, None]
|
|
576
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
577
|
+
)
|
|
578
|
+
)
|
|
579
|
+
),
|
|
525
580
|
cache=Cache.REDIS,
|
|
526
581
|
serializer=JsonSerializer(),
|
|
527
582
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -594,13 +649,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
594
649
|
no_data_class=MaleoIdentityUserSystemRoleClientResultsTransfers.NoData
|
|
595
650
|
)
|
|
596
651
|
@cached(
|
|
597
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
652
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
598
653
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
599
654
|
"user_system_role",
|
|
600
655
|
type=BaseEnums.CacheType.CLIENT,
|
|
601
656
|
base_override=self.key
|
|
602
657
|
),
|
|
603
658
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
659
|
+
skip_cache_func=lambda x: (
|
|
660
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
661
|
+
or x is None
|
|
662
|
+
or (
|
|
663
|
+
isinstance(x, dict)
|
|
664
|
+
and (
|
|
665
|
+
x.get("success") in [False, None]
|
|
666
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
667
|
+
)
|
|
668
|
+
)
|
|
669
|
+
),
|
|
604
670
|
cache=Cache.REDIS,
|
|
605
671
|
serializer=JsonSerializer(),
|
|
606
672
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -677,13 +743,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
677
743
|
data_found_class=MaleoIdentityUserSystemRoleClientResultsTransfers.SingleData
|
|
678
744
|
)
|
|
679
745
|
@cached(
|
|
680
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
746
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
681
747
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
682
748
|
"user_system_role",
|
|
683
749
|
type=BaseEnums.CacheType.CLIENT,
|
|
684
750
|
base_override=self.key
|
|
685
751
|
),
|
|
686
752
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
753
|
+
skip_cache_func=lambda x: (
|
|
754
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
755
|
+
or x is None
|
|
756
|
+
or (
|
|
757
|
+
isinstance(x, dict)
|
|
758
|
+
and (
|
|
759
|
+
x.get("success") in [False, None]
|
|
760
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
761
|
+
)
|
|
762
|
+
)
|
|
763
|
+
),
|
|
687
764
|
cache=Cache.REDIS,
|
|
688
765
|
serializer=JsonSerializer(),
|
|
689
766
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -755,13 +832,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
755
832
|
no_data_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.NoData
|
|
756
833
|
)
|
|
757
834
|
@cached(
|
|
758
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
835
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
759
836
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
760
837
|
"user_organization_role",
|
|
761
838
|
type=BaseEnums.CacheType.CLIENT,
|
|
762
839
|
base_override=self.key
|
|
763
840
|
),
|
|
764
841
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
842
|
+
skip_cache_func=lambda x: (
|
|
843
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
844
|
+
or x is None
|
|
845
|
+
or (
|
|
846
|
+
isinstance(x, dict)
|
|
847
|
+
and (
|
|
848
|
+
x.get("success") in [False, None]
|
|
849
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
850
|
+
)
|
|
851
|
+
)
|
|
852
|
+
),
|
|
765
853
|
cache=Cache.REDIS,
|
|
766
854
|
serializer=JsonSerializer(),
|
|
767
855
|
endpoint=self.service_manager.configs.cache.redis.host,
|
|
@@ -841,13 +929,24 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
841
929
|
data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.SingleData
|
|
842
930
|
)
|
|
843
931
|
@cached(
|
|
844
|
-
ttl=int(BaseEnums.CacheTTL.
|
|
932
|
+
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
845
933
|
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
846
934
|
"user_organization_role",
|
|
847
935
|
type=BaseEnums.CacheType.CLIENT,
|
|
848
936
|
base_override=self.key
|
|
849
937
|
),
|
|
850
938
|
key_builder=BaseCacheConfigurations.key_builder,
|
|
939
|
+
skip_cache_func=lambda x: (
|
|
940
|
+
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
941
|
+
or x is None
|
|
942
|
+
or (
|
|
943
|
+
isinstance(x, dict)
|
|
944
|
+
and (
|
|
945
|
+
x.get("success") in [False, None]
|
|
946
|
+
or (x.get("success") is True and x.get("data") is None)
|
|
947
|
+
)
|
|
948
|
+
)
|
|
949
|
+
),
|
|
851
950
|
cache=Cache.REDIS,
|
|
852
951
|
serializer=JsonSerializer(),
|
|
853
952
|
endpoint=self.service_manager.configs.cache.redis.host,
|
maleo_identity/constants/user.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Dict, List
|
|
2
2
|
from uuid import UUID
|
|
3
3
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
4
|
-
from maleo_identity.enums.user_profile import MaleoIdentityUserProfileEnums
|
|
5
4
|
|
|
6
5
|
class MaleoIdentityUserConstants:
|
|
7
6
|
IDENTIFIER_TYPE_VALUE_TYPE_MAP:Dict[
|
|
@@ -23,12 +22,4 @@ class MaleoIdentityUserConstants:
|
|
|
23
22
|
MaleoIdentityUserEnums.ExpandableFields.GENDER,
|
|
24
23
|
MaleoIdentityUserEnums.ExpandableFields.BLOOD_TYPE
|
|
25
24
|
]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
USER_PROFILE_EXPANDABLE_FIELDS_MAP:Dict[
|
|
29
|
-
MaleoIdentityUserEnums.ExpandableFields,
|
|
30
|
-
MaleoIdentityUserProfileEnums.ExpandableFields
|
|
31
|
-
] = {
|
|
32
|
-
MaleoIdentityUserEnums.ExpandableFields.GENDER: MaleoIdentityUserProfileEnums.ExpandableFields.GENDER,
|
|
33
|
-
MaleoIdentityUserEnums.ExpandableFields.BLOOD_TYPE: MaleoIdentityUserProfileEnums.ExpandableFields.BLOOD_TYPE
|
|
34
25
|
}
|
|
@@ -8,13 +8,11 @@ class MaleoIdentityUserSystemRoleConstants:
|
|
|
8
8
|
List[MaleoIdentityUserSystemRoleEnums.ExpandableFields]
|
|
9
9
|
] = {
|
|
10
10
|
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER: [
|
|
11
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER_TYPE
|
|
11
|
+
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER_TYPE,
|
|
12
|
+
MaleoIdentityUserSystemRoleEnums.ExpandableFields.PROFILE
|
|
13
|
+
],
|
|
14
|
+
MaleoIdentityUserSystemRoleEnums.ExpandableFields.PROFILE: [
|
|
15
|
+
MaleoIdentityUserSystemRoleEnums.ExpandableFields.GENDER,
|
|
16
|
+
MaleoIdentityUserSystemRoleEnums.ExpandableFields.BLOOD_TYPE
|
|
12
17
|
]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
USER_EXPANDABLE_FIELDS_MAP:Dict[
|
|
16
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields,
|
|
17
|
-
MaleoIdentityUserEnums.ExpandableFields
|
|
18
|
-
] = {
|
|
19
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER_TYPE: MaleoIdentityUserEnums.ExpandableFields.USER_TYPE
|
|
20
18
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from .tables import MaleoIdentityTables
|
|
3
|
+
from .schemas import MaleoIdentitySchemas
|
|
3
4
|
from .transfers import MaleoIdentityTransfers
|
|
4
5
|
from .responses import MaleoIdentityResponses
|
|
5
6
|
|
|
6
7
|
class MaleoIdentityModels:
|
|
7
8
|
Tables = MaleoIdentityTables
|
|
9
|
+
Schemas = MaleoIdentitySchemas
|
|
8
10
|
Transfers = MaleoIdentityTransfers
|
|
9
11
|
Responses = MaleoIdentityResponses
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pydantic import Field
|
|
2
2
|
from maleo_foundation.models.responses import BaseResponses
|
|
3
3
|
from maleo_identity.enums.organization import MaleoIdentityOrganizationEnums
|
|
4
|
-
from maleo_identity.models.transfers.general.organization import OrganizationTransfers
|
|
4
|
+
from maleo_identity.models.transfers.general.organization import OrganizationTransfers, StructuredOrganizationTransfers
|
|
5
5
|
|
|
6
6
|
class MaleoIdentityOrganizationResponses:
|
|
7
7
|
class InvalidIdentifierType(BaseResponses.BadRequest):
|
|
@@ -27,20 +27,32 @@ class MaleoIdentityOrganizationResponses:
|
|
|
27
27
|
description:str = "Requested organizations found in database"
|
|
28
28
|
data:list[OrganizationTransfers] = Field(..., description="Organizations")
|
|
29
29
|
|
|
30
|
-
class
|
|
30
|
+
class GetSingleStructured(BaseResponses.SingleData):
|
|
31
31
|
code:str = "IDT-ORG-005"
|
|
32
|
+
message:str = "Structured organization found"
|
|
33
|
+
description:str = "Requested structured organization found in database"
|
|
34
|
+
data:StructuredOrganizationTransfers = Field(..., description="Structured organization")
|
|
35
|
+
|
|
36
|
+
class GetMultipleStructured(BaseResponses.PaginatedMultipleData):
|
|
37
|
+
code:str = "IDT-ORG-006"
|
|
38
|
+
message:str = "Structured organizations found"
|
|
39
|
+
description:str = "Requested structured organizations found in database"
|
|
40
|
+
data:list[StructuredOrganizationTransfers] = Field(..., description="Structured organizations")
|
|
41
|
+
|
|
42
|
+
class CreateFailed(BaseResponses.BadRequest):
|
|
43
|
+
code:str = "IDT-ORG-007"
|
|
32
44
|
message:str = "Failed creating new organization"
|
|
33
45
|
|
|
34
46
|
class CreateSuccess(BaseResponses.SingleData):
|
|
35
|
-
code:str = "IDT-ORG-
|
|
47
|
+
code:str = "IDT-ORG-008"
|
|
36
48
|
message:str = "Successfully created new organization"
|
|
37
49
|
data:OrganizationTransfers = Field(..., description="Organization")
|
|
38
50
|
|
|
39
51
|
class UpdateFailed(BaseResponses.BadRequest):
|
|
40
|
-
code:str = "IDT-ORG-
|
|
52
|
+
code:str = "IDT-ORG-009"
|
|
41
53
|
message:str = "Failed updating organization's data"
|
|
42
54
|
|
|
43
55
|
class UpdateSuccess(BaseResponses.SingleData):
|
|
44
|
-
code:str = "IDT-ORG-
|
|
56
|
+
code:str = "IDT-ORG-010"
|
|
45
57
|
message:str = "Successfully updated organization's data"
|
|
46
58
|
data:OrganizationTransfers = Field(..., description="Organization")
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from .general import MaleoIdentityGeneralSchemas
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
3
|
+
from .organization_role import MaleoIdentityOrganizationRoleSchemas
|
|
4
|
+
from .organization import MaleoIdentityOrganizationSchemas
|
|
5
|
+
from .user_organization_role import MaleoIdentityUserOrganizationRoleSchemas
|
|
6
|
+
from .user_organization import MaleoIdentityUserOrganizationSchemas
|
|
7
|
+
from .user_profile import MaleoIdentityUserProfileSchemas
|
|
8
|
+
from .user_system_role import MaleoIdentityUserSystemRoleSchemas
|
|
9
|
+
from .user import MaleoIdentityUserSchemas
|
|
5
10
|
|
|
6
11
|
class MaleoIdentitySchemas:
|
|
7
12
|
General = MaleoIdentityGeneralSchemas
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
OrganizationRole = MaleoIdentityOrganizationRoleSchemas
|
|
14
|
+
Organization = MaleoIdentityOrganizationSchemas
|
|
15
|
+
UserOrganizationRole = MaleoIdentityUserOrganizationRoleSchemas
|
|
16
|
+
UserOrganization = MaleoIdentityUserOrganizationSchemas
|
|
17
|
+
UserProfile = MaleoIdentityUserProfileSchemas
|
|
18
|
+
UserSystemRole = MaleoIdentityUserSystemRoleSchemas
|
|
19
|
+
User = MaleoIdentityUserSchemas
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from maleo_foundation.types import BaseTypes
|
|
3
|
+
|
|
4
|
+
class MaleoIdentityGeneralSchemas:
|
|
5
|
+
class UserId(BaseModel):
|
|
6
|
+
user_id:int = Field(..., ge=1, description="User's ID")
|
|
7
|
+
|
|
8
|
+
class OptionalListOfUserIds(BaseModel):
|
|
9
|
+
user_ids:BaseTypes.OptionalListOfIntegers = Field(None, description="User's IDs")
|
|
10
|
+
|
|
11
|
+
class OrganizationId(BaseModel):
|
|
12
|
+
organization_id:int = Field(..., ge=1, description="Organization's ID")
|
|
13
|
+
|
|
14
|
+
class OptionalListOfOrganizationIds(BaseModel):
|
|
15
|
+
organization_ids:BaseTypes.OptionalListOfIntegers = Field(None, description="Organization's IDs")
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import
|
|
3
|
-
from maleo_foundation.types import BaseTypes
|
|
2
|
+
from typing import List, Optional
|
|
4
3
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
5
|
+
from maleo_foundation.types import BaseTypes
|
|
5
6
|
from maleo_identity.enums.organization import MaleoIdentityOrganizationEnums
|
|
6
7
|
|
|
7
|
-
class
|
|
8
|
-
class IdentifierType(
|
|
8
|
+
class MaleoIdentityOrganizationSchemas:
|
|
9
|
+
class IdentifierType(BaseParameterSchemas.IdentifierType):
|
|
9
10
|
identifier:MaleoIdentityOrganizationEnums.IdentifierType = Field(..., description="Organization's identifier")
|
|
10
11
|
|
|
11
|
-
class Expand(
|
|
12
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
12
13
|
expand:Optional[List[MaleoIdentityOrganizationEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
13
14
|
|
|
14
|
-
class
|
|
15
|
-
|
|
15
|
+
class OptionalParentId(BaseModel):
|
|
16
|
+
parent_id:BaseTypes.OptionalInteger = Field(None, ge=1, description="Parent organization's Id")
|
|
16
17
|
|
|
17
|
-
class
|
|
18
|
-
|
|
18
|
+
class OptionalListOfParentIds(BaseModel):
|
|
19
|
+
parent_ids:BaseTypes.OptionalListOfIntegers = Field(None, description="Parent organization's Ids")
|
|
19
20
|
|
|
20
21
|
class Key(BaseGeneralSchemas.Key):
|
|
21
22
|
key:str = Field(..., max_length=255, description="Organization's key")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
5
|
+
from maleo_identity.enums.organization_role import MaleoIdentityOrganizationRoleEnums
|
|
6
|
+
|
|
7
|
+
class MaleoIdentityOrganizationRoleSchemas:
|
|
8
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
9
|
+
expand:Optional[List[MaleoIdentityOrganizationRoleEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
10
|
+
|
|
11
|
+
class Key(BaseGeneralSchemas.Key):
|
|
12
|
+
key:str = Field(..., max_length=50, description="Organization Role's key")
|
|
13
|
+
|
|
14
|
+
class Name(BaseGeneralSchemas.Name):
|
|
15
|
+
name:str = Field(..., max_length=50, description="Organization Role's name")
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
3
4
|
from maleo_foundation.types import BaseTypes
|
|
4
5
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
5
6
|
|
|
6
|
-
class
|
|
7
|
-
class IdentifierType(
|
|
7
|
+
class MaleoIdentityUserSchemas:
|
|
8
|
+
class IdentifierType(BaseParameterSchemas.IdentifierType):
|
|
8
9
|
identifier:MaleoIdentityUserEnums.IdentifierType = Field(..., description="User's identifier")
|
|
9
10
|
|
|
10
|
-
class Expand(
|
|
11
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
11
12
|
expand:Optional[List[MaleoIdentityUserEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
12
13
|
|
|
14
|
+
class OptionalOrganizationId(BaseModel):
|
|
15
|
+
organization_id:BaseTypes.OptionalInteger = Field(..., ge=1, description="Organization's ID")
|
|
16
|
+
|
|
13
17
|
class Username(BaseModel):
|
|
14
18
|
username:str = Field(..., max_length=50, description="User's username")
|
|
15
19
|
|
|
16
|
-
class
|
|
20
|
+
class OptionalListOfUsernames(BaseModel):
|
|
17
21
|
usernames:BaseTypes.OptionalListOfStrings = Field(None, description="Specific usernames")
|
|
18
22
|
|
|
19
23
|
class Email(BaseModel):
|
|
20
24
|
email:str = Field(..., max_length=255, description="User's email")
|
|
21
25
|
|
|
22
|
-
class
|
|
26
|
+
class OptionalListOfEmails(BaseModel):
|
|
23
27
|
emails:BaseTypes.OptionalListOfStrings = Field(None, description="Specific emails")
|
|
24
28
|
|
|
25
29
|
class Phone(BaseModel):
|
|
26
30
|
phone:str = Field(..., max_length=15, description="User's username")
|
|
27
31
|
|
|
28
|
-
class
|
|
32
|
+
class OptionalListOfPhones(BaseModel):
|
|
29
33
|
phones:BaseTypes.OptionalListOfStrings = Field(None, description="Specific phones")
|
|
30
34
|
|
|
31
35
|
class Password(BaseModel):
|
|
32
|
-
password:str = Field(..., max_length=255, description="User's password")
|
|
33
|
-
|
|
34
|
-
class OptionalOrganizationId(BaseModel):
|
|
35
|
-
organization_id:BaseTypes.OptionalInteger = Field(..., ge=1, description="Organization's ID")
|
|
36
|
+
password:str = Field(..., max_length=255, description="User's password")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
4
|
+
from maleo_identity.enums.user_organization import MaleoIdentityUserOrganizationEnums
|
|
5
|
+
|
|
6
|
+
class MaleoIdentityUserOrganizationSchemas:
|
|
7
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
8
|
+
expand:Optional[List[MaleoIdentityUserOrganizationEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
5
|
+
from maleo_identity.enums.user_organization_role import MaleoIdentityUserOrganizationRoleEnums
|
|
6
|
+
|
|
7
|
+
class MaleoIdentityUserOrganizationRoleSchemas:
|
|
8
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
9
|
+
expand:Optional[List[MaleoIdentityUserOrganizationRoleEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
10
|
+
|
|
11
|
+
class Key(BaseGeneralSchemas.Key):
|
|
12
|
+
key:str = Field(..., max_length=50, description="Organization Role's key")
|
|
13
|
+
|
|
14
|
+
class Name(BaseGeneralSchemas.Name):
|
|
15
|
+
name:str = Field(..., max_length=50, description="Organization Role's name")
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
3
4
|
from maleo_foundation.types import BaseTypes
|
|
4
5
|
from maleo_identity.enums.user_profile import MaleoIdentityUserProfileEnums
|
|
5
6
|
|
|
6
|
-
class
|
|
7
|
-
class IdentifierType(
|
|
7
|
+
class MaleoIdentityUserProfileSchemas:
|
|
8
|
+
class IdentifierType(BaseParameterSchemas.IdentifierType):
|
|
8
9
|
identifier:MaleoIdentityUserProfileEnums.IdentifierType = Field(..., description="User profile's identifier")
|
|
9
10
|
|
|
10
|
-
class Expand(
|
|
11
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
11
12
|
expand:Optional[List[MaleoIdentityUserProfileEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
12
13
|
|
|
13
|
-
class UserId(BaseModel):
|
|
14
|
-
user_id:int = Field(..., ge=1, description="User's ID")
|
|
15
|
-
|
|
16
|
-
class OptionalListOfUserId(BaseModel):
|
|
17
|
-
user_ids:BaseTypes.OptionalListOfIntegers = Field(None, description="User's IDs")
|
|
18
|
-
|
|
19
14
|
class IdCard(BaseModel):
|
|
20
15
|
id_card:str = Field(..., max_length=16, description="User's ID Card")
|
|
21
16
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
4
|
+
from maleo_identity.enums.user_system_role import MaleoIdentityUserSystemRoleEnums
|
|
5
|
+
|
|
6
|
+
class MaleoIdentityUserSystemRoleSchemas:
|
|
7
|
+
class Expand(BaseParameterSchemas.Expand):
|
|
8
|
+
expand:Optional[List[MaleoIdentityUserSystemRoleEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import Integer, String, Enum, UUID
|
|
3
4
|
from uuid import uuid4
|
|
4
5
|
from maleo_metadata.enums.organization_type import MaleoMetadataOrganizationTypeEnums
|
|
@@ -12,7 +13,20 @@ class OrganizationsTable(MaleoIdentityMetadataManager.Base):
|
|
|
12
13
|
default=MaleoMetadataOrganizationTypeEnums.OrganizationType.REGULAR,
|
|
13
14
|
nullable=False
|
|
14
15
|
)
|
|
15
|
-
|
|
16
|
+
parent_id = Column("parent_id", Integer, ForeignKey("organizations.id", ondelete="SET NULL", onupdate="CASCADE"))
|
|
16
17
|
key = Column(name="key", type_=String(255), unique=True, nullable=False)
|
|
17
18
|
name = Column(name="name", type_=String(255), nullable=False)
|
|
18
|
-
secret = Column(name="secret", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
19
|
+
secret = Column(name="secret", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
20
|
+
parent = relationship(
|
|
21
|
+
"OrganizationsTable",
|
|
22
|
+
remote_side="OrganizationsTable.id",
|
|
23
|
+
back_populates="children"
|
|
24
|
+
)
|
|
25
|
+
children = relationship(
|
|
26
|
+
"OrganizationsTable",
|
|
27
|
+
back_populates="parent",
|
|
28
|
+
cascade="all",
|
|
29
|
+
lazy="select",
|
|
30
|
+
foreign_keys="[OrganizationsTable.parent_id]",
|
|
31
|
+
order_by="OrganizationsTable.id"
|
|
32
|
+
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from sqlalchemy import Column
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import String, Enum
|
|
3
4
|
from maleo_metadata.enums.user_type import MaleoMetadataUserTypeEnums
|
|
4
5
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
@@ -14,4 +15,15 @@ class UsersTable(MaleoIdentityMetadataManager.Base):
|
|
|
14
15
|
username = Column(name="username", type_=String(50), unique=True, nullable=False)
|
|
15
16
|
email = Column(name="email", type_=String(255), unique=True, nullable=False)
|
|
16
17
|
phone = Column(name="phone", type_=String(15), unique=True, nullable=False)
|
|
17
|
-
password = Column(name="password", type_=String(255), nullable=False)
|
|
18
|
+
password = Column(name="password", type_=String(255), nullable=False)
|
|
19
|
+
profile = relationship(
|
|
20
|
+
"UserProfilesTable",
|
|
21
|
+
back_populates="user",
|
|
22
|
+
uselist=False,
|
|
23
|
+
cascade="all, delete-orphan"
|
|
24
|
+
)
|
|
25
|
+
system_roles = relationship(
|
|
26
|
+
"UserSystemRolesTable",
|
|
27
|
+
back_populates="user_details",
|
|
28
|
+
cascade="all, delete-orphan"
|
|
29
|
+
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import String, Enum, Integer, Date
|
|
3
4
|
from maleo_metadata.enums.blood_type import MaleoMetadataBloodTypeEnums
|
|
4
5
|
from maleo_metadata.enums.gender import MaleoMetadataGenderEnums
|
|
@@ -8,6 +9,7 @@ class UserProfilesTable(MaleoIdentityMetadataManager.Base):
|
|
|
8
9
|
__tablename__ = "user_profiles"
|
|
9
10
|
#* Foreign Key and Relationship to UsersTable
|
|
10
11
|
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"), nullable=False)
|
|
12
|
+
user = relationship("UsersTable", back_populates="profile")
|
|
11
13
|
id_card = Column(name="id_card", type_=String(16))
|
|
12
14
|
leading_title = Column(name="leading_title", type_=String(25))
|
|
13
15
|
first_name = Column(name="first_name", type_=String(50), nullable=False)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import Enum, Integer
|
|
3
4
|
from maleo_metadata.enums.system_role import MaleoMetadataSystemRoleEnums
|
|
4
5
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
@@ -7,6 +8,7 @@ class UserSystemRolesTable(MaleoIdentityMetadataManager.Base):
|
|
|
7
8
|
__tablename__ = "user_system_roles"
|
|
8
9
|
#* Foreign Key and Relationship to UsersTable
|
|
9
10
|
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"), nullable=False)
|
|
11
|
+
user_details = relationship("UsersTable", back_populates="system_roles")
|
|
10
12
|
system_role = Column(
|
|
11
13
|
name="system_role",
|
|
12
14
|
type_=Enum(MaleoMetadataSystemRoleEnums.SystemRole, name="system_role"),
|