maleo-identity 0.0.54__py3-none-any.whl → 0.0.58__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 +300 -63
- maleo_identity/client/controllers/http/user.py +253 -52
- maleo_identity/client/services/organization.py +184 -418
- maleo_identity/client/services/user.py +159 -345
- maleo_identity/constants/organization_registration_code.py +14 -0
- maleo_identity/constants/organization_role.py +4 -2
- maleo_identity/constants/user.py +3 -0
- maleo_identity/constants/user_organization.py +19 -4
- maleo_identity/constants/user_organization_role.py +8 -4
- maleo_identity/constants/user_system_role.py +1 -10
- maleo_identity/enums/organization.py +2 -1
- maleo_identity/enums/organization_registration_code.py +8 -0
- maleo_identity/enums/organization_role.py +2 -1
- maleo_identity/enums/user.py +2 -0
- maleo_identity/enums/user_organization.py +8 -2
- maleo_identity/enums/user_organization_role.py +8 -1
- maleo_identity/enums/user_system_role.py +0 -5
- maleo_identity/models/responses/organization_registration_code.py +46 -0
- maleo_identity/models/responses/user.py +13 -1
- maleo_identity/models/schemas/general.py +3 -0
- maleo_identity/models/schemas/organization_registration_code.py +21 -0
- maleo_identity/models/schemas/user.py +13 -5
- maleo_identity/models/tables/__init__.py +2 -0
- maleo_identity/models/tables/organization.py +28 -2
- maleo_identity/models/tables/organization_registration_code.py +37 -0
- maleo_identity/models/tables/organization_role.py +35 -4
- maleo_identity/models/tables/user.py +17 -3
- maleo_identity/models/tables/user_organization.py +52 -4
- maleo_identity/models/tables/user_organization_role.py +63 -4
- maleo_identity/models/tables/user_profile.py +11 -4
- maleo_identity/models/tables/user_system_role.py +12 -5
- maleo_identity/models/transfers/general/organization.py +6 -1
- maleo_identity/models/transfers/general/organization_registration_code.py +19 -0
- maleo_identity/models/transfers/general/organization_role.py +5 -1
- maleo_identity/models/transfers/general/user.py +6 -1
- maleo_identity/models/transfers/general/user_organization.py +5 -1
- maleo_identity/models/transfers/general/user_organization_role.py +10 -10
- maleo_identity/models/transfers/general/user_system_role.py +6 -3
- 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/client/user.py +7 -1
- maleo_identity/models/transfers/results/general/user.py +7 -1
- maleo_identity/models/transfers/results/repository/user.py +7 -1
- 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/client/user.py +5 -0
- maleo_identity/types/results/general/user.py +5 -0
- maleo_identity/types/results/repository/user.py +5 -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.54.dist-info → maleo_identity-0.0.58.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.54.dist-info → maleo_identity-0.0.58.dist-info}/RECORD +58 -43
- {maleo_identity-0.0.54.dist-info → maleo_identity-0.0.58.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.54.dist-info → maleo_identity-0.0.58.dist-info}/top_level.txt +0 -0
|
@@ -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
|
+
}
|
|
@@ -8,7 +8,8 @@ class MaleoIdentityOrganizationRoleConstants:
|
|
|
8
8
|
List[MaleoIdentityOrganizationRoleEnums.ExpandableFields]
|
|
9
9
|
] = {
|
|
10
10
|
MaleoIdentityOrganizationRoleEnums.ExpandableFields.ORGANIZATION: [
|
|
11
|
-
MaleoIdentityOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
11
|
+
MaleoIdentityOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
12
|
+
MaleoIdentityOrganizationRoleEnums.ExpandableFields.REGISTRATION_CODE
|
|
12
13
|
]
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -16,5 +17,6 @@ class MaleoIdentityOrganizationRoleConstants:
|
|
|
16
17
|
MaleoIdentityOrganizationRoleEnums.ExpandableFields,
|
|
17
18
|
MaleoIdentityOrganizationEnums.ExpandableFields
|
|
18
19
|
] = {
|
|
19
|
-
MaleoIdentityOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
20
|
+
MaleoIdentityOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
21
|
+
MaleoIdentityOrganizationRoleEnums.ExpandableFields.REGISTRATION_CODE: MaleoIdentityOrganizationEnums.ExpandableFields.REGISTRATION_CODE
|
|
20
22
|
}
|
maleo_identity/constants/user.py
CHANGED
|
@@ -20,5 +20,8 @@ class MaleoIdentityUserConstants:
|
|
|
20
20
|
MaleoIdentityUserEnums.ExpandableFields.PROFILE: [
|
|
21
21
|
MaleoIdentityUserEnums.ExpandableFields.GENDER,
|
|
22
22
|
MaleoIdentityUserEnums.ExpandableFields.BLOOD_TYPE
|
|
23
|
+
],
|
|
24
|
+
MaleoIdentityUserEnums.ExpandableFields.SYSTEM_ROLES: [
|
|
25
|
+
MaleoIdentityUserEnums.ExpandableFields.SYSTEM_ROLE_DETAILS
|
|
23
26
|
]
|
|
24
27
|
}
|
|
@@ -9,10 +9,19 @@ class MaleoIdentityUserOrganizationConstants:
|
|
|
9
9
|
List[MaleoIdentityUserOrganizationEnums.ExpandableFields]
|
|
10
10
|
] = {
|
|
11
11
|
MaleoIdentityUserOrganizationEnums.ExpandableFields.USER: [
|
|
12
|
-
MaleoIdentityUserOrganizationEnums.ExpandableFields.USER_TYPE
|
|
12
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.USER_TYPE,
|
|
13
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.PROFILE
|
|
14
|
+
],
|
|
15
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.PROFILE: [
|
|
16
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.BLOOD_TYPE,
|
|
17
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.GENDER
|
|
18
|
+
],
|
|
19
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.SYSTEM_ROLES: [
|
|
20
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.SYSTEM_ROLE_DETAILS
|
|
13
21
|
],
|
|
14
22
|
MaleoIdentityUserOrganizationEnums.ExpandableFields.ORGANIZATION: [
|
|
15
|
-
MaleoIdentityUserOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
23
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
24
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.REGISTRATION_CODE
|
|
16
25
|
]
|
|
17
26
|
}
|
|
18
27
|
|
|
@@ -20,12 +29,18 @@ class MaleoIdentityUserOrganizationConstants:
|
|
|
20
29
|
MaleoIdentityUserOrganizationEnums.ExpandableFields,
|
|
21
30
|
MaleoIdentityUserEnums.ExpandableFields
|
|
22
31
|
] = {
|
|
23
|
-
MaleoIdentityUserOrganizationEnums.ExpandableFields.USER_TYPE: MaleoIdentityUserEnums.ExpandableFields.USER_TYPE
|
|
32
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.USER_TYPE: MaleoIdentityUserEnums.ExpandableFields.USER_TYPE,
|
|
33
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.PROFILE: MaleoIdentityUserEnums.ExpandableFields.PROFILE,
|
|
34
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.BLOOD_TYPE: MaleoIdentityUserEnums.ExpandableFields.BLOOD_TYPE,
|
|
35
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.GENDER: MaleoIdentityUserEnums.ExpandableFields.GENDER,
|
|
36
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.SYSTEM_ROLES: MaleoIdentityUserEnums.ExpandableFields.SYSTEM_ROLES,
|
|
37
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.SYSTEM_ROLE_DETAILS: MaleoIdentityUserEnums.ExpandableFields.SYSTEM_ROLE_DETAILS
|
|
24
38
|
}
|
|
25
39
|
|
|
26
40
|
ORGANIZATION_EXPANDABLE_FIELDS_MAP:Dict[
|
|
27
41
|
MaleoIdentityUserOrganizationEnums.ExpandableFields,
|
|
28
42
|
MaleoIdentityOrganizationEnums.ExpandableFields
|
|
29
43
|
] = {
|
|
30
|
-
MaleoIdentityUserOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
44
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
45
|
+
MaleoIdentityUserOrganizationEnums.ExpandableFields.REGISTRATION_CODE: MaleoIdentityOrganizationEnums.ExpandableFields.REGISTRATION_CODE
|
|
31
46
|
}
|
|
@@ -9,10 +9,12 @@ class MaleoIdentityUserOrganizationRoleConstants:
|
|
|
9
9
|
List[MaleoIdentityUserOrganizationRoleEnums.ExpandableFields]
|
|
10
10
|
] = {
|
|
11
11
|
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.USER: [
|
|
12
|
-
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.USER_TYPE
|
|
12
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.USER_TYPE,
|
|
13
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.PROFILE
|
|
13
14
|
],
|
|
14
15
|
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.ORGANIZATION: [
|
|
15
|
-
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
16
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
17
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.REGISTRATION_CODE
|
|
16
18
|
]
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -20,12 +22,14 @@ class MaleoIdentityUserOrganizationRoleConstants:
|
|
|
20
22
|
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields,
|
|
21
23
|
MaleoIdentityUserEnums.ExpandableFields
|
|
22
24
|
] = {
|
|
23
|
-
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.USER_TYPE: MaleoIdentityUserEnums.ExpandableFields.USER_TYPE
|
|
25
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.USER_TYPE: MaleoIdentityUserEnums.ExpandableFields.USER_TYPE,
|
|
26
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.PROFILE: MaleoIdentityUserEnums.ExpandableFields.PROFILE
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
ORGANIZATION_EXPANDABLE_FIELDS_MAP:Dict[
|
|
27
30
|
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields,
|
|
28
31
|
MaleoIdentityOrganizationEnums.ExpandableFields
|
|
29
32
|
] = {
|
|
30
|
-
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE
|
|
33
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.ORGANIZATION_TYPE: MaleoIdentityOrganizationEnums.ExpandableFields.ORGANIZATION_TYPE,
|
|
34
|
+
MaleoIdentityUserOrganizationRoleEnums.ExpandableFields.REGISTRATION_CODE: MaleoIdentityOrganizationEnums.ExpandableFields.REGISTRATION_CODE
|
|
31
35
|
}
|
|
@@ -6,13 +6,4 @@ class MaleoIdentityUserSystemRoleConstants:
|
|
|
6
6
|
EXPANDABLE_FIELDS_DEPENDENCIES_MAP:Dict[
|
|
7
7
|
MaleoIdentityUserSystemRoleEnums.ExpandableFields,
|
|
8
8
|
List[MaleoIdentityUserSystemRoleEnums.ExpandableFields]
|
|
9
|
-
] = {
|
|
10
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER: [
|
|
11
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.USER_TYPE,
|
|
12
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.PROFILE
|
|
13
|
-
],
|
|
14
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.PROFILE: [
|
|
15
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.GENDER,
|
|
16
|
-
MaleoIdentityUserSystemRoleEnums.ExpandableFields.BLOOD_TYPE
|
|
17
|
-
]
|
|
18
|
-
}
|
|
9
|
+
] = {}
|
|
@@ -3,4 +3,5 @@ from enum import StrEnum
|
|
|
3
3
|
class MaleoIdentityOrganizationRoleEnums:
|
|
4
4
|
class ExpandableFields(StrEnum):
|
|
5
5
|
ORGANIZATION = "organization"
|
|
6
|
-
ORGANIZATION_TYPE = "organization.organization_type"
|
|
6
|
+
ORGANIZATION_TYPE = "organization.organization_type"
|
|
7
|
+
REGISTRATION_CODE = "organization.registration_code"
|
maleo_identity/enums/user.py
CHANGED
|
@@ -9,6 +9,8 @@ class MaleoIdentityUserEnums:
|
|
|
9
9
|
|
|
10
10
|
class ExpandableFields(StrEnum):
|
|
11
11
|
USER_TYPE = "user_type"
|
|
12
|
+
SYSTEM_ROLES = "system_roles"
|
|
13
|
+
SYSTEM_ROLE_DETAILS = "system_roles.system_role_details"
|
|
12
14
|
PROFILE = "profile"
|
|
13
15
|
GENDER = "profile.gender"
|
|
14
16
|
BLOOD_TYPE = "profile.blood_type"
|
|
@@ -3,6 +3,12 @@ from enum import StrEnum
|
|
|
3
3
|
class MaleoIdentityUserOrganizationEnums:
|
|
4
4
|
class ExpandableFields(StrEnum):
|
|
5
5
|
USER = "user"
|
|
6
|
-
USER_TYPE = "
|
|
6
|
+
USER_TYPE = "user_type"
|
|
7
|
+
SYSTEM_ROLES = "system_roles"
|
|
8
|
+
SYSTEM_ROLE_DETAILS = "system_roles.system_role_details"
|
|
9
|
+
PROFILE = "profile"
|
|
10
|
+
GENDER = "profile.gender"
|
|
11
|
+
BLOOD_TYPE = "profile.blood_type"
|
|
7
12
|
ORGANIZATION = "organization"
|
|
8
|
-
ORGANIZATION_TYPE = "organization.organization_type"
|
|
13
|
+
ORGANIZATION_TYPE = "organization.organization_type"
|
|
14
|
+
REGISTRATION_CODE = "organization.registration_code"
|
|
@@ -4,5 +4,12 @@ class MaleoIdentityUserOrganizationRoleEnums:
|
|
|
4
4
|
class ExpandableFields(StrEnum):
|
|
5
5
|
USER = "user"
|
|
6
6
|
USER_TYPE = "user.user_type"
|
|
7
|
+
SYSTEM_ROLES = "system_roles"
|
|
8
|
+
SYSTEM_ROLE_DETAILS = "system_roles.system_role_details"
|
|
9
|
+
PROFILE = "user.profile"
|
|
10
|
+
GENDER = "profile.gender"
|
|
11
|
+
BLOOD_TYPE = "profile.blood_type"
|
|
7
12
|
ORGANIZATION = "organization"
|
|
8
|
-
ORGANIZATION_TYPE = "organization.organization_type"
|
|
13
|
+
ORGANIZATION_TYPE = "organization.organization_type"
|
|
14
|
+
REGISTRATION_CODE = "organization.registration_code"
|
|
15
|
+
USER_ORGANIZATION = "user_organization"
|
|
@@ -2,9 +2,4 @@ from enum import StrEnum
|
|
|
2
2
|
|
|
3
3
|
class MaleoIdentityUserSystemRoleEnums:
|
|
4
4
|
class ExpandableFields(StrEnum):
|
|
5
|
-
USER = "user"
|
|
6
|
-
USER_TYPE = "user.user_type"
|
|
7
|
-
PROFILE = "user.profile"
|
|
8
|
-
GENDER = "user.profile.gender"
|
|
9
|
-
BLOOD_TYPE = "user.profile.blood_type"
|
|
10
5
|
SYSTEM_ROLE = "system_role"
|
|
@@ -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")
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from pydantic import Field
|
|
2
|
+
from typing import Optional
|
|
2
3
|
from maleo_foundation.models.responses import BaseResponses
|
|
3
4
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
5
|
+
from maleo_identity.models.schemas.user import MaleoIdentityUserSchemas
|
|
4
6
|
from maleo_identity.models.transfers.general.user import UserTransfers, PasswordTransfers
|
|
5
7
|
|
|
6
8
|
class MaleoIdentityUserResponses:
|
|
@@ -53,4 +55,14 @@ class MaleoIdentityUserResponses:
|
|
|
53
55
|
code:str = "IDT-USR-010"
|
|
54
56
|
message:str = "User's password found"
|
|
55
57
|
description:str = "Requested user's password found in database"
|
|
56
|
-
data:PasswordTransfers = Field(..., description="User's password")
|
|
58
|
+
data:PasswordTransfers = Field(..., description="User's password")
|
|
59
|
+
|
|
60
|
+
class RegisterFailed(BaseResponses.BadRequest):
|
|
61
|
+
code:str = "IDT-USR-011"
|
|
62
|
+
message:str = "Failed registering new user"
|
|
63
|
+
|
|
64
|
+
class RegisterSuccess(BaseResponses.SingleData):
|
|
65
|
+
code:str = "IDT-USR-012"
|
|
66
|
+
message:str = "Successfully registered new user"
|
|
67
|
+
data:UserTransfers = Field(..., description="User")
|
|
68
|
+
metadata:Optional[MaleoIdentityUserSchemas.RegisterResultMetadata] = Field(None, description="Optional metadata")
|
|
@@ -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,6 +1,8 @@
|
|
|
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
|
|
5
|
+
from maleo_foundation.models.schemas.result import ResultMetadata
|
|
4
6
|
from maleo_foundation.types import BaseTypes
|
|
5
7
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
6
8
|
|
|
@@ -11,9 +13,6 @@ class MaleoIdentityUserSchemas:
|
|
|
11
13
|
class Expand(BaseParameterSchemas.Expand):
|
|
12
14
|
expand:Optional[List[MaleoIdentityUserEnums.ExpandableFields]] = Field(None, description="Expanded field(s)")
|
|
13
15
|
|
|
14
|
-
class OptionalOrganizationId(BaseModel):
|
|
15
|
-
organization_id:BaseTypes.OptionalInteger = Field(..., ge=1, description="Organization's ID")
|
|
16
|
-
|
|
17
16
|
class Username(BaseModel):
|
|
18
17
|
username:str = Field(..., max_length=50, description="User's username")
|
|
19
18
|
|
|
@@ -27,10 +26,19 @@ class MaleoIdentityUserSchemas:
|
|
|
27
26
|
emails:BaseTypes.OptionalListOfStrings = Field(None, description="Specific emails")
|
|
28
27
|
|
|
29
28
|
class Phone(BaseModel):
|
|
30
|
-
phone:str = Field(..., min_length=4, max_length=15,
|
|
29
|
+
phone:str = Field(..., min_length=4, max_length=15, description="User's phone")
|
|
31
30
|
|
|
32
31
|
class OptionalListOfPhones(BaseModel):
|
|
33
32
|
phones:BaseTypes.OptionalListOfStrings = Field(None, description="Specific phones")
|
|
34
33
|
|
|
35
34
|
class Password(BaseModel):
|
|
36
|
-
password:str = Field(..., max_length=255, description="User's password")
|
|
35
|
+
password:str = Field(..., max_length=255, description="User's password")
|
|
36
|
+
|
|
37
|
+
class PasswordConfirmation(BaseModel):
|
|
38
|
+
password_confirmation:str = Field(..., max_length=255, description="User's password confirmation")
|
|
39
|
+
|
|
40
|
+
class RegistrationCode(BaseModel):
|
|
41
|
+
registration_code:UUID = Field(..., description="Registration code")
|
|
42
|
+
|
|
43
|
+
class RegisterResultMetadata(ResultMetadata):
|
|
44
|
+
organization_key:BaseTypes.OptionalString = Field(None, description="Organization key")
|
|
@@ -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
|
|
@@ -4,9 +4,9 @@ from sqlalchemy.types import Integer, String, Enum, UUID
|
|
|
4
4
|
from uuid import uuid4
|
|
5
5
|
from maleo_metadata.enums.organization_type import MaleoMetadataOrganizationTypeEnums
|
|
6
6
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
7
|
+
from maleo_foundation.models.table import DataTable
|
|
7
8
|
|
|
8
|
-
class
|
|
9
|
-
__tablename__ = "organizations"
|
|
9
|
+
class OrganizationsMixin:
|
|
10
10
|
organization_type = Column(
|
|
11
11
|
name="organization_type",
|
|
12
12
|
type_=Enum(MaleoMetadataOrganizationTypeEnums.OrganizationType, name="organization_type"),
|
|
@@ -17,6 +17,13 @@ class OrganizationsTable(MaleoIdentityMetadataManager.Base):
|
|
|
17
17
|
key = Column(name="key", type_=String(255), unique=True, nullable=False)
|
|
18
18
|
name = Column(name="name", type_=String(255), nullable=False)
|
|
19
19
|
secret = Column(name="secret", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
20
|
+
|
|
21
|
+
class OrganizationsTable(
|
|
22
|
+
OrganizationsMixin,
|
|
23
|
+
DataTable,
|
|
24
|
+
MaleoIdentityMetadataManager.Base
|
|
25
|
+
):
|
|
26
|
+
__tablename__ = "organizations"
|
|
20
27
|
parent = relationship(
|
|
21
28
|
"OrganizationsTable",
|
|
22
29
|
remote_side="OrganizationsTable.id",
|
|
@@ -29,4 +36,23 @@ class OrganizationsTable(MaleoIdentityMetadataManager.Base):
|
|
|
29
36
|
lazy="select",
|
|
30
37
|
foreign_keys="[OrganizationsTable.parent_id]",
|
|
31
38
|
order_by="OrganizationsTable.id"
|
|
39
|
+
)
|
|
40
|
+
registration_code = relationship(
|
|
41
|
+
"OrganizationRegistrationCodesTable",
|
|
42
|
+
back_populates="organization",
|
|
43
|
+
cascade="all",
|
|
44
|
+
lazy="select",
|
|
45
|
+
uselist=False
|
|
46
|
+
)
|
|
47
|
+
user_organization = relationship(
|
|
48
|
+
"UserOrganizationsTable",
|
|
49
|
+
back_populates="organization",
|
|
50
|
+
cascade="all, delete-orphan",
|
|
51
|
+
uselist=False
|
|
52
|
+
)
|
|
53
|
+
organization_roles = relationship(
|
|
54
|
+
"OrganizationRolesTable",
|
|
55
|
+
back_populates="organization",
|
|
56
|
+
cascade="all, delete-orphan",
|
|
57
|
+
uselist=False
|
|
32
58
|
)
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
from maleo_foundation.models.table import DataTable
|
|
7
|
+
|
|
8
|
+
class OrganizationRegistrationCodesMixin:
|
|
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
|
+
code = Column(name="code", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
21
|
+
max_uses = Column(name="max_uses", type_=Integer, nullable=False, default=1)
|
|
22
|
+
current_uses = Column(name="current_uses", type_=Integer, nullable=False, default=0)
|
|
23
|
+
|
|
24
|
+
class OrganizationRegistrationCodesTable(
|
|
25
|
+
OrganizationRegistrationCodesMixin,
|
|
26
|
+
DataTable,
|
|
27
|
+
MaleoIdentityMetadataManager.Base
|
|
28
|
+
):
|
|
29
|
+
__tablename__ = "organization_registration_codes"
|
|
30
|
+
|
|
31
|
+
organization = relationship(
|
|
32
|
+
"OrganizationsTable",
|
|
33
|
+
back_populates="registration_code",
|
|
34
|
+
cascade="all",
|
|
35
|
+
lazy="select",
|
|
36
|
+
uselist=False
|
|
37
|
+
)
|
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import Integer, String, Boolean
|
|
3
4
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
5
|
+
from maleo_foundation.models.table import DataTable
|
|
4
6
|
|
|
5
|
-
class
|
|
6
|
-
__tablename__ = "organization_roles"
|
|
7
|
+
class OrganizationRolesMixin:
|
|
7
8
|
#* Foreign Key OrganizationsTable
|
|
8
|
-
organization_id = Column(
|
|
9
|
+
organization_id = Column(
|
|
10
|
+
Integer,
|
|
11
|
+
ForeignKey(
|
|
12
|
+
"organizations.id",
|
|
13
|
+
ondelete="CASCADE",
|
|
14
|
+
onupdate="CASCADE"
|
|
15
|
+
),
|
|
16
|
+
nullable=False
|
|
17
|
+
)
|
|
9
18
|
is_default = Column(name="is_default", type_=Boolean, nullable=False, default=False)
|
|
10
19
|
order = Column(name="order", type_=Integer)
|
|
11
20
|
key = Column(name="key", type_=String(50), nullable=False)
|
|
12
|
-
name = Column(name="name", type_=String(50), nullable=False)
|
|
21
|
+
name = Column(name="name", type_=String(50), nullable=False)
|
|
22
|
+
|
|
23
|
+
class OrganizationRolesTable(
|
|
24
|
+
OrganizationRolesMixin,
|
|
25
|
+
DataTable,
|
|
26
|
+
MaleoIdentityMetadataManager.Base
|
|
27
|
+
):
|
|
28
|
+
__tablename__ = "organization_roles"
|
|
29
|
+
|
|
30
|
+
organization = relationship(
|
|
31
|
+
"OrganizationsTable",
|
|
32
|
+
back_populates="organization_roles",
|
|
33
|
+
cascade="all",
|
|
34
|
+
lazy="select",
|
|
35
|
+
uselist=False
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
user_organization_roles = relationship(
|
|
39
|
+
"UserOrganizationRolesTable",
|
|
40
|
+
back_populates="organization_role",
|
|
41
|
+
cascade="all, delete-orphan",
|
|
42
|
+
lazy="select"
|
|
43
|
+
)
|
|
@@ -3,9 +3,9 @@ from sqlalchemy.orm import relationship
|
|
|
3
3
|
from sqlalchemy.types import String, Enum
|
|
4
4
|
from maleo_metadata.enums.user_type import MaleoMetadataUserTypeEnums
|
|
5
5
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
6
|
+
from maleo_foundation.models.table import DataTable
|
|
6
7
|
|
|
7
|
-
class
|
|
8
|
-
__tablename__ = "users"
|
|
8
|
+
class UsersMixin:
|
|
9
9
|
user_type = Column(
|
|
10
10
|
name="user_type",
|
|
11
11
|
type_=Enum(MaleoMetadataUserTypeEnums.UserType, name="user_type"),
|
|
@@ -16,6 +16,14 @@ class UsersTable(MaleoIdentityMetadataManager.Base):
|
|
|
16
16
|
email = Column(name="email", type_=String(255), unique=True, nullable=False)
|
|
17
17
|
phone = Column(name="phone", type_=String(15), nullable=False)
|
|
18
18
|
password = Column(name="password", type_=String(255), nullable=False)
|
|
19
|
+
|
|
20
|
+
class UsersTable(
|
|
21
|
+
UsersMixin,
|
|
22
|
+
DataTable,
|
|
23
|
+
MaleoIdentityMetadataManager.Base
|
|
24
|
+
):
|
|
25
|
+
__tablename__ = "users"
|
|
26
|
+
|
|
19
27
|
profile = relationship(
|
|
20
28
|
"UserProfilesTable",
|
|
21
29
|
back_populates="user",
|
|
@@ -24,6 +32,12 @@ class UsersTable(MaleoIdentityMetadataManager.Base):
|
|
|
24
32
|
)
|
|
25
33
|
system_roles = relationship(
|
|
26
34
|
"UserSystemRolesTable",
|
|
27
|
-
back_populates="
|
|
35
|
+
back_populates="user",
|
|
28
36
|
cascade="all, delete-orphan"
|
|
37
|
+
)
|
|
38
|
+
user_organization = relationship(
|
|
39
|
+
"UserOrganizationsTable",
|
|
40
|
+
back_populates="user",
|
|
41
|
+
cascade="all, delete-orphan",
|
|
42
|
+
uselist=False
|
|
29
43
|
)
|
|
@@ -1,10 +1,58 @@
|
|
|
1
1
|
from sqlalchemy import Column, ForeignKey
|
|
2
|
+
from sqlalchemy.orm import relationship
|
|
2
3
|
from sqlalchemy.types import Integer
|
|
3
4
|
from maleo_identity.db import MaleoIdentityMetadataManager
|
|
5
|
+
from maleo_foundation.models.table import DataTable
|
|
4
6
|
|
|
5
|
-
class
|
|
6
|
-
__tablename__ = "user_organizations"
|
|
7
|
+
class UserOrganizationsMixin:
|
|
7
8
|
#* Foreign Key UsersTable
|
|
8
|
-
user_id = Column(
|
|
9
|
+
user_id = Column(
|
|
10
|
+
Integer,
|
|
11
|
+
ForeignKey(
|
|
12
|
+
"users.id",
|
|
13
|
+
ondelete="CASCADE",
|
|
14
|
+
onupdate="CASCADE"
|
|
15
|
+
),
|
|
16
|
+
nullable=False
|
|
17
|
+
)
|
|
18
|
+
|
|
9
19
|
#* Foreign Key OrganizationsTable
|
|
10
|
-
organization_id = Column(
|
|
20
|
+
organization_id = Column(
|
|
21
|
+
Integer,
|
|
22
|
+
ForeignKey(
|
|
23
|
+
"organizations.id",
|
|
24
|
+
ondelete="CASCADE",
|
|
25
|
+
onupdate="CASCADE"
|
|
26
|
+
),
|
|
27
|
+
nullable=False
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
class UserOrganizationsTable(
|
|
31
|
+
UserOrganizationsMixin,
|
|
32
|
+
DataTable,
|
|
33
|
+
MaleoIdentityMetadataManager.Base
|
|
34
|
+
):
|
|
35
|
+
__tablename__ = "user_organizations"
|
|
36
|
+
|
|
37
|
+
user = relationship(
|
|
38
|
+
"UsersTable",
|
|
39
|
+
back_populates="user_organization",
|
|
40
|
+
cascade="all",
|
|
41
|
+
lazy="select",
|
|
42
|
+
uselist=False
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
organization = relationship(
|
|
46
|
+
"OrganizationsTable",
|
|
47
|
+
back_populates="user_organization",
|
|
48
|
+
cascade="all",
|
|
49
|
+
lazy="select",
|
|
50
|
+
uselist=False
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
user_organization_roles = relationship(
|
|
54
|
+
"UserOrganizationRolesTable",
|
|
55
|
+
back_populates="user_organization",
|
|
56
|
+
cascade="all, delete-orphan",
|
|
57
|
+
lazy="select"
|
|
58
|
+
)
|