maleo-identity 0.0.52__py3-none-any.whl → 0.0.55__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/services/organization.py +170 -170
- maleo_identity/client/services/user.py +136 -136
- maleo_identity/constants/organization_registration_code.py +14 -0
- maleo_identity/enums/organization.py +2 -1
- maleo_identity/enums/organization_registration_code.py +8 -0
- maleo_identity/models/responses/organization_registration_code.py +46 -0
- maleo_identity/models/schemas/general.py +3 -0
- maleo_identity/models/schemas/organization_registration_code.py +21 -0
- maleo_identity/models/schemas/user.py +9 -5
- maleo_identity/models/tables/__init__.py +2 -0
- maleo_identity/models/tables/organization.py +7 -0
- maleo_identity/models/tables/organization_registration_code.py +29 -0
- maleo_identity/models/transfers/general/organization.py +2 -0
- maleo_identity/models/transfers/general/organization_registration_code.py +19 -0
- maleo_identity/models/transfers/parameters/client/organization_registration_code.py +24 -0
- maleo_identity/models/transfers/parameters/general/organization_registration_code.py +33 -0
- maleo_identity/models/transfers/parameters/general/user.py +28 -1
- maleo_identity/models/transfers/parameters/service/organization_registration_code.py +19 -0
- maleo_identity/models/transfers/results/client/organization_registration_code.py +15 -0
- maleo_identity/models/transfers/results/service/__init__.py +0 -0
- maleo_identity/models/transfers/results/service/organization_registration_code.py +15 -0
- maleo_identity/types/results/client/organization_registration_code.py +20 -0
- maleo_identity/types/results/service/__init__.py +0 -0
- maleo_identity/types/results/service/organization_registration_code.py +21 -0
- {maleo_identity-0.0.52.dist-info → maleo_identity-0.0.55.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.52.dist-info → maleo_identity-0.0.55.dist-info}/RECORD +28 -13
- {maleo_identity-0.0.52.dist-info → maleo_identity-0.0.55.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.52.dist-info → maleo_identity-0.0.55.dist-info}/top_level.txt +0 -0
|
@@ -66,37 +66,37 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
66
66
|
logger=self._logger,
|
|
67
67
|
fail_result_class=MaleoIdentityUserClientResultsTransfers.Fail
|
|
68
68
|
)
|
|
69
|
-
@BaseClientUtils.result_processor(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
@cached(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
69
|
+
# @BaseClientUtils.result_processor(
|
|
70
|
+
# fail_class=MaleoIdentityUserClientResultsTransfers.Fail,
|
|
71
|
+
# data_found_class=MaleoIdentityUserClientResultsTransfers.MultipleData,
|
|
72
|
+
# no_data_class=MaleoIdentityUserClientResultsTransfers.NoData
|
|
73
|
+
# )
|
|
74
|
+
# @cached(
|
|
75
|
+
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
76
|
+
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
77
|
+
# "user",
|
|
78
|
+
# type=BaseEnums.CacheType.CLIENT,
|
|
79
|
+
# base_override=self.key
|
|
80
|
+
# ),
|
|
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
|
+
# ),
|
|
93
|
+
# cache=Cache.REDIS,
|
|
94
|
+
# serializer=JsonSerializer(),
|
|
95
|
+
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
96
|
+
# port=self.service_manager.configs.cache.redis.port,
|
|
97
|
+
# password=self.service_manager.configs.cache.redis.password,
|
|
98
|
+
# db=self.service_manager.configs.cache.redis.db
|
|
99
|
+
# )
|
|
100
100
|
async def _impl(
|
|
101
101
|
parameters:MaleoIdentityUserClientParametersTransfers.GetMultiple,
|
|
102
102
|
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
@@ -131,7 +131,7 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
131
131
|
MaleoIdentityUserClientResultsTransfers
|
|
132
132
|
.Fail
|
|
133
133
|
.model_validate(controller_result.content)
|
|
134
|
-
.model_dump(mode="json")
|
|
134
|
+
# .model_dump(mode="json")
|
|
135
135
|
)
|
|
136
136
|
else:
|
|
137
137
|
if controller_result.content["data"] is None:
|
|
@@ -139,14 +139,14 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
139
139
|
MaleoIdentityUserClientResultsTransfers
|
|
140
140
|
.NoData
|
|
141
141
|
.model_validate(controller_result.content)
|
|
142
|
-
.model_dump(mode="json")
|
|
142
|
+
# .model_dump(mode="json")
|
|
143
143
|
)
|
|
144
144
|
else:
|
|
145
145
|
return (
|
|
146
146
|
MaleoIdentityUserClientResultsTransfers
|
|
147
147
|
.MultipleData
|
|
148
148
|
.model_validate(controller_result.content)
|
|
149
|
-
.model_dump(mode="json")
|
|
149
|
+
# .model_dump(mode="json")
|
|
150
150
|
)
|
|
151
151
|
return await _impl(
|
|
152
152
|
parameters=parameters,
|
|
@@ -456,37 +456,37 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
456
456
|
logger=self._logger,
|
|
457
457
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
458
458
|
)
|
|
459
|
-
@BaseClientUtils.result_processor(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
)
|
|
464
|
-
@cached(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
)
|
|
459
|
+
# @BaseClientUtils.result_processor(
|
|
460
|
+
# fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
461
|
+
# data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.MultipleData,
|
|
462
|
+
# no_data_class=MaleoIdentityUserOrganizationClientResultsTransfers.NoData
|
|
463
|
+
# )
|
|
464
|
+
# @cached(
|
|
465
|
+
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
466
|
+
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
467
|
+
# "user_organization",
|
|
468
|
+
# type=BaseEnums.CacheType.CLIENT,
|
|
469
|
+
# base_override=self.key
|
|
470
|
+
# ),
|
|
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
|
+
# ),
|
|
483
|
+
# cache=Cache.REDIS,
|
|
484
|
+
# serializer=JsonSerializer(),
|
|
485
|
+
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
486
|
+
# port=self.service_manager.configs.cache.redis.port,
|
|
487
|
+
# password=self.service_manager.configs.cache.redis.password,
|
|
488
|
+
# db=self.service_manager.configs.cache.redis.db
|
|
489
|
+
# )
|
|
490
490
|
async def _impl(
|
|
491
491
|
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromUser,
|
|
492
492
|
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
@@ -521,7 +521,7 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
521
521
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
522
522
|
.Fail
|
|
523
523
|
.model_validate(controller_result.content)
|
|
524
|
-
.model_dump(mode="json")
|
|
524
|
+
# .model_dump(mode="json")
|
|
525
525
|
)
|
|
526
526
|
else:
|
|
527
527
|
if controller_result.content["data"] is None:
|
|
@@ -529,14 +529,14 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
529
529
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
530
530
|
.NoData
|
|
531
531
|
.model_validate(controller_result.content)
|
|
532
|
-
.model_dump(mode="json")
|
|
532
|
+
# .model_dump(mode="json")
|
|
533
533
|
)
|
|
534
534
|
else:
|
|
535
535
|
return (
|
|
536
536
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
537
537
|
.MultipleData
|
|
538
538
|
.model_validate(controller_result.content)
|
|
539
|
-
.model_dump(mode="json")
|
|
539
|
+
# .model_dump(mode="json")
|
|
540
540
|
)
|
|
541
541
|
return await _impl(
|
|
542
542
|
parameters=parameters,
|
|
@@ -643,37 +643,37 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
643
643
|
logger=self._logger,
|
|
644
644
|
fail_result_class=MaleoIdentityUserSystemRoleClientResultsTransfers.Fail
|
|
645
645
|
)
|
|
646
|
-
@BaseClientUtils.result_processor(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
)
|
|
651
|
-
@cached(
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
)
|
|
646
|
+
# @BaseClientUtils.result_processor(
|
|
647
|
+
# fail_class=MaleoIdentityUserSystemRoleClientResultsTransfers.Fail,
|
|
648
|
+
# data_found_class=MaleoIdentityUserSystemRoleClientResultsTransfers.MultipleData,
|
|
649
|
+
# no_data_class=MaleoIdentityUserSystemRoleClientResultsTransfers.NoData
|
|
650
|
+
# )
|
|
651
|
+
# @cached(
|
|
652
|
+
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
653
|
+
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
654
|
+
# "user_system_role",
|
|
655
|
+
# type=BaseEnums.CacheType.CLIENT,
|
|
656
|
+
# base_override=self.key
|
|
657
|
+
# ),
|
|
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
|
+
# ),
|
|
670
|
+
# cache=Cache.REDIS,
|
|
671
|
+
# serializer=JsonSerializer(),
|
|
672
|
+
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
673
|
+
# port=self.service_manager.configs.cache.redis.port,
|
|
674
|
+
# password=self.service_manager.configs.cache.redis.password,
|
|
675
|
+
# db=self.service_manager.configs.cache.redis.db
|
|
676
|
+
# )
|
|
677
677
|
async def _impl():
|
|
678
678
|
#* Validate chosen controller type
|
|
679
679
|
if not isinstance(
|
|
@@ -705,7 +705,7 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
705
705
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
706
706
|
.Fail
|
|
707
707
|
.model_validate(controller_result.content)
|
|
708
|
-
.model_dump(mode="json")
|
|
708
|
+
# .model_dump(mode="json")
|
|
709
709
|
)
|
|
710
710
|
else:
|
|
711
711
|
if controller_result.content["data"] is None:
|
|
@@ -713,14 +713,14 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
713
713
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
714
714
|
.NoData
|
|
715
715
|
.model_validate(controller_result.content)
|
|
716
|
-
.model_dump(mode="json")
|
|
716
|
+
# .model_dump(mode="json")
|
|
717
717
|
)
|
|
718
718
|
else:
|
|
719
719
|
return (
|
|
720
720
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
721
721
|
.MultipleData
|
|
722
722
|
.model_validate(controller_result.content)
|
|
723
|
-
.model_dump(mode="json")
|
|
723
|
+
# .model_dump(mode="json")
|
|
724
724
|
)
|
|
725
725
|
return await _impl(
|
|
726
726
|
parameters=parameters,
|
|
@@ -826,37 +826,37 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
826
826
|
logger=self._logger,
|
|
827
827
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
828
828
|
)
|
|
829
|
-
@BaseClientUtils.result_processor(
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
)
|
|
834
|
-
@cached(
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
)
|
|
829
|
+
# @BaseClientUtils.result_processor(
|
|
830
|
+
# fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
831
|
+
# data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.MultipleData,
|
|
832
|
+
# no_data_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.NoData
|
|
833
|
+
# )
|
|
834
|
+
# @cached(
|
|
835
|
+
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
836
|
+
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
837
|
+
# "user_organization_role",
|
|
838
|
+
# type=BaseEnums.CacheType.CLIENT,
|
|
839
|
+
# base_override=self.key
|
|
840
|
+
# ),
|
|
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
|
+
# ),
|
|
853
|
+
# cache=Cache.REDIS,
|
|
854
|
+
# serializer=JsonSerializer(),
|
|
855
|
+
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
856
|
+
# port=self.service_manager.configs.cache.redis.port,
|
|
857
|
+
# password=self.service_manager.configs.cache.redis.password,
|
|
858
|
+
# db=self.service_manager.configs.cache.redis.db
|
|
859
|
+
# )
|
|
860
860
|
async def _impl(
|
|
861
861
|
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
862
862
|
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
@@ -891,7 +891,7 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
891
891
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
892
892
|
.Fail
|
|
893
893
|
.model_validate(controller_result.content)
|
|
894
|
-
.model_dump(mode="json")
|
|
894
|
+
# .model_dump(mode="json")
|
|
895
895
|
)
|
|
896
896
|
else:
|
|
897
897
|
if controller_result.content["data"] is None:
|
|
@@ -899,14 +899,14 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
899
899
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
900
900
|
.NoData
|
|
901
901
|
.model_validate(controller_result.content)
|
|
902
|
-
.model_dump(mode="json")
|
|
902
|
+
# .model_dump(mode="json")
|
|
903
903
|
)
|
|
904
904
|
else:
|
|
905
905
|
return (
|
|
906
906
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
907
907
|
.MultipleData
|
|
908
908
|
.model_validate(controller_result.content)
|
|
909
|
-
.model_dump(mode="json")
|
|
909
|
+
# .model_dump(mode="json")
|
|
910
910
|
)
|
|
911
911
|
return await _impl(
|
|
912
912
|
parameters=parameters,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
from maleo_identity.enums.organization_registration_code import MaleoIdentityOrganizationRegistrationCodeEnums
|
|
4
|
+
|
|
5
|
+
class MaleoIdentityOrganizationRegistrationCodeConstants:
|
|
6
|
+
IDENTIFIER_TYPE_VALUE_TYPE_MAP:Dict[
|
|
7
|
+
MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType,
|
|
8
|
+
object
|
|
9
|
+
] = {
|
|
10
|
+
MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType.ID: int,
|
|
11
|
+
MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType.UUID: UUID,
|
|
12
|
+
MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType.ORGANIZATION_ID: int,
|
|
13
|
+
MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType.CODE: UUID
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
from maleo_foundation.models.responses import BaseResponses
|
|
3
|
+
from maleo_identity.enums.organization_registration_code import MaleoIdentityOrganizationRegistrationCodeEnums
|
|
4
|
+
from maleo_identity.models.transfers.general.organization_registration_code import OrganizationRegistrationCodeTransfers
|
|
5
|
+
|
|
6
|
+
class MaleoIdentityOrganizationRegistrationCodeResponses:
|
|
7
|
+
class InvalidIdentifierType(BaseResponses.BadRequest):
|
|
8
|
+
code:str = "IDT-ORC-001"
|
|
9
|
+
message:str = "Invalid identifier type"
|
|
10
|
+
description:str = "Invalid identifier type is given in the request"
|
|
11
|
+
other: str = f"Valid identifier types: {[f'{e.name} ({e.value})' for e in MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType]}"
|
|
12
|
+
|
|
13
|
+
class InvalidValueType(BaseResponses.BadRequest):
|
|
14
|
+
code:str = "IDT-ORC-002"
|
|
15
|
+
message:str = "Invalid value type"
|
|
16
|
+
description:str = "Invalid value type is given in the request"
|
|
17
|
+
|
|
18
|
+
class GetSingle(BaseResponses.SingleData):
|
|
19
|
+
code:str = "IDT-ORC-003"
|
|
20
|
+
message:str = "Organization registration code found"
|
|
21
|
+
description:str = "Requested organization registration code found in database"
|
|
22
|
+
data:OrganizationRegistrationCodeTransfers = Field(..., description="Organization registration code")
|
|
23
|
+
|
|
24
|
+
class GetMultiple(BaseResponses.PaginatedMultipleData):
|
|
25
|
+
code:str = "IDT-ORC-004"
|
|
26
|
+
message:str = "Organization registration codes found"
|
|
27
|
+
description:str = "Requested organization registration codes found in database"
|
|
28
|
+
data:list[OrganizationRegistrationCodeTransfers] = Field(..., description="Organization registration codes")
|
|
29
|
+
|
|
30
|
+
class CreateFailed(BaseResponses.BadRequest):
|
|
31
|
+
code:str = "IDT-ORC-005"
|
|
32
|
+
message:str = "Failed creating new organization registration code"
|
|
33
|
+
|
|
34
|
+
class CreateSuccess(BaseResponses.SingleData):
|
|
35
|
+
code:str = "IDT-ORC-006"
|
|
36
|
+
message:str = "Successfully created new organization registration code"
|
|
37
|
+
data:OrganizationRegistrationCodeTransfers = Field(..., description="Organization registration code")
|
|
38
|
+
|
|
39
|
+
class UpdateFailed(BaseResponses.BadRequest):
|
|
40
|
+
code:str = "IDT-ORC-007"
|
|
41
|
+
message:str = "Failed updating organization registration code's data"
|
|
42
|
+
|
|
43
|
+
class UpdateSuccess(BaseResponses.SingleData):
|
|
44
|
+
code:str = "IDT-ORC-008"
|
|
45
|
+
message:str = "Successfully updated organization registration code's data"
|
|
46
|
+
data:OrganizationRegistrationCodeTransfers = Field(..., description="Organization registration code")
|
|
@@ -11,5 +11,8 @@ class MaleoIdentityGeneralSchemas:
|
|
|
11
11
|
class OrganizationId(BaseModel):
|
|
12
12
|
organization_id:int = Field(..., ge=1, description="Organization's ID")
|
|
13
13
|
|
|
14
|
+
class OptionalOrganizationId(BaseModel):
|
|
15
|
+
organization_id:BaseTypes.OptionalInteger = Field(None, ge=1, description="Optional Organization's ID")
|
|
16
|
+
|
|
14
17
|
class OptionalListOfOrganizationIds(BaseModel):
|
|
15
18
|
organization_ids:BaseTypes.OptionalListOfIntegers = Field(None, description="Organization's IDs")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
5
|
+
from maleo_identity.enums.organization_registration_code import MaleoIdentityOrganizationRegistrationCodeEnums
|
|
6
|
+
|
|
7
|
+
class MaleoIdentityOrganizationRegistrationCodeSchemas:
|
|
8
|
+
class IdentifierType(BaseParameterSchemas.IdentifierType):
|
|
9
|
+
identifier:MaleoIdentityOrganizationRegistrationCodeEnums.IdentifierType = Field(..., description="Organization registration code's identifier")
|
|
10
|
+
|
|
11
|
+
class Name(BaseGeneralSchemas.Name):
|
|
12
|
+
name:str = Field(..., max_length=50, description="Organization Role's name")
|
|
13
|
+
|
|
14
|
+
class Code(BaseModel):
|
|
15
|
+
code:UUID = Field(..., description="Registration code")
|
|
16
|
+
|
|
17
|
+
class MaxUses(BaseModel):
|
|
18
|
+
max_uses:int = Field(..., ge=1, description="Max code uses")
|
|
19
|
+
|
|
20
|
+
class CurrentUses(BaseModel):
|
|
21
|
+
current_uses:int = Field(..., ge=0, description="Current code uses")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
from typing import List, Optional
|
|
3
|
+
from uuid import UUID
|
|
3
4
|
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
4
5
|
from maleo_foundation.types import BaseTypes
|
|
5
6
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
@@ -11,9 +12,6 @@ class MaleoIdentityUserSchemas:
|
|
|
11
12
|
class Expand(BaseParameterSchemas.Expand):
|
|
12
13
|
expand:Optional[List[MaleoIdentityUserEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
13
14
|
|
|
14
|
-
class OptionalOrganizationId(BaseModel):
|
|
15
|
-
organization_id:BaseTypes.OptionalInteger = Field(..., ge=1, description="Organization's ID")
|
|
16
|
-
|
|
17
15
|
class Username(BaseModel):
|
|
18
16
|
username:str = Field(..., max_length=50, description="User's username")
|
|
19
17
|
|
|
@@ -27,10 +25,16 @@ class MaleoIdentityUserSchemas:
|
|
|
27
25
|
emails:BaseTypes.OptionalListOfStrings = Field(None, description="Specific emails")
|
|
28
26
|
|
|
29
27
|
class Phone(BaseModel):
|
|
30
|
-
phone:str = Field(..., min_length=4, max_length=15,
|
|
28
|
+
phone:str = Field(..., min_length=4, max_length=15, description="User's phone")
|
|
31
29
|
|
|
32
30
|
class OptionalListOfPhones(BaseModel):
|
|
33
31
|
phones:BaseTypes.OptionalListOfStrings = Field(None, description="Specific phones")
|
|
34
32
|
|
|
35
33
|
class Password(BaseModel):
|
|
36
|
-
password:str = Field(..., max_length=255, description="User's password")
|
|
34
|
+
password:str = Field(..., max_length=255, description="User's password")
|
|
35
|
+
|
|
36
|
+
class PasswordConfirmation(BaseModel):
|
|
37
|
+
password_confirmation:str = Field(..., max_length=255, description="User's password confirmation")
|
|
38
|
+
|
|
39
|
+
class RegistrationCode(BaseModel):
|
|
40
|
+
registration_code:UUID = Field(..., description="Registration code")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from .organization import OrganizationsTable
|
|
3
|
+
from .organization_registration_code import OrganizationRegistrationCodesTable
|
|
3
4
|
from .organization_role import OrganizationRolesTable
|
|
4
5
|
from .user import UsersTable
|
|
5
6
|
from .user_profile import UserProfilesTable
|
|
@@ -9,6 +10,7 @@ from .user_organization_role import UserOrganizationRolesTable
|
|
|
9
10
|
|
|
10
11
|
class MaleoIdentityTables:
|
|
11
12
|
Organization = OrganizationsTable
|
|
13
|
+
OrganizationRegistrationCode = OrganizationRegistrationCodesTable
|
|
12
14
|
OrganizationRole = OrganizationRolesTable
|
|
13
15
|
User = UsersTable
|
|
14
16
|
UserProfile = UserProfilesTable
|
|
@@ -29,4 +29,11 @@ class OrganizationsTable(MaleoIdentityMetadataManager.Base):
|
|
|
29
29
|
lazy="select",
|
|
30
30
|
foreign_keys="[OrganizationsTable.parent_id]",
|
|
31
31
|
order_by="OrganizationsTable.id"
|
|
32
|
+
)
|
|
33
|
+
registration_code = relationship(
|
|
34
|
+
"OrganizationRegistrationCodesTable",
|
|
35
|
+
back_populates="organization",
|
|
36
|
+
cascade="all",
|
|
37
|
+
lazy="select",
|
|
38
|
+
uselist=False
|
|
32
39
|
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
3
|
+
from sqlalchemy.types import Integer, UUID
|
|
4
|
+
from uuid import uuid4
|
|
5
|
+
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
6
|
+
|
|
7
|
+
class OrganizationRegistrationCodesTable(MaleoIdentityMetadataManager.Base):
|
|
8
|
+
__tablename__ = "organization_registration_codes"
|
|
9
|
+
#* Foreign Key OrganizationsTable
|
|
10
|
+
organization_id = Column(
|
|
11
|
+
Integer,
|
|
12
|
+
ForeignKey(
|
|
13
|
+
"organizations.id",
|
|
14
|
+
ondelete="CASCADE",
|
|
15
|
+
onupdate="CASCADE"
|
|
16
|
+
),
|
|
17
|
+
unique=True,
|
|
18
|
+
nullable=False
|
|
19
|
+
)
|
|
20
|
+
organization = relationship(
|
|
21
|
+
"OrganizationsTable",
|
|
22
|
+
back_populates="registration_code",
|
|
23
|
+
cascade="all",
|
|
24
|
+
lazy="select",
|
|
25
|
+
uselist=False
|
|
26
|
+
)
|
|
27
|
+
code = Column(name="code", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
28
|
+
max_uses = Column(name="max_uses", type_=Integer, nullable=False, default=1)
|
|
29
|
+
current_uses = Column(name="current_uses", type_=Integer, nullable=False, default=0)
|
|
@@ -3,8 +3,10 @@ from typing import List, Optional
|
|
|
3
3
|
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
4
|
from maleo_metadata.models.expanded_schemas.organization_type import MaleoMetadataOrganizationTypeExpandedSchemas
|
|
5
5
|
from maleo_identity.models.schemas.organization import MaleoIdentityOrganizationSchemas
|
|
6
|
+
from .organization_registration_code import OptionalOrganizationRegistrationCodeTransfers
|
|
6
7
|
|
|
7
8
|
class OrganizationTransfers(
|
|
9
|
+
OptionalOrganizationRegistrationCodeTransfers,
|
|
8
10
|
MaleoIdentityOrganizationSchemas.Name,
|
|
9
11
|
MaleoIdentityOrganizationSchemas.Key,
|
|
10
12
|
MaleoIdentityOrganizationSchemas.OptionalParentId,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from maleo_foundation.models.schemas.general import BaseGeneralSchemas
|
|
4
|
+
from maleo_identity.models.schemas.general import MaleoIdentityGeneralSchemas
|
|
5
|
+
from maleo_identity.models.schemas.organization_registration_code import MaleoIdentityOrganizationRegistrationCodeSchemas
|
|
6
|
+
|
|
7
|
+
class OrganizationRegistrationCodeTransfers(
|
|
8
|
+
MaleoIdentityOrganizationRegistrationCodeSchemas.CurrentUses,
|
|
9
|
+
MaleoIdentityOrganizationRegistrationCodeSchemas.MaxUses,
|
|
10
|
+
MaleoIdentityOrganizationRegistrationCodeSchemas.Code,
|
|
11
|
+
MaleoIdentityGeneralSchemas.OrganizationId,
|
|
12
|
+
BaseGeneralSchemas.Status,
|
|
13
|
+
BaseGeneralSchemas.Timestamps,
|
|
14
|
+
BaseGeneralSchemas.Identifiers
|
|
15
|
+
):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
class OptionalOrganizationRegistrationCodeTransfers(BaseModel):
|
|
19
|
+
registration_code:Optional[OrganizationRegistrationCodeTransfers] = Field(..., description="Registration codes")
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
|
3
|
+
from maleo_foundation.models.transfers.parameters.client import BaseClientParametersTransfers
|
|
4
|
+
from maleo_identity.models.schemas.general import MaleoIdentityGeneralSchemas
|
|
5
|
+
|
|
6
|
+
class MaleoIdentityOrganizationRegistrationCodeClientParametersTransfers:
|
|
7
|
+
class GetMultipleFromOrganization(
|
|
8
|
+
BaseClientParametersTransfers.GetPaginatedMultiple,
|
|
9
|
+
MaleoIdentityGeneralSchemas.OrganizationId
|
|
10
|
+
): pass
|
|
11
|
+
|
|
12
|
+
class GetMultiple(
|
|
13
|
+
BaseClientParametersTransfers.GetPaginatedMultiple,
|
|
14
|
+
MaleoIdentityGeneralSchemas.OptionalListOfOrganizationIds
|
|
15
|
+
): pass
|
|
16
|
+
|
|
17
|
+
class GetMultipleFromOrganizationQuery(
|
|
18
|
+
BaseClientParametersTransfers.GetPaginatedMultipleQuery
|
|
19
|
+
): pass
|
|
20
|
+
|
|
21
|
+
class GetMultipleQuery(
|
|
22
|
+
BaseClientParametersTransfers.GetPaginatedMultipleQuery,
|
|
23
|
+
MaleoIdentityGeneralSchemas.OptionalListOfOrganizationIds
|
|
24
|
+
): pass
|