maleo-identity 0.1.20__tar.gz → 0.1.37__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/PKG-INFO +1 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/maleo_identity.egg-info/PKG-INFO +1 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/pyproject.toml +1 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/user_profile.py +15 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/organization_relation.py +13 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/user_profile.py +14 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/user_system_role.py +13 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/api_key.py +5 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/organization_registration_code.py +37 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/organization_relation.py +12 -4
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/user_medical_role.py +5 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/user_organization_role.py +5 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/user_profile.py +20 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/user_system_role.py +13 -5
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/api_key.py +3 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/common.py +20 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/organization_registration_code.py +2 -1
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/organization_relation.py +75 -15
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/patient.py +23 -3
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/user_medical_role.py +5 -5
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/user_organization_role.py +5 -5
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/user_profile.py +38 -15
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/user_system_role.py +36 -11
- maleo_identity-0.1.37/src/types/api_key.py +7 -0
- maleo_identity-0.1.37/src/types/organization_relation.py +7 -0
- maleo_identity-0.1.37/src/types/user_medical_role.py +7 -0
- maleo_identity-0.1.37/src/types/user_organization_role.py +7 -0
- maleo_identity-0.1.37/src/types/user_system_role.py +8 -0
- maleo_identity-0.1.20/src/types/api_key.py +0 -7
- maleo_identity-0.1.20/src/types/organization_relation.py +0 -7
- maleo_identity-0.1.20/src/types/user_medical_role.py +0 -7
- maleo_identity-0.1.20/src/types/user_organization_role.py +0 -7
- maleo_identity-0.1.20/src/types/user_system_role.py +0 -7
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/LICENSE +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/README.md +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/maleo_identity.egg-info/SOURCES.txt +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/maleo_identity.egg-info/dependency_links.txt +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/maleo_identity.egg-info/requires.txt +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/maleo_identity.egg-info/top_level.txt +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/setup.cfg +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/api_key.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/organization_registration_code.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/organization_relation.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/patient.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/user.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/user_medical_role.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/user_organization_role.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/constants/user_system_role.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/api_key.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/organization_registration_code.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/patient.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/user.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/user_medical_role.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/enums/user_organization_role.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/common.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/patient.py +6 -6
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/user.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/user.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/organization_registration_code.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/patient.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/user.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/types/user_profile.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/utils/__init__.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/utils/organization.py +0 -0
- {maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/utils/user.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from maleo.schemas.resource import Resource, ResourceIdentifier
|
|
2
|
+
from maleo.types.string import SeqOfStrs
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
USER_PROFILE_RESOURCE = Resource(
|
|
@@ -9,3 +10,17 @@ USER_PROFILE_RESOURCE = Resource(
|
|
|
9
10
|
],
|
|
10
11
|
details=None,
|
|
11
12
|
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
VALID_EXTENSIONS: SeqOfStrs = (
|
|
16
|
+
".jpeg",
|
|
17
|
+
".jpg",
|
|
18
|
+
".png",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
VALID_MIME_TYPES: SeqOfStrs = (
|
|
23
|
+
"image/jpeg",
|
|
24
|
+
"image/jpg",
|
|
25
|
+
"image/png",
|
|
26
|
+
)
|
|
@@ -20,3 +20,16 @@ class IdentifierType(StrEnum):
|
|
|
20
20
|
elif self is IdentifierType.COMPOSITE:
|
|
21
21
|
return ("source_id", "target_id", "relation")
|
|
22
22
|
raise ValueError(f"Unknown column(s) for identifier type: {self}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ExpandableField(StrEnum):
|
|
26
|
+
ORGANIZATION_TYPE = "organization_type"
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def choices(cls) -> ListOfStrs:
|
|
30
|
+
return [e.value for e in cls]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
OptExpandableField = ExpandableField | None
|
|
34
|
+
ListOfExpandableFields = list[ExpandableField]
|
|
35
|
+
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -15,3 +15,17 @@ class IdentifierType(StrEnum):
|
|
|
15
15
|
@property
|
|
16
16
|
def column(self) -> str:
|
|
17
17
|
return self.value
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ExpandableField(StrEnum):
|
|
21
|
+
GENDER = "gender"
|
|
22
|
+
BLOOD_TYPE = "blood_type"
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def choices(cls) -> ListOfStrs:
|
|
26
|
+
return [e.value for e in cls]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
OptExpandableField = ExpandableField | None
|
|
30
|
+
ListOfExpandableFields = list[ExpandableField]
|
|
31
|
+
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -20,3 +20,16 @@ class IdentifierType(StrEnum):
|
|
|
20
20
|
elif self is IdentifierType.COMPOSITE:
|
|
21
21
|
return ("user_id", "system_role")
|
|
22
22
|
raise ValueError(f"Unknown column(s) for identifier type: {self}")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ExpandableField(StrEnum):
|
|
26
|
+
SYSTEM_ROLE = "system_role"
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def choices(cls) -> ListOfStrs:
|
|
30
|
+
return [e.value for e in cls]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
OptExpandableField = ExpandableField | None
|
|
34
|
+
ListOfExpandableFields = list[ExpandableField]
|
|
35
|
+
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -5,7 +5,7 @@ from maleo.schemas.mixins.identity import Identifier
|
|
|
5
5
|
from maleo.types.any import ManyAny
|
|
6
6
|
from maleo.types.string import ManyStrs
|
|
7
7
|
from ..enums.api_key import IdentifierType
|
|
8
|
-
from ..types.api_key import
|
|
8
|
+
from ..types.api_key import CompositeIdentifierType, IdentifierValueType
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class APIKey(BaseModel):
|
|
@@ -35,13 +35,15 @@ class UUIDAPIKeyIdentifier(Identifier[Literal[IdentifierType.UUID], UUID]):
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class CompositeAPIKeyIdentifier(
|
|
38
|
-
Identifier[Literal[IdentifierType.COMPOSITE],
|
|
38
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
39
39
|
):
|
|
40
40
|
type: Annotated[
|
|
41
41
|
Literal[IdentifierType.COMPOSITE],
|
|
42
42
|
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
43
43
|
] = IdentifierType.COMPOSITE
|
|
44
|
-
value: Annotated[
|
|
44
|
+
value: Annotated[
|
|
45
|
+
CompositeIdentifierType, Field(..., description="Identifier's value")
|
|
46
|
+
]
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
AnyAPIKeyIdentifier = (
|
{maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/mixins/organization_registration_code.py
RENAMED
|
@@ -1,15 +1,49 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Annotated, Generic, Literal, TypeGuard
|
|
1
|
+
from pydantic import BaseModel, Field, model_validator
|
|
2
|
+
from typing import Annotated, Generic, Literal, Self, TypeGuard
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
from maleo.schemas.mixins.identity import Identifier
|
|
5
5
|
from maleo.types.integer import OptIntT
|
|
6
|
+
from maleo.types.misc import OptIntOrStr
|
|
6
7
|
from maleo.types.string import OptStrT
|
|
7
8
|
from ..enums.organization_registration_code import IdentifierType
|
|
8
9
|
from ..types.organization_registration_code import IdentifierValueType
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
class CodeOrLength(BaseModel):
|
|
13
|
+
code_or_length: Annotated[
|
|
14
|
+
OptIntOrStr,
|
|
15
|
+
Field(
|
|
16
|
+
None,
|
|
17
|
+
description=(
|
|
18
|
+
"Code (str) or length (int). "
|
|
19
|
+
"If code is given, the length must be between 6 and 36 inclusive. "
|
|
20
|
+
"If length is given, the value must be between 6 and 36 inclusive. "
|
|
21
|
+
"Will generate random 6 char string if omitted"
|
|
22
|
+
),
|
|
23
|
+
),
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
@model_validator(mode="after")
|
|
27
|
+
def validate_code_or_length(self) -> Self:
|
|
28
|
+
code_or_length = self.code_or_length
|
|
29
|
+
if code_or_length is None:
|
|
30
|
+
return self
|
|
31
|
+
print(code_or_length)
|
|
32
|
+
if isinstance(code_or_length, int):
|
|
33
|
+
length = code_or_length
|
|
34
|
+
elif isinstance(code_or_length, str):
|
|
35
|
+
length = len(code_or_length)
|
|
36
|
+
else:
|
|
37
|
+
raise ValueError("Code or Length must be either int or str")
|
|
38
|
+
if length < 6 or length > 36:
|
|
39
|
+
raise ValueError("Code or Length must be between 6 and 36 inclusive")
|
|
40
|
+
return self
|
|
41
|
+
|
|
42
|
+
|
|
11
43
|
class Code(BaseModel, Generic[OptStrT]):
|
|
12
|
-
code: Annotated[
|
|
44
|
+
code: Annotated[
|
|
45
|
+
OptStrT, Field(..., description="Code", min_length=6, max_length=36)
|
|
46
|
+
]
|
|
13
47
|
|
|
14
48
|
|
|
15
49
|
class MaxUses(BaseModel, Generic[OptIntT]):
|
|
@@ -6,8 +6,8 @@ from maleo.types.any import ManyAny
|
|
|
6
6
|
from maleo.types.boolean import OptBoolT
|
|
7
7
|
from maleo.types.misc import OptListOfAnyOrStrToAnyDict
|
|
8
8
|
from maleo.types.string import ManyStrs
|
|
9
|
-
from ..enums.organization_relation import IdentifierType
|
|
10
|
-
from ..types.organization_relation import
|
|
9
|
+
from ..enums.organization_relation import IdentifierType, OptListOfExpandableFields
|
|
10
|
+
from ..types.organization_relation import CompositeIdentifierType, IdentifierValueType
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class IsBidirectional(BaseModel, Generic[OptBoolT]):
|
|
@@ -18,6 +18,12 @@ class Meta(BaseModel):
|
|
|
18
18
|
meta: Annotated[OptListOfAnyOrStrToAnyDict, Field(None, description="Meta")] = None
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
class Expand(BaseModel):
|
|
22
|
+
expand: Annotated[
|
|
23
|
+
OptListOfExpandableFields, Field(None, description="Expanded field(s)")
|
|
24
|
+
] = None
|
|
25
|
+
|
|
26
|
+
|
|
21
27
|
class OrganizationRelationIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
22
28
|
@property
|
|
23
29
|
def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
|
|
@@ -43,13 +49,15 @@ class UUIDOrganizationRelationIdentifier(
|
|
|
43
49
|
|
|
44
50
|
|
|
45
51
|
class CompositeOrganizationRelationIdentifier(
|
|
46
|
-
Identifier[Literal[IdentifierType.COMPOSITE],
|
|
52
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
47
53
|
):
|
|
48
54
|
type: Annotated[
|
|
49
55
|
Literal[IdentifierType.COMPOSITE],
|
|
50
56
|
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
51
57
|
] = IdentifierType.COMPOSITE
|
|
52
|
-
value: Annotated[
|
|
58
|
+
value: Annotated[
|
|
59
|
+
CompositeIdentifierType, Field(..., description="Identifier's value")
|
|
60
|
+
]
|
|
53
61
|
|
|
54
62
|
|
|
55
63
|
AnyOrganizationRelationIdentifier = (
|
|
@@ -5,7 +5,7 @@ from maleo.schemas.mixins.identity import Identifier
|
|
|
5
5
|
from maleo.types.any import ManyAny
|
|
6
6
|
from maleo.types.string import ManyStrs
|
|
7
7
|
from ..enums.user_medical_role import IdentifierType
|
|
8
|
-
from ..types.user_medical_role import
|
|
8
|
+
from ..types.user_medical_role import CompositeIdentifierType, IdentifierValueType
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class UserMedicalRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
@@ -31,13 +31,15 @@ class UUIDUserMedicalRoleIdentifier(Identifier[Literal[IdentifierType.UUID], UUI
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class CompositeUserMedicalRoleIdentifier(
|
|
34
|
-
Identifier[Literal[IdentifierType.COMPOSITE],
|
|
34
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
35
35
|
):
|
|
36
36
|
type: Annotated[
|
|
37
37
|
Literal[IdentifierType.COMPOSITE],
|
|
38
38
|
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
39
39
|
] = IdentifierType.COMPOSITE
|
|
40
|
-
value: Annotated[
|
|
40
|
+
value: Annotated[
|
|
41
|
+
CompositeIdentifierType, Field(..., description="Identifier's value")
|
|
42
|
+
]
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
AnyUserMedicalRoleIdentifier = (
|
|
@@ -5,7 +5,7 @@ from maleo.schemas.mixins.identity import Identifier
|
|
|
5
5
|
from maleo.types.any import ManyAny
|
|
6
6
|
from maleo.types.string import ManyStrs
|
|
7
7
|
from ..enums.user_organization_role import IdentifierType
|
|
8
|
-
from ..types.user_organization_role import
|
|
8
|
+
from ..types.user_organization_role import CompositeIdentifierType, IdentifierValueType
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class UserOrganizationRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
@@ -33,13 +33,15 @@ class UUIDUserOrganizationRoleIdentifier(
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class CompositeUserOrganizationRoleIdentifier(
|
|
36
|
-
Identifier[Literal[IdentifierType.COMPOSITE],
|
|
36
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
37
37
|
):
|
|
38
38
|
type: Annotated[
|
|
39
39
|
Literal[IdentifierType.COMPOSITE],
|
|
40
40
|
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
41
41
|
] = IdentifierType.COMPOSITE
|
|
42
|
-
value: Annotated[
|
|
42
|
+
value: Annotated[
|
|
43
|
+
CompositeIdentifierType, Field(..., description="Identifier's value")
|
|
44
|
+
]
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
AnyUserOrganizationRoleIdentifier = (
|
|
@@ -3,7 +3,7 @@ from typing import Annotated, Generic, Literal, TypeGuard
|
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
from maleo.schemas.mixins.identity import Identifier
|
|
5
5
|
from maleo.types.string import OptStrT
|
|
6
|
-
from ..enums.user_profile import IdentifierType
|
|
6
|
+
from ..enums.user_profile import IdentifierType, OptListOfExpandableFields
|
|
7
7
|
from ..types.user_profile import IdentifierValueType
|
|
8
8
|
|
|
9
9
|
|
|
@@ -37,6 +37,19 @@ class EndingTitle(BaseModel, Generic[OptStrT]):
|
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
class Avatar(BaseModel):
|
|
41
|
+
content: Annotated[bytes, Field(..., description="Avatar's content")]
|
|
42
|
+
content_type: Annotated[str, Field(..., description="Avatar's content type")]
|
|
43
|
+
filename: Annotated[str, Field(..., description="Avatar's filename")]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
OptAvatar = Avatar | None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AvatarMixin(BaseModel):
|
|
50
|
+
avatar: Annotated[OptAvatar, Field(None, description="Avatar")]
|
|
51
|
+
|
|
52
|
+
|
|
40
53
|
class AvatarName(BaseModel, Generic[OptStrT]):
|
|
41
54
|
avatar_name: Annotated[OptStrT, Field(..., description="User's Avatar Name")]
|
|
42
55
|
|
|
@@ -45,6 +58,12 @@ class AvatarUrl(BaseModel, Generic[OptStrT]):
|
|
|
45
58
|
avatar_url: Annotated[OptStrT, Field(..., description="User's Avatar URL")]
|
|
46
59
|
|
|
47
60
|
|
|
61
|
+
class Expand(BaseModel):
|
|
62
|
+
expand: Annotated[
|
|
63
|
+
OptListOfExpandableFields, Field(None, description="Expanded field(s)")
|
|
64
|
+
] = None
|
|
65
|
+
|
|
66
|
+
|
|
48
67
|
class UserProfileIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
49
68
|
@property
|
|
50
69
|
def column_and_value(self) -> tuple[str, IdentifierValueType]:
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
from pydantic import Field
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
2
|
from typing import Annotated, Literal, TypeGuard
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
from maleo.schemas.mixins.identity import Identifier
|
|
5
5
|
from maleo.types.any import ManyAny
|
|
6
6
|
from maleo.types.string import ManyStrs
|
|
7
|
-
from ..enums.user_system_role import IdentifierType
|
|
8
|
-
from ..types.user_system_role import
|
|
7
|
+
from ..enums.user_system_role import IdentifierType, OptListOfExpandableFields
|
|
8
|
+
from ..types.user_system_role import CompositeIdentifierType, IdentifierValueType
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Expand(BaseModel):
|
|
12
|
+
expand: Annotated[
|
|
13
|
+
OptListOfExpandableFields, Field(None, description="Expanded field(s)")
|
|
14
|
+
] = None
|
|
9
15
|
|
|
10
16
|
|
|
11
17
|
class UserSystemRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
|
|
@@ -31,13 +37,15 @@ class UUIDUserSystemRoleIdentifier(Identifier[Literal[IdentifierType.UUID], UUID
|
|
|
31
37
|
|
|
32
38
|
|
|
33
39
|
class CompositeUserSystemRoleIdentifier(
|
|
34
|
-
Identifier[Literal[IdentifierType.COMPOSITE],
|
|
40
|
+
Identifier[Literal[IdentifierType.COMPOSITE], CompositeIdentifierType]
|
|
35
41
|
):
|
|
36
42
|
type: Annotated[
|
|
37
43
|
Literal[IdentifierType.COMPOSITE],
|
|
38
44
|
Field(IdentifierType.COMPOSITE, description="Identifier's type"),
|
|
39
45
|
] = IdentifierType.COMPOSITE
|
|
40
|
-
value: Annotated[
|
|
46
|
+
value: Annotated[
|
|
47
|
+
CompositeIdentifierType, Field(..., description="Identifier's value")
|
|
48
|
+
]
|
|
41
49
|
|
|
42
50
|
|
|
43
51
|
AnyUserSystemRoleIdentifier = (
|
|
@@ -25,7 +25,7 @@ from maleo.types.integer import OptInt, OptListOfInts
|
|
|
25
25
|
from maleo.types.uuid import OptListOfUUIDs
|
|
26
26
|
from ..enums.api_key import IdentifierType
|
|
27
27
|
from ..mixins.api_key import APIKeyIdentifier
|
|
28
|
-
from ..types.api_key import
|
|
28
|
+
from ..types.api_key import CompositeIdentifierType, IdentifierValueType
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class CreateParameter(
|
|
@@ -106,7 +106,7 @@ class ReadSingleParameter(BaseReadSingleParameter[APIKeyIdentifier]):
|
|
|
106
106
|
def new(
|
|
107
107
|
cls,
|
|
108
108
|
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
109
|
-
identifier_value:
|
|
109
|
+
identifier_value: CompositeIdentifierType,
|
|
110
110
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
111
111
|
use_cache: bool = True,
|
|
112
112
|
) -> "ReadSingleParameter": ...
|
|
@@ -155,7 +155,7 @@ class DeleteSingleParameter(BaseDeleteSingleParameter[APIKeyIdentifier]):
|
|
|
155
155
|
def new(
|
|
156
156
|
cls,
|
|
157
157
|
identifier_type: Literal[IdentifierType.COMPOSITE],
|
|
158
|
-
identifier_value:
|
|
158
|
+
identifier_value: CompositeIdentifierType,
|
|
159
159
|
) -> "DeleteSingleParameter": ...
|
|
160
160
|
@overload
|
|
161
161
|
@classmethod
|
|
@@ -2,6 +2,10 @@ from datetime import date
|
|
|
2
2
|
from pydantic import BaseModel, Field
|
|
3
3
|
from typing import Annotated, Generic, TypeVar, Type
|
|
4
4
|
from maleo.enums.identity import OptRhesus, RhesusMixin
|
|
5
|
+
from maleo.enums.organization import (
|
|
6
|
+
OrganizationRelation,
|
|
7
|
+
SimpleOrganizationRelationMixin,
|
|
8
|
+
)
|
|
5
9
|
from maleo.enums.status import DataStatus as DataStatusEnum, SimpleDataStatusMixin
|
|
6
10
|
from maleo.metadata.schemas.blood_type import (
|
|
7
11
|
OptKeyOrStandardSchema as BloodTypeOptKeyOrStandardSchema,
|
|
@@ -130,6 +134,7 @@ class SourceOrganizationSchemaMixin(BaseModel):
|
|
|
130
134
|
class SourceOrganizationRelationSchema(
|
|
131
135
|
Meta,
|
|
132
136
|
IsBidirectional[bool],
|
|
137
|
+
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
133
138
|
SourceOrganizationSchemaMixin,
|
|
134
139
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
135
140
|
LifecycleTimestamp,
|
|
@@ -154,6 +159,7 @@ class TargetOrganizationSchemaMixin(BaseModel):
|
|
|
154
159
|
class TargetOrganizationRelationSchema(
|
|
155
160
|
Meta,
|
|
156
161
|
IsBidirectional[bool],
|
|
162
|
+
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
157
163
|
TargetOrganizationSchemaMixin,
|
|
158
164
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
159
165
|
LifecycleTimestamp,
|
|
@@ -191,6 +197,19 @@ class OrganizationSchemaMixin(BaseModel, Generic[AnyOrganizationSchemaT]):
|
|
|
191
197
|
]
|
|
192
198
|
|
|
193
199
|
|
|
200
|
+
class OrganizationRelationSchema(
|
|
201
|
+
Meta,
|
|
202
|
+
IsBidirectional[bool],
|
|
203
|
+
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
204
|
+
TargetOrganizationSchemaMixin,
|
|
205
|
+
SourceOrganizationSchemaMixin,
|
|
206
|
+
SimpleDataStatusMixin[DataStatusEnum],
|
|
207
|
+
LifecycleTimestamp,
|
|
208
|
+
DataIdentifier,
|
|
209
|
+
):
|
|
210
|
+
pass
|
|
211
|
+
|
|
212
|
+
|
|
194
213
|
class UserMedicalRoleSchema(
|
|
195
214
|
FullMedicalRoleMixin[MedicalRoleKeyOrStandardSchema],
|
|
196
215
|
IntOrganizationId[int],
|
|
@@ -246,7 +265,7 @@ class UserProfileSchema(
|
|
|
246
265
|
LifecycleTimestamp,
|
|
247
266
|
DataIdentifier,
|
|
248
267
|
):
|
|
249
|
-
|
|
268
|
+
avatar_url: Annotated[OptStr, Field(None, description="Avatar URL")]
|
|
250
269
|
|
|
251
270
|
|
|
252
271
|
OptUserProfileSchema = UserProfileSchema | None
|
{maleo_identity-0.1.20 → maleo_identity-0.1.37}/src/schemas/organization_registration_code.py
RENAMED
|
@@ -28,6 +28,7 @@ from maleo.types.string import OptStr, OptListOfStrs
|
|
|
28
28
|
from maleo.types.uuid import OptListOfUUIDs
|
|
29
29
|
from ..enums.organization_registration_code import IdentifierType
|
|
30
30
|
from ..mixins.organization_registration_code import (
|
|
31
|
+
CodeOrLength,
|
|
31
32
|
Code,
|
|
32
33
|
MaxUses,
|
|
33
34
|
OrganizationRegistrationCodeIdentifier,
|
|
@@ -35,7 +36,7 @@ from ..mixins.organization_registration_code import (
|
|
|
35
36
|
from ..types.organization_registration_code import IdentifierValueType
|
|
36
37
|
|
|
37
38
|
|
|
38
|
-
class StandardCreateData(
|
|
39
|
+
class StandardCreateData(CodeOrLength):
|
|
39
40
|
pass
|
|
40
41
|
|
|
41
42
|
|