maleo-identity 0.1.2__tar.gz → 0.1.4__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.
Potentially problematic release.
This version of maleo-identity might be problematic. Click here for more details.
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/PKG-INFO +1 -1
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/maleo_identity.egg-info/PKG-INFO +1 -1
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/maleo_identity.egg-info/SOURCES.txt +1 -4
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/pyproject.toml +2 -5
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/organization.py +0 -8
- maleo_identity-0.1.4/src/enums/patient.py +13 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/user.py +0 -13
- maleo_identity-0.1.4/src/enums/user_profile.py +13 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/organization_relation.py +2 -4
- maleo_identity-0.1.4/src/mixins/patient.py +20 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/common.py +50 -66
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/organization.py +4 -29
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/organization_relation.py +4 -4
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/patient.py +10 -39
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/user.py +3 -14
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/user_profile.py +4 -20
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/utils/organization.py +0 -30
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/utils/user.py +0 -30
- maleo_identity-0.1.2/src/dtos.py +0 -309
- maleo_identity-0.1.2/src/enums/patient.py +0 -22
- maleo_identity-0.1.2/src/enums/user_profile.py +0 -22
- maleo_identity-0.1.2/src/mixins/patient.py +0 -8
- maleo_identity-0.1.2/src/validators/__init__.py +0 -0
- maleo_identity-0.1.2/src/validators/patient.py +0 -6
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/LICENSE +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/README.md +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/maleo_identity.egg-info/dependency_links.txt +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/maleo_identity.egg-info/requires.txt +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/maleo_identity.egg-info/top_level.txt +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/setup.cfg +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/api_key.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/organization.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/organization_registration_code.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/organization_relation.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/patient.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/user.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/user_medical_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/user_organization_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/user_profile.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/constants/user_system_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/api_key.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/organization_registration_code.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/organization_relation.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/user_medical_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/user_organization_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/enums/user_system_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/api_key.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/common.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/organization.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/organization_registration_code.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/user.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/mixins/user_profile.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/models.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/api_key.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/organization_registration_code.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/user_medical_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/user_organization_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/schemas/user_system_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/__init__.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/api_key.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/organization.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/organization_registration_code.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/organization_relation.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/patient.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/user.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/user_medical_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/user_organization_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/user_profile.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/types/user_system_role.py +0 -0
- {maleo_identity-0.1.2 → maleo_identity-0.1.4}/src/utils/__init__.py +0 -0
|
@@ -7,7 +7,6 @@ maleo_identity.egg-info/dependency_links.txt
|
|
|
7
7
|
maleo_identity.egg-info/requires.txt
|
|
8
8
|
maleo_identity.egg-info/top_level.txt
|
|
9
9
|
src/__init__.py
|
|
10
|
-
src/dtos.py
|
|
11
10
|
src/models.py
|
|
12
11
|
src/constants/__init__.py
|
|
13
12
|
src/constants/api_key.py
|
|
@@ -65,6 +64,4 @@ src/types/user_profile.py
|
|
|
65
64
|
src/types/user_system_role.py
|
|
66
65
|
src/utils/__init__.py
|
|
67
66
|
src/utils/organization.py
|
|
68
|
-
src/utils/user.py
|
|
69
|
-
src/validators/__init__.py
|
|
70
|
-
src/validators/patient.py
|
|
67
|
+
src/utils/user.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "maleo-identity"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.4"
|
|
8
8
|
description = "MaleoIdentity service package"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
|
|
@@ -103,7 +103,6 @@ packages = [
|
|
|
103
103
|
"maleo.identity.schemas",
|
|
104
104
|
"maleo.identity.types",
|
|
105
105
|
"maleo.identity.utils",
|
|
106
|
-
"maleo.identity.validators",
|
|
107
106
|
]
|
|
108
107
|
|
|
109
108
|
[tool.setuptools.package-data]
|
|
@@ -114,7 +113,6 @@ packages = [
|
|
|
114
113
|
"maleo.identity.schemas" = ["*.json", "*.yaml"]
|
|
115
114
|
"maleo.identity.types" = ["*.json", "*.yaml"]
|
|
116
115
|
"maleo.identity.utils" = ["*.json", "*.yaml"]
|
|
117
|
-
"maleo.identity.validators" = ["*.json", "*.yaml"]
|
|
118
116
|
|
|
119
117
|
[tool.setuptools.package-dir]
|
|
120
118
|
"maleo.identity" = "src"
|
|
@@ -123,5 +121,4 @@ packages = [
|
|
|
123
121
|
"maleo.identity.mixins" = "src/mixins"
|
|
124
122
|
"maleo.identity.schemas" = "src/schemas"
|
|
125
123
|
"maleo.identity.types" = "src/types"
|
|
126
|
-
"maleo.identity.utils" = "src/utils"
|
|
127
|
-
"maleo.identity.validators" = "src/validators"
|
|
124
|
+
"maleo.identity.utils" = "src/utils"
|
|
@@ -19,11 +19,3 @@ class IdentifierType(StrEnum):
|
|
|
19
19
|
@classmethod
|
|
20
20
|
def choices(cls) -> ListOfStrs:
|
|
21
21
|
return [e.value for e in cls]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class ExpandableField(StrEnum):
|
|
25
|
-
ORGANIZATION_TYPE = "organization_type"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ListOfExpandableFields = list[ExpandableField]
|
|
29
|
-
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
from maleo.types.string import ListOfStrs
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IdentifierType(StrEnum):
|
|
6
|
+
ID = "id"
|
|
7
|
+
UUID = "uuid"
|
|
8
|
+
ID_CARD = "id_card"
|
|
9
|
+
PASSPORT = "passport"
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def choices(cls) -> ListOfStrs:
|
|
13
|
+
return [e.value for e in cls]
|
|
@@ -20,16 +20,3 @@ class IdentifierType(StrEnum):
|
|
|
20
20
|
@classmethod
|
|
21
21
|
def choices(cls) -> ListOfStrs:
|
|
22
22
|
return [e.value for e in cls]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ExpandableField(StrEnum):
|
|
26
|
-
USER_TYPE = "user_type"
|
|
27
|
-
GENDER = "gender"
|
|
28
|
-
BLOOD_TYPE = "blood_type"
|
|
29
|
-
SYSTEM_ROLE = "system_role"
|
|
30
|
-
MEDICAL_ROLE = "medical_role"
|
|
31
|
-
ORGANIZATION_ROLE = "organization_role"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ListOfExpandableFields = list[ExpandableField]
|
|
35
|
-
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
from maleo.types.string import ListOfStrs
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IdentifierType(StrEnum):
|
|
6
|
+
ID = "id"
|
|
7
|
+
UUID = "uuid"
|
|
8
|
+
USER_ID = "user_id"
|
|
9
|
+
ID_CARD = "id_card"
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def choices(cls) -> ListOfStrs:
|
|
13
|
+
return [e.value for e in cls]
|
|
@@ -8,7 +8,5 @@ class IsBidirectional(BaseModel, Generic[OptBoolT]):
|
|
|
8
8
|
is_bidirectional: Annotated[OptBoolT, Field(..., description="Is Bidirectional")]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
OptListOfAnyOrStrToAnyDict, Field(None, description="Metadata")
|
|
14
|
-
] = None
|
|
11
|
+
class Meta(BaseModel):
|
|
12
|
+
meta: Annotated[OptListOfAnyOrStrToAnyDict, Field(None, description="Meta")] = None
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from pydantic import Field, model_validator
|
|
2
|
+
from typing import Annotated, Generic, Self
|
|
3
|
+
from maleo.schemas.mixins.identity import Passport as BasePassport
|
|
4
|
+
from maleo.types.string import OptStr, OptStrT
|
|
5
|
+
from .common import IdCard
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Passport(BasePassport, Generic[OptStrT]):
|
|
9
|
+
passport: Annotated[OptStrT, Field(..., description="Passport", max_length=9)]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PatientIdentifier(
|
|
13
|
+
Passport[OptStr],
|
|
14
|
+
IdCard[OptStr],
|
|
15
|
+
):
|
|
16
|
+
@model_validator(mode="after")
|
|
17
|
+
def chk_id_card_or_passport(self) -> Self:
|
|
18
|
+
if self.id_card is None and self.passport is None:
|
|
19
|
+
raise ValueError("Either ID Card or Passport must exist")
|
|
20
|
+
return self
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
from datetime import date
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from typing import Annotated, Generic,
|
|
4
|
-
from maleo.enums.identity import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
OptKeyOrStandardSchema as OptKeyOrStandardBloodTypeSchema,
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Annotated, Generic, TypeVar, Type
|
|
4
|
+
from maleo.enums.identity import (
|
|
5
|
+
OptBloodType,
|
|
6
|
+
BloodTypeMixin,
|
|
7
|
+
OptRhesus,
|
|
8
|
+
RhesusMixin,
|
|
9
|
+
Gender,
|
|
10
|
+
OptGender,
|
|
11
|
+
GenderMixin,
|
|
13
12
|
)
|
|
14
|
-
from maleo.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
from maleo.metadata.schemas.medical_role import (
|
|
20
|
-
FullMedicalRoleMixin,
|
|
21
|
-
KeyOrStandardSchema as KeyOrStandardMedicalRoleSchema,
|
|
22
|
-
)
|
|
23
|
-
from maleo.metadata.schemas.organization_type import (
|
|
13
|
+
from maleo.enums.medical import MedicalRole, FullMedicalRoleMixin
|
|
14
|
+
from maleo.enums.organization import (
|
|
15
|
+
OrganizationRole,
|
|
16
|
+
FullOrganizationRoleMixin,
|
|
17
|
+
OrganizationType,
|
|
24
18
|
FullOrganizationTypeMixin,
|
|
25
|
-
KeyOrStandardSchema as KeyOrStandardOrganizationTypeSchema,
|
|
26
|
-
)
|
|
27
|
-
from maleo.metadata.schemas.system_role import (
|
|
28
|
-
FullSystemRoleMixin,
|
|
29
|
-
KeyOrStandardSchema as KeyOrStandardSystemRoleSchema,
|
|
30
|
-
)
|
|
31
|
-
from maleo.metadata.schemas.user_type import (
|
|
32
|
-
FullUserTypeMixin,
|
|
33
|
-
KeyOrStandardSchema as KeyOrStandardUserTypeSchema,
|
|
34
19
|
)
|
|
20
|
+
from maleo.enums.status import DataStatus as DataStatusEnum, SimpleDataStatusMixin
|
|
21
|
+
from maleo.enums.system import SystemRole, FullSystemRoleMixin
|
|
22
|
+
from maleo.enums.user import UserType, FullUserTypeMixin
|
|
35
23
|
from maleo.schemas.mixins.identity import (
|
|
36
24
|
DataIdentifier,
|
|
37
25
|
IntOrganizationId,
|
|
@@ -39,26 +27,26 @@ from maleo.schemas.mixins.identity import (
|
|
|
39
27
|
BirthDate,
|
|
40
28
|
DateOfBirth,
|
|
41
29
|
)
|
|
42
|
-
from maleo.schemas.mixins.timestamp import
|
|
30
|
+
from maleo.schemas.mixins.timestamp import LifecycleTimestamp
|
|
43
31
|
from maleo.types.datetime import OptDate
|
|
44
32
|
from maleo.types.integer import OptInt
|
|
45
33
|
from maleo.types.string import OptStr
|
|
46
34
|
from ..mixins.common import IdCard, FullName, BirthPlace, PlaceOfBirth
|
|
47
35
|
from ..mixins.api_key import APIKey
|
|
48
36
|
from ..mixins.organization_registration_code import Code, MaxUses, CurrentUses
|
|
49
|
-
from ..mixins.organization_relation import IsBidirectional,
|
|
37
|
+
from ..mixins.organization_relation import IsBidirectional, Meta
|
|
50
38
|
from ..mixins.organization import Key as OrganizationKey, Name as OrganizationName
|
|
51
|
-
from ..mixins.patient import
|
|
39
|
+
from ..mixins.patient import PatientIdentifier
|
|
52
40
|
from ..mixins.user_profile import (
|
|
53
41
|
LeadingTitle,
|
|
54
42
|
FirstName,
|
|
55
43
|
MiddleName,
|
|
56
44
|
LastName,
|
|
57
45
|
EndingTitle,
|
|
46
|
+
AvatarName,
|
|
58
47
|
AvatarUrl,
|
|
59
48
|
)
|
|
60
49
|
from ..mixins.user import Username, Email, Phone
|
|
61
|
-
from ..validators.patient import validate_id_card_or_passport
|
|
62
50
|
|
|
63
51
|
|
|
64
52
|
class APIKeySchema(
|
|
@@ -66,7 +54,7 @@ class APIKeySchema(
|
|
|
66
54
|
IntOrganizationId[OptInt],
|
|
67
55
|
IntUserId[int],
|
|
68
56
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
69
|
-
|
|
57
|
+
LifecycleTimestamp,
|
|
70
58
|
DataIdentifier,
|
|
71
59
|
):
|
|
72
60
|
pass
|
|
@@ -74,22 +62,17 @@ class APIKeySchema(
|
|
|
74
62
|
|
|
75
63
|
class PatientSchema(
|
|
76
64
|
RhesusMixin[OptRhesus],
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
BloodTypeMixin[OptBloodType],
|
|
66
|
+
GenderMixin[Gender],
|
|
79
67
|
DateOfBirth[date],
|
|
80
68
|
PlaceOfBirth[OptStr],
|
|
81
69
|
FullName[str],
|
|
82
|
-
|
|
83
|
-
IdCard[OptStr],
|
|
84
|
-
IntOrganizationId[int],
|
|
70
|
+
PatientIdentifier,
|
|
85
71
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
86
|
-
|
|
72
|
+
LifecycleTimestamp,
|
|
87
73
|
DataIdentifier,
|
|
88
74
|
):
|
|
89
|
-
|
|
90
|
-
def chk_id_card_or_passport(self) -> Self:
|
|
91
|
-
validate_id_card_or_passport(self.id_card, self.passport)
|
|
92
|
-
return self
|
|
75
|
+
pass
|
|
93
76
|
|
|
94
77
|
|
|
95
78
|
class OrganizationRegistrationCodeSchema(
|
|
@@ -98,7 +81,7 @@ class OrganizationRegistrationCodeSchema(
|
|
|
98
81
|
Code[str],
|
|
99
82
|
IntOrganizationId[int],
|
|
100
83
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
101
|
-
|
|
84
|
+
LifecycleTimestamp,
|
|
102
85
|
DataIdentifier,
|
|
103
86
|
):
|
|
104
87
|
pass
|
|
@@ -117,9 +100,9 @@ class OrganizationRegistrationCodeSchemaMixin(BaseModel):
|
|
|
117
100
|
class StandardOrganizationSchema(
|
|
118
101
|
OrganizationName[str],
|
|
119
102
|
OrganizationKey[str],
|
|
120
|
-
FullOrganizationTypeMixin[
|
|
103
|
+
FullOrganizationTypeMixin[OrganizationType],
|
|
121
104
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
122
|
-
|
|
105
|
+
LifecycleTimestamp,
|
|
123
106
|
DataIdentifier,
|
|
124
107
|
):
|
|
125
108
|
pass
|
|
@@ -132,11 +115,11 @@ class SourceOrganizationSchemaMixin(BaseModel):
|
|
|
132
115
|
|
|
133
116
|
|
|
134
117
|
class SourceOrganizationRelationSchema(
|
|
135
|
-
|
|
118
|
+
Meta,
|
|
136
119
|
IsBidirectional[bool],
|
|
137
120
|
SourceOrganizationSchemaMixin,
|
|
138
121
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
139
|
-
|
|
122
|
+
LifecycleTimestamp,
|
|
140
123
|
DataIdentifier,
|
|
141
124
|
):
|
|
142
125
|
pass
|
|
@@ -156,11 +139,11 @@ class TargetOrganizationSchemaMixin(BaseModel):
|
|
|
156
139
|
|
|
157
140
|
|
|
158
141
|
class TargetOrganizationRelationSchema(
|
|
159
|
-
|
|
142
|
+
Meta,
|
|
160
143
|
IsBidirectional[bool],
|
|
161
144
|
TargetOrganizationSchemaMixin,
|
|
162
145
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
163
|
-
|
|
146
|
+
LifecycleTimestamp,
|
|
164
147
|
DataIdentifier,
|
|
165
148
|
):
|
|
166
149
|
pass
|
|
@@ -196,11 +179,11 @@ class OrganizationSchemaMixin(BaseModel, Generic[AnyOrganizationSchemaT]):
|
|
|
196
179
|
|
|
197
180
|
|
|
198
181
|
class UserMedicalRoleSchema(
|
|
199
|
-
FullMedicalRoleMixin[
|
|
182
|
+
FullMedicalRoleMixin[MedicalRole],
|
|
200
183
|
IntOrganizationId[int],
|
|
201
184
|
IntUserId[int],
|
|
202
185
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
203
|
-
|
|
186
|
+
LifecycleTimestamp,
|
|
204
187
|
DataIdentifier,
|
|
205
188
|
):
|
|
206
189
|
pass
|
|
@@ -214,11 +197,11 @@ class UserMedicalRolesSchemaMixin(BaseModel):
|
|
|
214
197
|
|
|
215
198
|
|
|
216
199
|
class UserOrganizationRoleSchema(
|
|
217
|
-
FullOrganizationRoleMixin[
|
|
200
|
+
FullOrganizationRoleMixin[OrganizationRole],
|
|
218
201
|
IntOrganizationId[int],
|
|
219
202
|
IntUserId[int],
|
|
220
203
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
221
|
-
|
|
204
|
+
LifecycleTimestamp,
|
|
222
205
|
DataIdentifier,
|
|
223
206
|
):
|
|
224
207
|
pass
|
|
@@ -232,9 +215,10 @@ class UserOrganizationRolesSchemaMixin(BaseModel):
|
|
|
232
215
|
|
|
233
216
|
|
|
234
217
|
class UserProfileSchema(
|
|
235
|
-
AvatarUrl[
|
|
236
|
-
|
|
237
|
-
|
|
218
|
+
AvatarUrl[OptStr],
|
|
219
|
+
AvatarName[str],
|
|
220
|
+
BloodTypeMixin[OptBloodType],
|
|
221
|
+
GenderMixin[OptGender],
|
|
238
222
|
BirthDate[OptDate],
|
|
239
223
|
BirthPlace[OptStr],
|
|
240
224
|
FullName[str],
|
|
@@ -246,7 +230,7 @@ class UserProfileSchema(
|
|
|
246
230
|
IdCard[OptStr],
|
|
247
231
|
IntUserId[int],
|
|
248
232
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
249
|
-
|
|
233
|
+
LifecycleTimestamp,
|
|
250
234
|
DataIdentifier,
|
|
251
235
|
):
|
|
252
236
|
pass
|
|
@@ -262,10 +246,10 @@ class UserProfileSchemaMixin(BaseModel):
|
|
|
262
246
|
|
|
263
247
|
|
|
264
248
|
class UserSystemRoleSchema(
|
|
265
|
-
FullSystemRoleMixin[
|
|
249
|
+
FullSystemRoleMixin[SystemRole],
|
|
266
250
|
IntUserId[int],
|
|
267
251
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
268
|
-
|
|
252
|
+
LifecycleTimestamp,
|
|
269
253
|
DataIdentifier,
|
|
270
254
|
):
|
|
271
255
|
pass
|
|
@@ -287,9 +271,9 @@ class StandardUserSchema(
|
|
|
287
271
|
Phone[str],
|
|
288
272
|
Email[str],
|
|
289
273
|
Username[str],
|
|
290
|
-
FullUserTypeMixin[
|
|
274
|
+
FullUserTypeMixin[UserType],
|
|
291
275
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
292
|
-
|
|
276
|
+
LifecycleTimestamp,
|
|
293
277
|
DataIdentifier,
|
|
294
278
|
):
|
|
295
279
|
pass
|
|
@@ -300,7 +284,7 @@ class UserOrganizationSchema(
|
|
|
300
284
|
UserOrganizationRolesSchemaMixin,
|
|
301
285
|
OrganizationSchemaMixin[StandardOrganizationSchema],
|
|
302
286
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
303
|
-
|
|
287
|
+
LifecycleTimestamp,
|
|
304
288
|
DataIdentifier,
|
|
305
289
|
):
|
|
306
290
|
pass
|
|
@@ -332,7 +316,7 @@ class UserAndOrganizationSchema(
|
|
|
332
316
|
OrganizationSchemaMixin[StandardOrganizationSchema],
|
|
333
317
|
UserSchemaMixin[StandardUserSchema],
|
|
334
318
|
SimpleDataStatusMixin[DataStatusEnum],
|
|
335
|
-
|
|
319
|
+
LifecycleTimestamp,
|
|
336
320
|
DataIdentifier,
|
|
337
321
|
):
|
|
338
322
|
pass
|
|
@@ -32,38 +32,23 @@ from maleo.types.dict import StrToAnyDict
|
|
|
32
32
|
from maleo.types.integer import OptInt, OptListOfInts
|
|
33
33
|
from maleo.types.string import OptStr, OptListOfStrs
|
|
34
34
|
from maleo.types.uuid import OptListOfUUIDs
|
|
35
|
-
from ..enums.organization import IdentifierType
|
|
35
|
+
from ..enums.organization import IdentifierType
|
|
36
36
|
from ..mixins.organization import Key, Name
|
|
37
37
|
from ..types.organization import IdentifierValueType
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
class Expand(BaseModel):
|
|
41
|
-
expand: Annotated[
|
|
42
|
-
OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
|
|
43
|
-
] = None
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class CreateQuery(Expand):
|
|
47
|
-
pass
|
|
48
|
-
|
|
49
|
-
|
|
50
40
|
class InsertData(Name[str], Key[str], FullOrganizationTypeMixin[OrganizationType]):
|
|
51
41
|
pass
|
|
52
42
|
|
|
53
43
|
|
|
54
|
-
class
|
|
44
|
+
class CreateParameter(InsertData):
|
|
55
45
|
related_to: Annotated[OptInt, Field(None, description="Related to", ge=1)] = None
|
|
56
46
|
relation: Annotated[
|
|
57
47
|
OptOrganizationRelation, Field(None, description="Relation")
|
|
58
48
|
] = None
|
|
59
49
|
|
|
60
50
|
|
|
61
|
-
class CreateParameter(CreateQuery, CreateData):
|
|
62
|
-
pass
|
|
63
|
-
|
|
64
|
-
|
|
65
51
|
class ReadMultipleParameter(
|
|
66
|
-
Expand,
|
|
67
52
|
ReadPaginatedMultipleParameter,
|
|
68
53
|
Names[OptListOfStrs],
|
|
69
54
|
Keys[OptListOfStrs],
|
|
@@ -84,7 +69,6 @@ class ReadMultipleParameter(
|
|
|
84
69
|
"page",
|
|
85
70
|
"limit",
|
|
86
71
|
"use_cache",
|
|
87
|
-
"expand",
|
|
88
72
|
}
|
|
89
73
|
|
|
90
74
|
def to_query_params(self) -> StrToAnyDict:
|
|
@@ -97,9 +81,7 @@ class ReadMultipleParameter(
|
|
|
97
81
|
return params
|
|
98
82
|
|
|
99
83
|
|
|
100
|
-
class ReadSingleParameter(
|
|
101
|
-
Expand, BaseReadSingleParameter[IdentifierType, IdentifierValueType]
|
|
102
|
-
):
|
|
84
|
+
class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValueType]):
|
|
103
85
|
@overload
|
|
104
86
|
@classmethod
|
|
105
87
|
def new(
|
|
@@ -108,7 +90,6 @@ class ReadSingleParameter(
|
|
|
108
90
|
identifier_value: int,
|
|
109
91
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
110
92
|
use_cache: bool = True,
|
|
111
|
-
expand: OptListOfExpandableFields = None,
|
|
112
93
|
) -> "ReadSingleParameter": ...
|
|
113
94
|
@overload
|
|
114
95
|
@classmethod
|
|
@@ -118,7 +99,6 @@ class ReadSingleParameter(
|
|
|
118
99
|
identifier_value: UUID,
|
|
119
100
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
120
101
|
use_cache: bool = True,
|
|
121
|
-
expand: OptListOfExpandableFields = None,
|
|
122
102
|
) -> "ReadSingleParameter": ...
|
|
123
103
|
@overload
|
|
124
104
|
@classmethod
|
|
@@ -128,7 +108,6 @@ class ReadSingleParameter(
|
|
|
128
108
|
identifier_value: str,
|
|
129
109
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
130
110
|
use_cache: bool = True,
|
|
131
|
-
expand: OptListOfExpandableFields = None,
|
|
132
111
|
) -> "ReadSingleParameter": ...
|
|
133
112
|
@classmethod
|
|
134
113
|
def new(
|
|
@@ -137,19 +116,17 @@ class ReadSingleParameter(
|
|
|
137
116
|
identifier_value: IdentifierValueType,
|
|
138
117
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
139
118
|
use_cache: bool = True,
|
|
140
|
-
expand: OptListOfExpandableFields = None,
|
|
141
119
|
) -> "ReadSingleParameter":
|
|
142
120
|
return cls(
|
|
143
121
|
identifier_type=identifier_type,
|
|
144
122
|
identifier_value=identifier_value,
|
|
145
123
|
statuses=statuses,
|
|
146
124
|
use_cache=use_cache,
|
|
147
|
-
expand=expand,
|
|
148
125
|
)
|
|
149
126
|
|
|
150
127
|
def to_query_params(self) -> StrToAnyDict:
|
|
151
128
|
return self.model_dump(
|
|
152
|
-
mode="json", include={"statuses", "use_cache"
|
|
129
|
+
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
153
130
|
)
|
|
154
131
|
|
|
155
132
|
|
|
@@ -171,7 +148,6 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
171
148
|
|
|
172
149
|
|
|
173
150
|
class UpdateParameter(
|
|
174
|
-
Expand,
|
|
175
151
|
UpdateDataMixin[UpdateDataT],
|
|
176
152
|
IdentifierTypeValue[
|
|
177
153
|
IdentifierType,
|
|
@@ -183,7 +159,6 @@ class UpdateParameter(
|
|
|
183
159
|
|
|
184
160
|
|
|
185
161
|
class StatusUpdateParameter(
|
|
186
|
-
Expand,
|
|
187
162
|
BaseStatusUpdateParameter[IdentifierType, IdentifierValueType],
|
|
188
163
|
):
|
|
189
164
|
pass
|
|
@@ -33,12 +33,12 @@ from maleo.types.dict import StrToAnyDict
|
|
|
33
33
|
from maleo.types.integer import OptListOfInts
|
|
34
34
|
from maleo.types.uuid import OptListOfUUIDs
|
|
35
35
|
from ..enums.organization_relation import IdentifierType
|
|
36
|
-
from ..mixins.organization_relation import IsBidirectional,
|
|
36
|
+
from ..mixins.organization_relation import IsBidirectional, Meta
|
|
37
37
|
from ..types.organization_relation import IdentifierValueType
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
class CreateParameter(
|
|
41
|
-
|
|
41
|
+
Meta,
|
|
42
42
|
IsBidirectional[bool],
|
|
43
43
|
SimpleOrganizationRelationMixin[OrganizationRelation],
|
|
44
44
|
IntTargetId[int],
|
|
@@ -140,11 +140,11 @@ class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValu
|
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
class FullUpdateData(
|
|
143
|
+
class FullUpdateData(Meta, IsBidirectional[bool]):
|
|
144
144
|
pass
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
class PartialUpdateData(
|
|
147
|
+
class PartialUpdateData(Meta, IsBidirectional[OptBool]):
|
|
148
148
|
pass
|
|
149
149
|
|
|
150
150
|
|