maleo-identity 0.1.2__py3-none-any.whl → 0.1.4__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/enums/organization.py +0 -8
- maleo/identity/enums/patient.py +0 -9
- maleo/identity/enums/user.py +0 -13
- maleo/identity/enums/user_profile.py +0 -9
- maleo/identity/mixins/organization_relation.py +2 -4
- maleo/identity/mixins/patient.py +15 -3
- maleo/identity/schemas/common.py +50 -66
- maleo/identity/schemas/organization.py +4 -29
- maleo/identity/schemas/organization_relation.py +4 -4
- maleo/identity/schemas/patient.py +10 -39
- maleo/identity/schemas/user.py +3 -14
- maleo/identity/schemas/user_profile.py +4 -20
- maleo/identity/utils/organization.py +0 -30
- maleo/identity/utils/user.py +0 -30
- {maleo_identity-0.1.2.dist-info → maleo_identity-0.1.4.dist-info}/METADATA +1 -1
- {maleo_identity-0.1.2.dist-info → maleo_identity-0.1.4.dist-info}/RECORD +19 -22
- maleo/identity/dtos.py +0 -309
- maleo/identity/validators/__init__.py +0 -0
- maleo/identity/validators/patient.py +0 -6
- {maleo_identity-0.1.2.dist-info → maleo_identity-0.1.4.dist-info}/WHEEL +0 -0
- {maleo_identity-0.1.2.dist-info → maleo_identity-0.1.4.dist-info}/licenses/LICENSE +0 -0
- {maleo_identity-0.1.2.dist-info → maleo_identity-0.1.4.dist-info}/top_level.txt +0 -0
|
@@ -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
|
maleo/identity/enums/patient.py
CHANGED
|
@@ -11,12 +11,3 @@ class IdentifierType(StrEnum):
|
|
|
11
11
|
@classmethod
|
|
12
12
|
def choices(cls) -> ListOfStrs:
|
|
13
13
|
return [e.value for e in cls]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ExpandableField(StrEnum):
|
|
17
|
-
GENDER = "gender"
|
|
18
|
-
BLOOD_TYPE = "blood_type"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ListOfExpandableFields = list[ExpandableField]
|
|
22
|
-
OptListOfExpandableFields = ListOfExpandableFields | None
|
maleo/identity/enums/user.py
CHANGED
|
@@ -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
|
|
@@ -11,12 +11,3 @@ class IdentifierType(StrEnum):
|
|
|
11
11
|
@classmethod
|
|
12
12
|
def choices(cls) -> ListOfStrs:
|
|
13
13
|
return [e.value for e in cls]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ExpandableField(StrEnum):
|
|
17
|
-
GENDER = "gender"
|
|
18
|
-
BLOOD_TYPE = "blood_type"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ListOfExpandableFields = list[ExpandableField]
|
|
22
|
-
OptListOfExpandableFields = ListOfExpandableFields | None
|
|
@@ -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
|
maleo/identity/mixins/patient.py
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
from pydantic import Field
|
|
2
|
-
from typing import Annotated, Generic
|
|
1
|
+
from pydantic import Field, model_validator
|
|
2
|
+
from typing import Annotated, Generic, Self
|
|
3
3
|
from maleo.schemas.mixins.identity import Passport as BasePassport
|
|
4
|
-
from maleo.types.string import OptStrT
|
|
4
|
+
from maleo.types.string import OptStr, OptStrT
|
|
5
|
+
from .common import IdCard
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class Passport(BasePassport, Generic[OptStrT]):
|
|
8
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
|
maleo/identity/schemas/common.py
CHANGED
|
@@ -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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from datetime import date
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from typing import
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from typing import Generic, Literal, TypeVar, overload
|
|
4
4
|
from uuid import UUID
|
|
5
5
|
from maleo.enums.identity import (
|
|
6
6
|
OptBloodType,
|
|
@@ -43,46 +43,26 @@ from maleo.types.dict import StrToAnyDict
|
|
|
43
43
|
from maleo.types.integer import OptListOfInts
|
|
44
44
|
from maleo.types.string import OptStr, OptListOfStrs
|
|
45
45
|
from maleo.types.uuid import OptListOfUUIDs
|
|
46
|
-
from ..enums.patient import IdentifierType
|
|
46
|
+
from ..enums.patient import IdentifierType
|
|
47
47
|
from ..mixins.common import IdCard, FullName, PlaceOfBirth
|
|
48
|
-
from ..mixins.patient import
|
|
48
|
+
from ..mixins.patient import PatientIdentifier
|
|
49
49
|
from ..types.patient import IdentifierValueType
|
|
50
|
-
from ..validators.patient import validate_id_card_or_passport
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
class
|
|
54
|
-
expand: Annotated[
|
|
55
|
-
OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
|
|
56
|
-
] = None
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class CreateQuery(Expand):
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class CreateData(
|
|
52
|
+
class CreateParameter(
|
|
64
53
|
RhesusMixin[OptRhesus],
|
|
65
54
|
BloodTypeMixin[OptBloodType],
|
|
66
55
|
GenderMixin[Gender],
|
|
67
56
|
DateOfBirth[date],
|
|
68
57
|
PlaceOfBirth[OptStr],
|
|
69
58
|
FullName[str],
|
|
70
|
-
|
|
71
|
-
IdCard[OptStr],
|
|
59
|
+
PatientIdentifier,
|
|
72
60
|
IntOrganizationId[int],
|
|
73
61
|
):
|
|
74
|
-
@model_validator(mode="after")
|
|
75
|
-
def chk_id_card_or_passport(self) -> Self:
|
|
76
|
-
validate_id_card_or_passport(self.id_card, self.passport)
|
|
77
|
-
return self
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class CreateParameter(CreateQuery, CreateData):
|
|
81
62
|
pass
|
|
82
63
|
|
|
83
64
|
|
|
84
65
|
class ReadMultipleParameter(
|
|
85
|
-
Expand,
|
|
86
66
|
ReadPaginatedMultipleParameter,
|
|
87
67
|
RhesusesMixin[OptListOfRhesuses],
|
|
88
68
|
BloodTypesMixin[OptListOfBloodTypes],
|
|
@@ -120,9 +100,7 @@ class ReadMultipleParameter(
|
|
|
120
100
|
return params
|
|
121
101
|
|
|
122
102
|
|
|
123
|
-
class ReadSingleParameter(
|
|
124
|
-
Expand, BaseReadSingleParameter[IdentifierType, IdentifierValueType]
|
|
125
|
-
):
|
|
103
|
+
class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValueType]):
|
|
126
104
|
@overload
|
|
127
105
|
@classmethod
|
|
128
106
|
def new(
|
|
@@ -131,7 +109,6 @@ class ReadSingleParameter(
|
|
|
131
109
|
identifier_value: int,
|
|
132
110
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
133
111
|
use_cache: bool = True,
|
|
134
|
-
expand: OptListOfExpandableFields = None,
|
|
135
112
|
) -> "ReadSingleParameter": ...
|
|
136
113
|
@overload
|
|
137
114
|
@classmethod
|
|
@@ -141,7 +118,6 @@ class ReadSingleParameter(
|
|
|
141
118
|
identifier_value: UUID,
|
|
142
119
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
143
120
|
use_cache: bool = True,
|
|
144
|
-
expand: OptListOfExpandableFields = None,
|
|
145
121
|
) -> "ReadSingleParameter": ...
|
|
146
122
|
@overload
|
|
147
123
|
@classmethod
|
|
@@ -151,7 +127,6 @@ class ReadSingleParameter(
|
|
|
151
127
|
identifier_value: str,
|
|
152
128
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
153
129
|
use_cache: bool = True,
|
|
154
|
-
expand: OptListOfExpandableFields = None,
|
|
155
130
|
) -> "ReadSingleParameter": ...
|
|
156
131
|
@classmethod
|
|
157
132
|
def new(
|
|
@@ -160,19 +135,17 @@ class ReadSingleParameter(
|
|
|
160
135
|
identifier_value: IdentifierValueType,
|
|
161
136
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
162
137
|
use_cache: bool = True,
|
|
163
|
-
expand: OptListOfExpandableFields = None,
|
|
164
138
|
) -> "ReadSingleParameter":
|
|
165
139
|
return cls(
|
|
166
140
|
identifier_type=identifier_type,
|
|
167
141
|
identifier_value=identifier_value,
|
|
168
142
|
statuses=statuses,
|
|
169
143
|
use_cache=use_cache,
|
|
170
|
-
expand=expand,
|
|
171
144
|
)
|
|
172
145
|
|
|
173
146
|
def to_query_params(self) -> StrToAnyDict:
|
|
174
147
|
return self.model_dump(
|
|
175
|
-
mode="json", include={"statuses", "use_cache"
|
|
148
|
+
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
176
149
|
)
|
|
177
150
|
|
|
178
151
|
|
|
@@ -183,7 +156,7 @@ class FullUpdateData(
|
|
|
183
156
|
DateOfBirth[date],
|
|
184
157
|
PlaceOfBirth[OptStr],
|
|
185
158
|
FullName[str],
|
|
186
|
-
|
|
159
|
+
PatientIdentifier,
|
|
187
160
|
IdCard[OptStr],
|
|
188
161
|
):
|
|
189
162
|
pass
|
|
@@ -196,7 +169,7 @@ class PartialUpdateData(
|
|
|
196
169
|
DateOfBirth[OptDate],
|
|
197
170
|
PlaceOfBirth[OptStr],
|
|
198
171
|
FullName[OptStr],
|
|
199
|
-
|
|
172
|
+
PatientIdentifier,
|
|
200
173
|
IdCard[OptStr],
|
|
201
174
|
):
|
|
202
175
|
pass
|
|
@@ -210,7 +183,6 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
210
183
|
|
|
211
184
|
|
|
212
185
|
class UpdateParameter(
|
|
213
|
-
Expand,
|
|
214
186
|
UpdateDataMixin[UpdateDataT],
|
|
215
187
|
IdentifierTypeValue[
|
|
216
188
|
IdentifierType,
|
|
@@ -222,7 +194,6 @@ class UpdateParameter(
|
|
|
222
194
|
|
|
223
195
|
|
|
224
196
|
class StatusUpdateParameter(
|
|
225
|
-
Expand,
|
|
226
197
|
BaseStatusUpdateParameter[IdentifierType, IdentifierValueType],
|
|
227
198
|
):
|
|
228
199
|
pass
|
maleo/identity/schemas/user.py
CHANGED
|
@@ -30,7 +30,7 @@ from maleo.types.dict import StrToAnyDict
|
|
|
30
30
|
from maleo.types.integer import OptListOfInts
|
|
31
31
|
from maleo.types.string import OptStr, OptListOfStrs
|
|
32
32
|
from maleo.types.uuid import OptListOfUUIDs
|
|
33
|
-
from ..enums.user import IdentifierType
|
|
33
|
+
from ..enums.user import IdentifierType
|
|
34
34
|
from ..mixins.user import (
|
|
35
35
|
Username,
|
|
36
36
|
Usernames,
|
|
@@ -42,12 +42,6 @@ from ..mixins.user import (
|
|
|
42
42
|
from ..types.user import IdentifierValueType
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
class Expand(BaseModel):
|
|
46
|
-
expand: Annotated[
|
|
47
|
-
OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
|
|
48
|
-
] = None
|
|
49
|
-
|
|
50
|
-
|
|
51
45
|
class CreateParameter(
|
|
52
46
|
Phone[str], Email[str], Username[str], FullUserTypeMixin[UserType]
|
|
53
47
|
):
|
|
@@ -55,7 +49,6 @@ class CreateParameter(
|
|
|
55
49
|
|
|
56
50
|
|
|
57
51
|
class ReadMultipleParameter(
|
|
58
|
-
Expand,
|
|
59
52
|
ReadPaginatedMultipleParameter,
|
|
60
53
|
Phones[OptListOfStrs],
|
|
61
54
|
Emails[OptListOfStrs],
|
|
@@ -93,9 +86,7 @@ class ReadMultipleParameter(
|
|
|
93
86
|
return params
|
|
94
87
|
|
|
95
88
|
|
|
96
|
-
class ReadSingleParameter(
|
|
97
|
-
Expand, BaseReadSingleParameter[IdentifierType, IdentifierValueType]
|
|
98
|
-
):
|
|
89
|
+
class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValueType]):
|
|
99
90
|
@overload
|
|
100
91
|
@classmethod
|
|
101
92
|
def new(
|
|
@@ -140,7 +131,7 @@ class ReadSingleParameter(
|
|
|
140
131
|
|
|
141
132
|
def to_query_params(self) -> StrToAnyDict:
|
|
142
133
|
return self.model_dump(
|
|
143
|
-
mode="json", include={"statuses", "use_cache"
|
|
134
|
+
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
144
135
|
)
|
|
145
136
|
|
|
146
137
|
|
|
@@ -172,7 +163,6 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
172
163
|
|
|
173
164
|
|
|
174
165
|
class UpdateParameter(
|
|
175
|
-
Expand,
|
|
176
166
|
UpdateDataMixin[UpdateDataT],
|
|
177
167
|
IdentifierTypeValue[
|
|
178
168
|
IdentifierType,
|
|
@@ -184,7 +174,6 @@ class UpdateParameter(
|
|
|
184
174
|
|
|
185
175
|
|
|
186
176
|
class StatusUpdateParameter(
|
|
187
|
-
Expand,
|
|
188
177
|
BaseStatusUpdateParameter[IdentifierType, IdentifierValueType],
|
|
189
178
|
):
|
|
190
179
|
pass
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Generic, Literal, TypeVar, overload
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
from maleo.enums.identity import (
|
|
5
5
|
OptBloodType,
|
|
@@ -36,7 +36,7 @@ from maleo.types.dict import StrToAnyDict
|
|
|
36
36
|
from maleo.types.integer import OptListOfInts
|
|
37
37
|
from maleo.types.string import OptStr
|
|
38
38
|
from maleo.types.uuid import OptListOfUUIDs
|
|
39
|
-
from ..enums.user_profile import IdentifierType
|
|
39
|
+
from ..enums.user_profile import IdentifierType
|
|
40
40
|
from ..mixins.common import (
|
|
41
41
|
IdCard,
|
|
42
42
|
FullName,
|
|
@@ -53,12 +53,6 @@ from ..mixins.user_profile import (
|
|
|
53
53
|
from ..types.user_profile import IdentifierValueType
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
class Expand(BaseModel):
|
|
57
|
-
expand: Annotated[
|
|
58
|
-
OptListOfExpandableFields, Field(None, description="Expand", min_length=1)
|
|
59
|
-
] = None
|
|
60
|
-
|
|
61
|
-
|
|
62
56
|
class CoreCreateData(
|
|
63
57
|
BloodTypeMixin[OptBloodType],
|
|
64
58
|
GenderMixin[OptGender],
|
|
@@ -118,7 +112,6 @@ class CreateParameter(
|
|
|
118
112
|
|
|
119
113
|
|
|
120
114
|
class ReadMultipleParameter(
|
|
121
|
-
Expand,
|
|
122
115
|
ReadPaginatedMultipleParameter,
|
|
123
116
|
BloodTypesMixin[OptListOfBloodTypes],
|
|
124
117
|
GendersMixin[OptListOfGenders],
|
|
@@ -152,9 +145,7 @@ class ReadMultipleParameter(
|
|
|
152
145
|
return params
|
|
153
146
|
|
|
154
147
|
|
|
155
|
-
class ReadSingleParameter(
|
|
156
|
-
Expand, BaseReadSingleParameter[IdentifierType, IdentifierValueType]
|
|
157
|
-
):
|
|
148
|
+
class ReadSingleParameter(BaseReadSingleParameter[IdentifierType, IdentifierValueType]):
|
|
158
149
|
@overload
|
|
159
150
|
@classmethod
|
|
160
151
|
def new(
|
|
@@ -163,7 +154,6 @@ class ReadSingleParameter(
|
|
|
163
154
|
identifier_value: int,
|
|
164
155
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
165
156
|
use_cache: bool = True,
|
|
166
|
-
expand: OptListOfExpandableFields = None,
|
|
167
157
|
) -> "ReadSingleParameter": ...
|
|
168
158
|
@overload
|
|
169
159
|
@classmethod
|
|
@@ -173,7 +163,6 @@ class ReadSingleParameter(
|
|
|
173
163
|
identifier_value: UUID,
|
|
174
164
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
175
165
|
use_cache: bool = True,
|
|
176
|
-
expand: OptListOfExpandableFields = None,
|
|
177
166
|
) -> "ReadSingleParameter": ...
|
|
178
167
|
@overload
|
|
179
168
|
@classmethod
|
|
@@ -183,7 +172,6 @@ class ReadSingleParameter(
|
|
|
183
172
|
identifier_value: str,
|
|
184
173
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
185
174
|
use_cache: bool = True,
|
|
186
|
-
expand: OptListOfExpandableFields = None,
|
|
187
175
|
) -> "ReadSingleParameter": ...
|
|
188
176
|
@classmethod
|
|
189
177
|
def new(
|
|
@@ -192,19 +180,17 @@ class ReadSingleParameter(
|
|
|
192
180
|
identifier_value: IdentifierValueType,
|
|
193
181
|
statuses: ListOfDataStatuses = list(FULL_DATA_STATUSES),
|
|
194
182
|
use_cache: bool = True,
|
|
195
|
-
expand: OptListOfExpandableFields = None,
|
|
196
183
|
) -> "ReadSingleParameter":
|
|
197
184
|
return cls(
|
|
198
185
|
identifier_type=identifier_type,
|
|
199
186
|
identifier_value=identifier_value,
|
|
200
187
|
statuses=statuses,
|
|
201
188
|
use_cache=use_cache,
|
|
202
|
-
expand=expand,
|
|
203
189
|
)
|
|
204
190
|
|
|
205
191
|
def to_query_params(self) -> StrToAnyDict:
|
|
206
192
|
return self.model_dump(
|
|
207
|
-
mode="json", include={"statuses", "use_cache"
|
|
193
|
+
mode="json", include={"statuses", "use_cache"}, exclude_none=True
|
|
208
194
|
)
|
|
209
195
|
|
|
210
196
|
|
|
@@ -246,7 +232,6 @@ class UpdateDataMixin(BaseModel, Generic[UpdateDataT]):
|
|
|
246
232
|
|
|
247
233
|
|
|
248
234
|
class UpdateParameter(
|
|
249
|
-
Expand,
|
|
250
235
|
UpdateDataMixin[UpdateDataT],
|
|
251
236
|
IdentifierTypeValue[
|
|
252
237
|
IdentifierType,
|
|
@@ -258,7 +243,6 @@ class UpdateParameter(
|
|
|
258
243
|
|
|
259
244
|
|
|
260
245
|
class StatusUpdateParameter(
|
|
261
|
-
Expand,
|
|
262
246
|
BaseStatusUpdateParameter[IdentifierType, IdentifierValueType],
|
|
263
247
|
):
|
|
264
248
|
pass
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
from typing import Literal, Type, overload
|
|
2
|
-
from ..dtos import (
|
|
3
|
-
StandardOrganizationDTO,
|
|
4
|
-
FullOrganizationDTO,
|
|
5
|
-
AnyOrganizationDTOType,
|
|
6
|
-
)
|
|
7
2
|
from ..schemas.common import (
|
|
8
3
|
StandardOrganizationSchema,
|
|
9
4
|
FullOrganizationSchema,
|
|
@@ -12,31 +7,6 @@ from ..schemas.common import (
|
|
|
12
7
|
from ..enums.organization import Granularity
|
|
13
8
|
|
|
14
9
|
|
|
15
|
-
@overload
|
|
16
|
-
def get_dto_model(
|
|
17
|
-
granularity: Literal[Granularity.STANDARD],
|
|
18
|
-
/,
|
|
19
|
-
) -> Type[StandardOrganizationDTO]: ...
|
|
20
|
-
@overload
|
|
21
|
-
def get_dto_model(
|
|
22
|
-
granularity: Literal[Granularity.FULL],
|
|
23
|
-
/,
|
|
24
|
-
) -> Type[FullOrganizationDTO]: ...
|
|
25
|
-
@overload
|
|
26
|
-
def get_dto_model(
|
|
27
|
-
granularity: Granularity = Granularity.STANDARD,
|
|
28
|
-
/,
|
|
29
|
-
) -> AnyOrganizationDTOType: ...
|
|
30
|
-
def get_dto_model(
|
|
31
|
-
granularity: Granularity = Granularity.STANDARD,
|
|
32
|
-
/,
|
|
33
|
-
) -> AnyOrganizationDTOType:
|
|
34
|
-
if granularity is Granularity.STANDARD:
|
|
35
|
-
return StandardOrganizationDTO
|
|
36
|
-
elif granularity is Granularity.FULL:
|
|
37
|
-
return FullOrganizationDTO
|
|
38
|
-
|
|
39
|
-
|
|
40
10
|
@overload
|
|
41
11
|
def get_schema_model(
|
|
42
12
|
granularity: Literal[Granularity.STANDARD],
|
maleo/identity/utils/user.py
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
from typing import Literal, Type, overload
|
|
2
|
-
from ..dtos import (
|
|
3
|
-
StandardUserDTO,
|
|
4
|
-
FullUserDTO,
|
|
5
|
-
AnyUserDTOType,
|
|
6
|
-
)
|
|
7
2
|
from ..schemas.common import (
|
|
8
3
|
StandardUserSchema,
|
|
9
4
|
FullUserSchema,
|
|
@@ -12,31 +7,6 @@ from ..schemas.common import (
|
|
|
12
7
|
from ..enums.user import Granularity
|
|
13
8
|
|
|
14
9
|
|
|
15
|
-
@overload
|
|
16
|
-
def get_dto_model(
|
|
17
|
-
granularity: Literal[Granularity.STANDARD],
|
|
18
|
-
/,
|
|
19
|
-
) -> Type[StandardUserDTO]: ...
|
|
20
|
-
@overload
|
|
21
|
-
def get_dto_model(
|
|
22
|
-
granularity: Literal[Granularity.FULL],
|
|
23
|
-
/,
|
|
24
|
-
) -> Type[FullUserDTO]: ...
|
|
25
|
-
@overload
|
|
26
|
-
def get_dto_model(
|
|
27
|
-
granularity: Granularity = Granularity.STANDARD,
|
|
28
|
-
/,
|
|
29
|
-
) -> AnyUserDTOType: ...
|
|
30
|
-
def get_dto_model(
|
|
31
|
-
granularity: Granularity = Granularity.STANDARD,
|
|
32
|
-
/,
|
|
33
|
-
) -> AnyUserDTOType:
|
|
34
|
-
if granularity is Granularity.STANDARD:
|
|
35
|
-
return StandardUserDTO
|
|
36
|
-
elif granularity is Granularity.FULL:
|
|
37
|
-
return FullUserDTO
|
|
38
|
-
|
|
39
|
-
|
|
40
10
|
@overload
|
|
41
11
|
def get_schema_model(
|
|
42
12
|
granularity: Literal[Granularity.STANDARD],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
maleo/identity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
maleo/identity/dtos.py,sha256=XhfLat9emtRaVl-2McVDz8zunyoshAK7gm2OYmhZ_ZE,7876
|
|
3
2
|
maleo/identity/models.py,sha256=aBYbkkd07BzH2zRq3q_D80xMR8DdhCiw1eQ2EYa9ZTQ,10223
|
|
4
3
|
maleo/identity/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
4
|
maleo/identity/constants/api_key.py,sha256=e7CsTodUBgyoX30SJUnYx457WBZeRFyyeaOFGsZ-7mY,264
|
|
@@ -14,35 +13,35 @@ maleo/identity/constants/user_profile.py,sha256=trDI4mNlcbA1_ignknMy07I6H-VqAytl
|
|
|
14
13
|
maleo/identity/constants/user_system_role.py,sha256=_p5FI2X7yBUJuA06ia_vIkDRyfY4WZweQD08G3wCuRw,300
|
|
15
14
|
maleo/identity/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
15
|
maleo/identity/enums/api_key.py,sha256=WST6RsRrvJGeSL5ugVeZNKXReGsh9GEPDxmRy-owiEk,276
|
|
17
|
-
maleo/identity/enums/organization.py,sha256=
|
|
16
|
+
maleo/identity/enums/organization.py,sha256=akxi_BJqRMokQ59K4KMZDkO-yLVC0Q_A7jErOiuixqs,406
|
|
18
17
|
maleo/identity/enums/organization_registration_code.py,sha256=ZkteIpOW6MOLEHBbmDUaRGalTlTWUIRlimz-FohBWiM,282
|
|
19
18
|
maleo/identity/enums/organization_relation.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
|
|
20
|
-
maleo/identity/enums/patient.py,sha256=
|
|
21
|
-
maleo/identity/enums/user.py,sha256=
|
|
19
|
+
maleo/identity/enums/patient.py,sha256=rMyUPFApFV9Mf3H-hsvTf4KFbHVkR-GAIluGfdQMpHc,274
|
|
20
|
+
maleo/identity/enums/user.py,sha256=Y81ZPrZa8Of84AwFmPtrFygK_kXuWYxMZXUm2FFISK8,436
|
|
22
21
|
maleo/identity/enums/user_medical_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
|
|
23
22
|
maleo/identity/enums/user_organization_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
|
|
24
|
-
maleo/identity/enums/user_profile.py,sha256=
|
|
23
|
+
maleo/identity/enums/user_profile.py,sha256=LgX7Ct-MAfx7o0W8MICzpHMfDhi7wpiJfRszn6vr1zc,272
|
|
25
24
|
maleo/identity/enums/user_system_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
|
|
26
25
|
maleo/identity/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
26
|
maleo/identity/mixins/api_key.py,sha256=btlTZkJxhLyxj0T50ZBJnSUwiDIJl4Dz7oNl7Ftc9WM,173
|
|
28
27
|
maleo/identity/mixins/common.py,sha256=diWtUiPMI_ypHtDrmI5y8IArxCdomo9Gt6X69iFhyuw,905
|
|
29
28
|
maleo/identity/mixins/organization.py,sha256=KMl7Zz_SXu6SvF_1fTibN2vORFGWH7P22cxS_T4KXmE,574
|
|
30
29
|
maleo/identity/mixins/organization_registration_code.py,sha256=G-kgdf2IzKENEyZcV6IXT69eAemnqR1vph3hhG3l1y4,508
|
|
31
|
-
maleo/identity/mixins/organization_relation.py,sha256=
|
|
32
|
-
maleo/identity/mixins/patient.py,sha256=
|
|
30
|
+
maleo/identity/mixins/organization_relation.py,sha256=kf7vDF7-564cIy6g_scxoWaumsJW0xraK3QdyJk_-Qw,427
|
|
31
|
+
maleo/identity/mixins/patient.py,sha256=1zW6u_b8DM-7dSHfqX6HWJbQsRLKD2H1unEUnZco5MI,665
|
|
33
32
|
maleo/identity/mixins/user.py,sha256=UHoMgFJXptE9x9QsR07KG2bgp5OlCNqvYjEtP9S3TIY,1054
|
|
34
33
|
maleo/identity/mixins/user_profile.py,sha256=LFHAzGD-3wli6YJGfl9-Sy0gtQHkhgvrZ5EzOfl1vXY,1174
|
|
35
34
|
maleo/identity/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
35
|
maleo/identity/schemas/api_key.py,sha256=UnQfnoEMkFgOfWDKai6wWNyD5QsovyoOov6jN52QPKI,3713
|
|
37
|
-
maleo/identity/schemas/common.py,sha256=
|
|
38
|
-
maleo/identity/schemas/organization.py,sha256=
|
|
36
|
+
maleo/identity/schemas/common.py,sha256=x_cK5SexE-0dzuUpb3F0qTQ9RbX9bTTweioi7-Q3zPU,8249
|
|
37
|
+
maleo/identity/schemas/organization.py,sha256=lyUDA654ydnL8C6tc9GVsE30E_se5TefI2rZPIL8KUk,4817
|
|
39
38
|
maleo/identity/schemas/organization_registration_code.py,sha256=jAP7MGb_28wh1WoBZDl2FSJBxKFRH56YSQvMFQ5_iyo,4731
|
|
40
|
-
maleo/identity/schemas/organization_relation.py,sha256=
|
|
41
|
-
maleo/identity/schemas/patient.py,sha256=
|
|
42
|
-
maleo/identity/schemas/user.py,sha256=
|
|
39
|
+
maleo/identity/schemas/organization_relation.py,sha256=xEdOuZ6J4r7R4heEagd_UtioYJla73LZs1qloSSEs4I,5067
|
|
40
|
+
maleo/identity/schemas/patient.py,sha256=xy5HGUkMVz2BgU_H2w8AOAr241_zVs8fJyjIMEdCg9I,5406
|
|
41
|
+
maleo/identity/schemas/user.py,sha256=VyaT3tGC0oolYMMsBUy4EMPiQfbwptOvsr4BeD0s1fs,5052
|
|
43
42
|
maleo/identity/schemas/user_medical_role.py,sha256=YzYsjMRKIA4CWdfOlGoPqWFl4v2JTj2EBwOWhNtUKSQ,4893
|
|
44
43
|
maleo/identity/schemas/user_organization_role.py,sha256=MW1Ry1HnGrASmP2Mulk3Pfk1_mIOlLTBARerOA0TowI,4983
|
|
45
|
-
maleo/identity/schemas/user_profile.py,sha256=
|
|
44
|
+
maleo/identity/schemas/user_profile.py,sha256=sa3dJd6T1nxCKW3L-xJLmZIBQFjNApk0hPYAzNh5Vk4,6123
|
|
46
45
|
maleo/identity/schemas/user_system_role.py,sha256=CRI8KgNpcjJU9EBtEc75-vUmC64J5ZgigFO6IRWuRKM,4665
|
|
47
46
|
maleo/identity/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
47
|
maleo/identity/types/api_key.py,sha256=pjWzyAh1p0DTS6v2ImYv849iF-T0PbEM8qlrwN3c-2o,190
|
|
@@ -56,12 +55,10 @@ maleo/identity/types/user_organization_role.py,sha256=FFgzo2IvblckLwKN-rnOXI9TRp
|
|
|
56
55
|
maleo/identity/types/user_profile.py,sha256=UqOBL4v138jumjQstCAZ-2ZV1Ax8-Cr4SvL36nx8brw,63
|
|
57
56
|
maleo/identity/types/user_system_role.py,sha256=6KIDk7kCWBlrloNLfIElflS5N8oBYqPeNRqySD2BQEE,191
|
|
58
57
|
maleo/identity/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
maleo/identity/utils/organization.py,sha256=
|
|
60
|
-
maleo/identity/utils/user.py,sha256=
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
maleo_identity-0.1.
|
|
64
|
-
maleo_identity-0.1.
|
|
65
|
-
maleo_identity-0.1.
|
|
66
|
-
maleo_identity-0.1.2.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
|
|
67
|
-
maleo_identity-0.1.2.dist-info/RECORD,,
|
|
58
|
+
maleo/identity/utils/organization.py,sha256=aEegzeoNLUptrScUB5kWrYlJj7dzTZeVXymltE5lWpE,874
|
|
59
|
+
maleo/identity/utils/user.py,sha256=1pyfmAbXkAEOo6WM2KRA_kRnFi0O_A2ZUEqv01wY-cU,794
|
|
60
|
+
maleo_identity-0.1.4.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
|
|
61
|
+
maleo_identity-0.1.4.dist-info/METADATA,sha256=M9q5rHT-I2to7CeXeV3ZVeQXzJRM2JV6_a8On6-tnow,3583
|
|
62
|
+
maleo_identity-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
63
|
+
maleo_identity-0.1.4.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
|
|
64
|
+
maleo_identity-0.1.4.dist-info/RECORD,,
|
maleo/identity/dtos.py
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
from datetime import date
|
|
2
|
-
from pydantic import BaseModel, Field, model_validator
|
|
3
|
-
from typing import Annotated, Generic, Self, TypeVar, Type
|
|
4
|
-
from maleo.enums.identity import (
|
|
5
|
-
OptBloodType,
|
|
6
|
-
BloodTypeMixin,
|
|
7
|
-
OptRhesus,
|
|
8
|
-
RhesusMixin,
|
|
9
|
-
Gender,
|
|
10
|
-
OptGender,
|
|
11
|
-
GenderMixin,
|
|
12
|
-
)
|
|
13
|
-
from maleo.enums.medical import MedicalRole, FullMedicalRoleMixin
|
|
14
|
-
from maleo.enums.organization import (
|
|
15
|
-
OrganizationRole,
|
|
16
|
-
FullOrganizationRoleMixin,
|
|
17
|
-
OrganizationType,
|
|
18
|
-
FullOrganizationTypeMixin,
|
|
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
|
|
23
|
-
from maleo.schemas.mixins.identity import (
|
|
24
|
-
DataIdentifier,
|
|
25
|
-
IntOrganizationId,
|
|
26
|
-
IntUserId,
|
|
27
|
-
BirthDate,
|
|
28
|
-
DateOfBirth,
|
|
29
|
-
)
|
|
30
|
-
from maleo.schemas.mixins.timestamp import DataTimestamp
|
|
31
|
-
from maleo.types.datetime import OptDate
|
|
32
|
-
from maleo.types.string import OptStr
|
|
33
|
-
from .mixins.common import IdCard, FullName, BirthPlace, PlaceOfBirth
|
|
34
|
-
from .mixins.organization_registration_code import Code, MaxUses, CurrentUses
|
|
35
|
-
from .mixins.organization_relation import IsBidirectional, Metadata
|
|
36
|
-
from .mixins.organization import Key as OrganizationKey, Name as OrganizationName
|
|
37
|
-
from .mixins.patient import Passport
|
|
38
|
-
from .mixins.user_profile import (
|
|
39
|
-
LeadingTitle,
|
|
40
|
-
FirstName,
|
|
41
|
-
MiddleName,
|
|
42
|
-
LastName,
|
|
43
|
-
EndingTitle,
|
|
44
|
-
AvatarName,
|
|
45
|
-
)
|
|
46
|
-
from .mixins.user import Username, Email, Phone
|
|
47
|
-
from .validators.patient import validate_id_card_or_passport
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class PatientDTO(
|
|
51
|
-
RhesusMixin[OptRhesus],
|
|
52
|
-
BloodTypeMixin[OptBloodType],
|
|
53
|
-
GenderMixin[Gender],
|
|
54
|
-
DateOfBirth[date],
|
|
55
|
-
PlaceOfBirth[OptStr],
|
|
56
|
-
FullName[str],
|
|
57
|
-
Passport[OptStr],
|
|
58
|
-
IdCard[OptStr],
|
|
59
|
-
IntOrganizationId[int],
|
|
60
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
61
|
-
DataTimestamp,
|
|
62
|
-
DataIdentifier,
|
|
63
|
-
):
|
|
64
|
-
@model_validator(mode="after")
|
|
65
|
-
def chk_id_card_or_passport(self) -> Self:
|
|
66
|
-
validate_id_card_or_passport(self.id_card, self.passport)
|
|
67
|
-
return self
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class OrganizationRegistrationCodeDTO(
|
|
71
|
-
CurrentUses,
|
|
72
|
-
MaxUses[int],
|
|
73
|
-
Code[str],
|
|
74
|
-
IntOrganizationId[int],
|
|
75
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
76
|
-
DataTimestamp,
|
|
77
|
-
DataIdentifier,
|
|
78
|
-
):
|
|
79
|
-
pass
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
OptOrganizationRegistrationCodeDTO = OrganizationRegistrationCodeDTO | None
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class OrganizationRegistrationCodeDTOMixin(BaseModel):
|
|
86
|
-
registration_code: Annotated[
|
|
87
|
-
OptOrganizationRegistrationCodeDTO,
|
|
88
|
-
Field(None, description="Organization's registration code"),
|
|
89
|
-
] = None
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class StandardOrganizationDTO(
|
|
93
|
-
OrganizationName[str],
|
|
94
|
-
OrganizationKey[str],
|
|
95
|
-
FullOrganizationTypeMixin[OrganizationType],
|
|
96
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
97
|
-
DataTimestamp,
|
|
98
|
-
DataIdentifier,
|
|
99
|
-
):
|
|
100
|
-
pass
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class SourceOrganizationDTOMixin(BaseModel):
|
|
104
|
-
source: Annotated[
|
|
105
|
-
StandardOrganizationDTO, Field(..., description="Source organization")
|
|
106
|
-
]
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class SourceOrganizationRelationDTO(
|
|
110
|
-
Metadata,
|
|
111
|
-
IsBidirectional[bool],
|
|
112
|
-
SourceOrganizationDTOMixin,
|
|
113
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
114
|
-
DataTimestamp,
|
|
115
|
-
DataIdentifier,
|
|
116
|
-
):
|
|
117
|
-
pass
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
class SourceOrganizationRelationsDTOMixin(BaseModel):
|
|
121
|
-
sources: Annotated[
|
|
122
|
-
list[SourceOrganizationRelationDTO],
|
|
123
|
-
Field(list[SourceOrganizationRelationDTO](), description="Sources"),
|
|
124
|
-
] = list[SourceOrganizationRelationDTO]()
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
class TargetOrganizationDTOMixin(BaseModel):
|
|
128
|
-
target: Annotated[
|
|
129
|
-
StandardOrganizationDTO, Field(..., description="Target organization")
|
|
130
|
-
]
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
class TargetOrganizationRelationDTO(
|
|
134
|
-
Metadata,
|
|
135
|
-
IsBidirectional[bool],
|
|
136
|
-
TargetOrganizationDTOMixin,
|
|
137
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
138
|
-
DataTimestamp,
|
|
139
|
-
DataIdentifier,
|
|
140
|
-
):
|
|
141
|
-
pass
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
class TargetOrganizationRelationsDTOMixin(BaseModel):
|
|
145
|
-
targets: Annotated[
|
|
146
|
-
list[TargetOrganizationRelationDTO],
|
|
147
|
-
Field(list[TargetOrganizationRelationDTO](), description="Targets"),
|
|
148
|
-
] = list[TargetOrganizationRelationDTO]()
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
class FullOrganizationDTO(
|
|
152
|
-
TargetOrganizationRelationsDTOMixin,
|
|
153
|
-
SourceOrganizationRelationsDTOMixin,
|
|
154
|
-
OrganizationRegistrationCodeDTOMixin,
|
|
155
|
-
StandardOrganizationDTO,
|
|
156
|
-
):
|
|
157
|
-
pass
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
AnyOrganizationDTOType = Type[StandardOrganizationDTO] | Type[FullOrganizationDTO]
|
|
161
|
-
AnyOrganizationDTO = StandardOrganizationDTO | FullOrganizationDTO
|
|
162
|
-
AnyOrganizationDTOT = TypeVar("AnyOrganizationDTOT", bound=AnyOrganizationDTO)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class OrganizationDTOMixin(BaseModel, Generic[AnyOrganizationDTOT]):
|
|
166
|
-
organization: Annotated[AnyOrganizationDTOT, Field(..., description="Organization")]
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
class UserMedicalRoleDTO(
|
|
170
|
-
FullMedicalRoleMixin[MedicalRole],
|
|
171
|
-
IntOrganizationId[int],
|
|
172
|
-
IntUserId[int],
|
|
173
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
174
|
-
DataTimestamp,
|
|
175
|
-
DataIdentifier,
|
|
176
|
-
):
|
|
177
|
-
pass
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
class UserMedicalRolesDTOMixin(BaseModel):
|
|
181
|
-
medical_roles: Annotated[
|
|
182
|
-
list[UserMedicalRoleDTO],
|
|
183
|
-
Field(list[UserMedicalRoleDTO](), description="Medical roles"),
|
|
184
|
-
] = list[UserMedicalRoleDTO]()
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
class UserOrganizationRoleDTO(
|
|
188
|
-
FullOrganizationRoleMixin[OrganizationRole],
|
|
189
|
-
IntOrganizationId[int],
|
|
190
|
-
IntUserId[int],
|
|
191
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
192
|
-
DataTimestamp,
|
|
193
|
-
DataIdentifier,
|
|
194
|
-
):
|
|
195
|
-
pass
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
class UserOrganizationRolesDTOMixin(BaseModel):
|
|
199
|
-
organization_roles: Annotated[
|
|
200
|
-
list[UserOrganizationRoleDTO],
|
|
201
|
-
Field(list[UserOrganizationRoleDTO](), description="Organization roles"),
|
|
202
|
-
] = list[UserOrganizationRoleDTO]()
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
class UserProfileDTO(
|
|
206
|
-
AvatarName[str],
|
|
207
|
-
BloodTypeMixin[OptBloodType],
|
|
208
|
-
GenderMixin[OptGender],
|
|
209
|
-
BirthDate[OptDate],
|
|
210
|
-
BirthPlace[OptStr],
|
|
211
|
-
FullName[str],
|
|
212
|
-
EndingTitle[OptStr],
|
|
213
|
-
LastName[str],
|
|
214
|
-
MiddleName[OptStr],
|
|
215
|
-
FirstName[str],
|
|
216
|
-
LeadingTitle[OptStr],
|
|
217
|
-
IdCard[OptStr],
|
|
218
|
-
IntUserId[int],
|
|
219
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
220
|
-
DataTimestamp,
|
|
221
|
-
DataIdentifier,
|
|
222
|
-
):
|
|
223
|
-
pass
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
OptUserProfileDTO = UserProfileDTO | None
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
class UserProfileDTOMixin(BaseModel):
|
|
230
|
-
profile: Annotated[OptUserProfileDTO, Field(None, description="User's Profile")] = (
|
|
231
|
-
None
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
class UserSystemRoleDTO(
|
|
236
|
-
FullSystemRoleMixin[SystemRole],
|
|
237
|
-
IntUserId[int],
|
|
238
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
239
|
-
DataTimestamp,
|
|
240
|
-
DataIdentifier,
|
|
241
|
-
):
|
|
242
|
-
pass
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
class UserSystemRolesDTOMixin(BaseModel):
|
|
246
|
-
system_roles: Annotated[
|
|
247
|
-
list[UserSystemRoleDTO],
|
|
248
|
-
Field(
|
|
249
|
-
list[UserSystemRoleDTO](),
|
|
250
|
-
description="User's system roles",
|
|
251
|
-
min_length=1,
|
|
252
|
-
),
|
|
253
|
-
] = list[UserSystemRoleDTO]()
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
class StandardUserDTO(
|
|
257
|
-
UserProfileDTOMixin,
|
|
258
|
-
Phone[str],
|
|
259
|
-
Email[str],
|
|
260
|
-
Username[str],
|
|
261
|
-
FullUserTypeMixin[UserType],
|
|
262
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
263
|
-
DataTimestamp,
|
|
264
|
-
DataIdentifier,
|
|
265
|
-
):
|
|
266
|
-
pass
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
class UserOrganizationDTO(
|
|
270
|
-
UserMedicalRolesDTOMixin,
|
|
271
|
-
UserOrganizationRolesDTOMixin,
|
|
272
|
-
OrganizationDTOMixin[StandardOrganizationDTO],
|
|
273
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
274
|
-
DataTimestamp,
|
|
275
|
-
DataIdentifier,
|
|
276
|
-
):
|
|
277
|
-
pass
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
class UserOrganizationsDTOMixin(BaseModel):
|
|
281
|
-
organizations: Annotated[
|
|
282
|
-
list[UserOrganizationDTO],
|
|
283
|
-
Field(list[UserOrganizationDTO](), description="Organizations"),
|
|
284
|
-
] = list[UserOrganizationDTO]()
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
class FullUserDTO(UserOrganizationsDTOMixin, StandardUserDTO):
|
|
288
|
-
pass
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
AnyUserDTOType = Type[StandardUserDTO] | Type[FullUserDTO]
|
|
292
|
-
AnyUserDTO = StandardUserDTO | FullUserDTO
|
|
293
|
-
AnyUserDTOT = TypeVar("AnyUserDTOT", bound=AnyUserDTO)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
class UserDTOMixin(BaseModel, Generic[AnyUserDTOT]):
|
|
297
|
-
user: Annotated[AnyUserDTOT, Field(..., description="User")]
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
class UserAndOrganizationDTO(
|
|
301
|
-
UserMedicalRolesDTOMixin,
|
|
302
|
-
UserOrganizationRolesDTOMixin,
|
|
303
|
-
OrganizationDTOMixin[StandardOrganizationDTO],
|
|
304
|
-
UserDTOMixin[StandardUserDTO],
|
|
305
|
-
SimpleDataStatusMixin[DataStatusEnum],
|
|
306
|
-
DataTimestamp,
|
|
307
|
-
DataIdentifier,
|
|
308
|
-
):
|
|
309
|
-
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|