maleo-identity 0.0.97__py3-none-any.whl → 0.0.100__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.

Files changed (57) hide show
  1. maleo/identity/constants/api_key.py +13 -0
  2. maleo/identity/constants/organization.py +0 -14
  3. maleo/identity/constants/organization_registration_code.py +0 -15
  4. maleo/identity/constants/organization_relation.py +13 -0
  5. maleo/identity/constants/patient.py +7 -0
  6. maleo/identity/constants/user.py +0 -15
  7. maleo/identity/constants/user_medical_role.py +13 -0
  8. maleo/identity/constants/user_organization_role.py +13 -0
  9. maleo/identity/constants/user_profile.py +0 -15
  10. maleo/identity/constants/user_system_role.py +13 -0
  11. maleo/identity/dtos.py +295 -0
  12. maleo/identity/enums/api_key.py +13 -0
  13. maleo/identity/enums/organization.py +5 -6
  14. maleo/identity/enums/organization_relation.py +12 -0
  15. maleo/identity/enums/patient.py +22 -0
  16. maleo/identity/enums/user.py +10 -6
  17. maleo/identity/enums/user_medical_role.py +12 -0
  18. maleo/identity/enums/user_organization_role.py +12 -0
  19. maleo/identity/enums/user_profile.py +9 -0
  20. maleo/identity/enums/user_system_role.py +12 -0
  21. maleo/identity/mixins/api_key.py +6 -0
  22. maleo/identity/mixins/common.py +29 -0
  23. maleo/identity/mixins/organization_relation.py +14 -0
  24. maleo/identity/mixins/patient.py +8 -0
  25. maleo/identity/mixins/user_profile.py +4 -21
  26. maleo/identity/models.py +89 -95
  27. maleo/identity/schemas/api_key.py +128 -0
  28. maleo/identity/schemas/common.py +152 -120
  29. maleo/identity/schemas/organization.py +39 -6
  30. maleo/identity/schemas/organization_registration_code.py +14 -5
  31. maleo/identity/schemas/organization_relation.py +178 -0
  32. maleo/identity/schemas/patient.py +234 -0
  33. maleo/identity/schemas/user.py +19 -4
  34. maleo/identity/schemas/user_medical_role.py +181 -0
  35. maleo/identity/schemas/user_organization_role.py +181 -0
  36. maleo/identity/schemas/user_profile.py +68 -10
  37. maleo/identity/schemas/user_system_role.py +174 -0
  38. maleo/identity/types/api_key.py +7 -0
  39. maleo/identity/types/organization.py +1 -2
  40. maleo/identity/types/organization_registration_code.py +1 -2
  41. maleo/identity/types/organization_relation.py +7 -0
  42. maleo/identity/types/patient.py +4 -0
  43. maleo/identity/types/user.py +1 -2
  44. maleo/identity/types/user_medical_role.py +7 -0
  45. maleo/identity/types/user_organization_role.py +7 -0
  46. maleo/identity/types/user_profile.py +1 -2
  47. maleo/identity/types/user_system_role.py +7 -0
  48. maleo/identity/utils/organization.py +33 -27
  49. maleo/identity/utils/user.py +33 -27
  50. maleo/identity/validators/__init__.py +0 -0
  51. maleo/identity/validators/patient.py +6 -0
  52. {maleo_identity-0.0.97.dist-info → maleo_identity-0.0.100.dist-info}/METADATA +8 -7
  53. maleo_identity-0.0.100.dist-info/RECORD +67 -0
  54. maleo_identity-0.0.97.dist-info/RECORD +0 -36
  55. {maleo_identity-0.0.97.dist-info → maleo_identity-0.0.100.dist-info}/WHEEL +0 -0
  56. {maleo_identity-0.0.97.dist-info → maleo_identity-0.0.100.dist-info}/licenses/LICENSE +0 -0
  57. {maleo_identity-0.0.97.dist-info → maleo_identity-0.0.100.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,13 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ API_KEY_RESOURCE = Resource(
5
+ identifiers=[
6
+ ResourceIdentifier(
7
+ key="api_keys",
8
+ name="API Keys",
9
+ slug="api-keys",
10
+ )
11
+ ],
12
+ details=None,
13
+ )
@@ -1,18 +1,4 @@
1
- from typing import Callable, Dict
2
- from uuid import UUID
3
1
  from maleo.schemas.resource import Resource, ResourceIdentifier
4
- from ..enums.organization import IdentifierType
5
- from ..types.organization import IdentifierValueType
6
-
7
-
8
- IDENTIFIER_VALUE_TYPE_MAP: Dict[
9
- IdentifierType,
10
- Callable[..., IdentifierValueType],
11
- ] = {
12
- IdentifierType.ID: int,
13
- IdentifierType.UUID: UUID,
14
- IdentifierType.KEY: str,
15
- }
16
2
 
17
3
 
18
4
  ORGANIZATION_RESOURCE = Resource(
@@ -1,19 +1,4 @@
1
- from typing import Callable, Dict
2
- from uuid import UUID
3
1
  from maleo.schemas.resource import Resource, ResourceIdentifier
4
- from ..enums.organization_registration_code import IdentifierType
5
- from ..types.organization_registration_code import IdentifierValueType
6
-
7
-
8
- IDENTIFIER_VALUE_TYPE_MAP: Dict[
9
- IdentifierType,
10
- Callable[..., IdentifierValueType],
11
- ] = {
12
- IdentifierType.ID: int,
13
- IdentifierType.UUID: UUID,
14
- IdentifierType.ORGANIZATION_ID: int,
15
- IdentifierType.CODE: UUID,
16
- }
17
2
 
18
3
 
19
4
  ORGANIZATION_REGISTRATION_CODE_RESOURCE = Resource(
@@ -0,0 +1,13 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ ORGANIZATION_RELATION_RESOURCE = Resource(
5
+ identifiers=[
6
+ ResourceIdentifier(
7
+ key="organization_relations",
8
+ name="Organization Relations",
9
+ slug="organization-relations",
10
+ )
11
+ ],
12
+ details=None,
13
+ )
@@ -0,0 +1,7 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ PATIENT_RESOURCE = Resource(
5
+ identifiers=[ResourceIdentifier(key="patients", name="Patients", slug="patients")],
6
+ details=None,
7
+ )
@@ -1,19 +1,4 @@
1
- from typing import Callable, Dict
2
- from uuid import UUID
3
1
  from maleo.schemas.resource import Resource, ResourceIdentifier
4
- from ..enums.user import IdentifierType
5
- from ..types.user import IdentifierValueType
6
-
7
-
8
- IDENTIFIER_VALUE_TYPE_MAP: Dict[
9
- IdentifierType,
10
- Callable[..., IdentifierValueType],
11
- ] = {
12
- IdentifierType.ID: int,
13
- IdentifierType.UUID: UUID,
14
- IdentifierType.EMAIL: str,
15
- IdentifierType.USERNAME: str,
16
- }
17
2
 
18
3
 
19
4
  USER_RESOURCE = Resource(
@@ -0,0 +1,13 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ USER_MEDICAL_ROLE_RESOURCE = Resource(
5
+ identifiers=[
6
+ ResourceIdentifier(
7
+ key="user_medical_roles",
8
+ name="User Medical Roles",
9
+ slug="user-medical-roles",
10
+ )
11
+ ],
12
+ details=None,
13
+ )
@@ -0,0 +1,13 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ USER_ORGANIZATION_ROLE_RESOURCE = Resource(
5
+ identifiers=[
6
+ ResourceIdentifier(
7
+ key="user_organization_roles",
8
+ name="User Organization Roles",
9
+ slug="user-organization-roles",
10
+ )
11
+ ],
12
+ details=None,
13
+ )
@@ -1,19 +1,4 @@
1
- from typing import Callable, Dict
2
- from uuid import UUID
3
1
  from maleo.schemas.resource import Resource, ResourceIdentifier
4
- from ..enums.user_profile import IdentifierType
5
- from ..types.user_profile import IdentifierValueType
6
-
7
-
8
- IDENTIFIER_VALUE_TYPE_MAP: Dict[
9
- IdentifierType,
10
- Callable[..., IdentifierValueType],
11
- ] = {
12
- IdentifierType.ID: int,
13
- IdentifierType.UUID: UUID,
14
- IdentifierType.USER_ID: int,
15
- IdentifierType.ID_CARD: str,
16
- }
17
2
 
18
3
 
19
4
  USER_PROFILE_RESOURCE = Resource(
@@ -0,0 +1,13 @@
1
+ from maleo.schemas.resource import Resource, ResourceIdentifier
2
+
3
+
4
+ USER_SYSTEM_ROLE_RESOURCE = Resource(
5
+ identifiers=[
6
+ ResourceIdentifier(
7
+ key="user_system_roles",
8
+ name="User System Roles",
9
+ slug="user-system-roles",
10
+ )
11
+ ],
12
+ details=None,
13
+ )
maleo/identity/dtos.py ADDED
@@ -0,0 +1,295 @@
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
+ IntSourceId,
30
+ IntTargetId,
31
+ )
32
+ from maleo.schemas.mixins.timestamp import DataTimestamp
33
+ from maleo.types.datetime import OptDate
34
+ from maleo.types.string import OptStr
35
+ from .mixins.common import IdCard, FullName, BirthPlace, PlaceOfBirth
36
+ from .mixins.organization_registration_code import Code, MaxUses, CurrentUses
37
+ from .mixins.organization_relation import IsBidirectional, Metadata
38
+ from .mixins.organization import Key as OrganizationKey, Name as OrganizationName
39
+ from .mixins.patient import Passport
40
+ from .mixins.user_profile import (
41
+ LeadingTitle,
42
+ FirstName,
43
+ MiddleName,
44
+ LastName,
45
+ EndingTitle,
46
+ AvatarName,
47
+ )
48
+ from .mixins.user import Username, Email, Phone
49
+ from .validators.patient import validate_id_card_or_passport
50
+
51
+
52
+ class PatientDTO(
53
+ RhesusMixin[OptRhesus],
54
+ BloodTypeMixin[OptBloodType],
55
+ GenderMixin[Gender],
56
+ DateOfBirth[date],
57
+ PlaceOfBirth[OptStr],
58
+ FullName[str],
59
+ Passport[OptStr],
60
+ IdCard[OptStr],
61
+ IntOrganizationId[int],
62
+ SimpleDataStatusMixin[DataStatusEnum],
63
+ DataTimestamp,
64
+ DataIdentifier,
65
+ ):
66
+ @model_validator(mode="after")
67
+ def chk_id_card_or_passport(self) -> Self:
68
+ validate_id_card_or_passport(self.id_card, self.passport)
69
+ return self
70
+
71
+
72
+ class OrganizationRegistrationCodeDTO(
73
+ CurrentUses,
74
+ MaxUses[int],
75
+ Code[str],
76
+ IntOrganizationId[int],
77
+ SimpleDataStatusMixin[DataStatusEnum],
78
+ DataTimestamp,
79
+ DataIdentifier,
80
+ ):
81
+ pass
82
+
83
+
84
+ OptOrganizationRegistrationCodeDTO = OrganizationRegistrationCodeDTO | None
85
+
86
+
87
+ class OrganizationRegistrationCodeDTOMixin(BaseModel):
88
+ registration_code: Annotated[
89
+ OptOrganizationRegistrationCodeDTO,
90
+ Field(None, description="Organization's registration code"),
91
+ ] = None
92
+
93
+
94
+ class StandardOrganizationDTO(
95
+ OrganizationName[str],
96
+ OrganizationKey[str],
97
+ FullOrganizationTypeMixin[OrganizationType],
98
+ SimpleDataStatusMixin[DataStatusEnum],
99
+ DataTimestamp,
100
+ DataIdentifier,
101
+ ):
102
+ pass
103
+
104
+
105
+ class SourceOrganizationDTOMixin(BaseModel):
106
+ source: Annotated[
107
+ StandardOrganizationDTO, Field(..., description="Source organization")
108
+ ]
109
+
110
+
111
+ class TargetOrganizationDTOMixin(BaseModel):
112
+ target: Annotated[
113
+ StandardOrganizationDTO, Field(..., description="Target organization")
114
+ ]
115
+
116
+
117
+ class OrganizationRelationDTO(
118
+ Metadata,
119
+ IsBidirectional[bool],
120
+ TargetOrganizationDTOMixin,
121
+ IntTargetId[int],
122
+ SourceOrganizationDTOMixin,
123
+ IntSourceId[int],
124
+ SimpleDataStatusMixin[DataStatusEnum],
125
+ DataTimestamp,
126
+ DataIdentifier,
127
+ ):
128
+ pass
129
+
130
+
131
+ class OrganizationRelationsDTOMixin(BaseModel):
132
+ relations: Annotated[
133
+ list[OrganizationRelationDTO],
134
+ Field(list[OrganizationRelationDTO](), description="Relations"),
135
+ ] = list[OrganizationRelationDTO]()
136
+
137
+
138
+ class FullOrganizationDTO(
139
+ OrganizationRelationsDTOMixin,
140
+ OrganizationRegistrationCodeDTOMixin,
141
+ StandardOrganizationDTO,
142
+ ):
143
+ pass
144
+
145
+
146
+ AnyOrganizationDTOType = Type[StandardOrganizationDTO] | Type[FullOrganizationDTO]
147
+ AnyOrganizationDTO = StandardOrganizationDTO | FullOrganizationDTO
148
+ AnyOrganizationDTOT = TypeVar("AnyOrganizationDTOT", bound=AnyOrganizationDTO)
149
+
150
+
151
+ class OrganizationDTOMixin(BaseModel, Generic[AnyOrganizationDTOT]):
152
+ organization: Annotated[AnyOrganizationDTOT, Field(..., description="Organization")]
153
+
154
+
155
+ class UserMedicalRoleDTO(
156
+ FullMedicalRoleMixin[MedicalRole],
157
+ IntOrganizationId[int],
158
+ IntUserId[int],
159
+ SimpleDataStatusMixin[DataStatusEnum],
160
+ DataTimestamp,
161
+ DataIdentifier,
162
+ ):
163
+ pass
164
+
165
+
166
+ class UserMedicalRolesDTOMixin(BaseModel):
167
+ medical_roles: Annotated[
168
+ list[UserMedicalRoleDTO],
169
+ Field(list[UserMedicalRoleDTO](), description="Medical roles"),
170
+ ] = list[UserMedicalRoleDTO]()
171
+
172
+
173
+ class UserOrganizationRoleDTO(
174
+ FullOrganizationRoleMixin[OrganizationRole],
175
+ IntOrganizationId[int],
176
+ IntUserId[int],
177
+ SimpleDataStatusMixin[DataStatusEnum],
178
+ DataTimestamp,
179
+ DataIdentifier,
180
+ ):
181
+ pass
182
+
183
+
184
+ class UserOrganizationRolesDTOMixin(BaseModel):
185
+ organization_roles: Annotated[
186
+ list[UserOrganizationRoleDTO],
187
+ Field(list[UserOrganizationRoleDTO](), description="Organization roles"),
188
+ ] = list[UserOrganizationRoleDTO]()
189
+
190
+
191
+ class UserProfileDTO(
192
+ AvatarName[str],
193
+ BloodTypeMixin[OptBloodType],
194
+ GenderMixin[OptGender],
195
+ BirthDate[OptDate],
196
+ BirthPlace[OptStr],
197
+ FullName[str],
198
+ EndingTitle[OptStr],
199
+ LastName[str],
200
+ MiddleName[OptStr],
201
+ FirstName[str],
202
+ LeadingTitle[OptStr],
203
+ IdCard[OptStr],
204
+ IntUserId[int],
205
+ SimpleDataStatusMixin[DataStatusEnum],
206
+ DataTimestamp,
207
+ DataIdentifier,
208
+ ):
209
+ pass
210
+
211
+
212
+ OptUserProfileDTO = UserProfileDTO | None
213
+
214
+
215
+ class UserProfileDTOMixin(BaseModel):
216
+ profile: Annotated[OptUserProfileDTO, Field(None, description="User's Profile")] = (
217
+ None
218
+ )
219
+
220
+
221
+ class UserSystemRoleDTO(
222
+ FullSystemRoleMixin[SystemRole],
223
+ IntUserId[int],
224
+ SimpleDataStatusMixin[DataStatusEnum],
225
+ DataTimestamp,
226
+ DataIdentifier,
227
+ ):
228
+ pass
229
+
230
+
231
+ class UserSystemRolesDTOMixin(BaseModel):
232
+ system_roles: Annotated[
233
+ list[UserSystemRoleDTO],
234
+ Field(
235
+ list[UserSystemRoleDTO](),
236
+ description="User's system roles",
237
+ min_length=1,
238
+ ),
239
+ ] = list[UserSystemRoleDTO]()
240
+
241
+
242
+ class StandardUserDTO(
243
+ UserProfileDTOMixin,
244
+ Phone[str],
245
+ Email[str],
246
+ Username[str],
247
+ FullUserTypeMixin[UserType],
248
+ SimpleDataStatusMixin[DataStatusEnum],
249
+ DataTimestamp,
250
+ DataIdentifier,
251
+ ):
252
+ pass
253
+
254
+
255
+ class UserOrganizationDTO(
256
+ UserMedicalRolesDTOMixin,
257
+ UserOrganizationRolesDTOMixin,
258
+ OrganizationDTOMixin[StandardOrganizationDTO],
259
+ SimpleDataStatusMixin[DataStatusEnum],
260
+ DataTimestamp,
261
+ DataIdentifier,
262
+ ):
263
+ pass
264
+
265
+
266
+ class UserOrganizationsDTOMixin(BaseModel):
267
+ organizations: Annotated[
268
+ list[UserOrganizationDTO],
269
+ Field(list[UserOrganizationDTO](), description="Organizations"),
270
+ ] = list[UserOrganizationDTO]()
271
+
272
+
273
+ class FullUserDTO(UserOrganizationsDTOMixin, StandardUserDTO):
274
+ pass
275
+
276
+
277
+ AnyUserDTOType = Type[StandardUserDTO] | Type[FullUserDTO]
278
+ AnyUserDTO = StandardUserDTO | FullUserDTO
279
+ AnyUserDTOT = TypeVar("AnyUserDTOT", bound=AnyUserDTO)
280
+
281
+
282
+ class UserDTOMixin(BaseModel, Generic[AnyUserDTOT]):
283
+ user: Annotated[AnyUserDTOT, Field(..., description="User")]
284
+
285
+
286
+ class UserAndOrganizationDTO(
287
+ UserMedicalRolesDTOMixin,
288
+ UserOrganizationRolesDTOMixin,
289
+ OrganizationDTOMixin[StandardOrganizationDTO],
290
+ UserDTOMixin[StandardUserDTO],
291
+ SimpleDataStatusMixin[DataStatusEnum],
292
+ DataTimestamp,
293
+ DataIdentifier,
294
+ ):
295
+ pass
@@ -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
+ API_KEY = "api_key"
9
+ COMPOSITE = "composite"
10
+
11
+ @classmethod
12
+ def choices(cls) -> ListOfStrs:
13
+ return [e.value for e in cls]
@@ -21,10 +21,9 @@ class IdentifierType(StrEnum):
21
21
  return [e.value for e in cls]
22
22
 
23
23
 
24
- class SchemaType(StrEnum):
25
- CORE = "core"
26
- COMPLETE = "complete"
24
+ class ExpandableField(StrEnum):
25
+ ORGANIZATION_TYPE = "organization_type"
27
26
 
28
- @classmethod
29
- def choices(cls) -> ListOfStrs:
30
- return [e.value for e in cls]
27
+
28
+ ListOfExpandableFields = list[ExpandableField]
29
+ OptListOfExpandableFields = ListOfExpandableFields | None
@@ -0,0 +1,12 @@
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
+ COMPOSITE = "composite"
9
+
10
+ @classmethod
11
+ def choices(cls) -> ListOfStrs:
12
+ return [e.value for e in cls]
@@ -0,0 +1,22 @@
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]
14
+
15
+
16
+ class ExpandableField(StrEnum):
17
+ GENDER = "gender"
18
+ BLOOD_TYPE = "blood_type"
19
+
20
+
21
+ ListOfExpandableFields = list[ExpandableField]
22
+ OptListOfExpandableFields = ListOfExpandableFields | None
@@ -22,10 +22,14 @@ class IdentifierType(StrEnum):
22
22
  return [e.value for e in cls]
23
23
 
24
24
 
25
- class SchemaType(StrEnum):
26
- CORE = "core"
27
- COMPLETE = "complete"
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"
28
32
 
29
- @classmethod
30
- def choices(cls) -> ListOfStrs:
31
- return [e.value for e in cls]
33
+
34
+ ListOfExpandableFields = list[ExpandableField]
35
+ OptListOfExpandableFields = ListOfExpandableFields | None
@@ -0,0 +1,12 @@
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
+ COMPOSITE = "composite"
9
+
10
+ @classmethod
11
+ def choices(cls) -> ListOfStrs:
12
+ return [e.value for e in cls]
@@ -0,0 +1,12 @@
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
+ COMPOSITE = "composite"
9
+
10
+ @classmethod
11
+ def choices(cls) -> ListOfStrs:
12
+ return [e.value for e in cls]
@@ -11,3 +11,12 @@ 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
@@ -0,0 +1,12 @@
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
+ COMPOSITE = "composite"
9
+
10
+ @classmethod
11
+ def choices(cls) -> ListOfStrs:
12
+ return [e.value for e in cls]
@@ -0,0 +1,6 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Annotated
3
+
4
+
5
+ class APIKey(BaseModel):
6
+ api_key: Annotated[str, Field(..., description="API Key", max_length=255)]
@@ -0,0 +1,29 @@
1
+ from pydantic import Field
2
+ from typing import Annotated, Generic
3
+ from maleo.schemas.mixins.identity import (
4
+ IdCard as BaseIdCard,
5
+ FullName as BaseFullName,
6
+ BirthPlace as BaseBirthPlace,
7
+ PlaceOfBirth as BasePlaceOfBirth,
8
+ )
9
+ from maleo.types.string import OptStrT
10
+
11
+
12
+ class IdCard(BaseIdCard[OptStrT], Generic[OptStrT]):
13
+ id_card: Annotated[OptStrT, Field(..., description="Id Card", max_length=16)]
14
+
15
+
16
+ class FullName(BaseFullName[OptStrT], Generic[OptStrT]):
17
+ full_name: Annotated[OptStrT, Field(..., description="Full Name", max_length=200)]
18
+
19
+
20
+ class BirthPlace(BaseBirthPlace[OptStrT], Generic[OptStrT]):
21
+ birth_place: Annotated[
22
+ OptStrT, Field(..., description="Birth Place", max_length=50)
23
+ ]
24
+
25
+
26
+ class PlaceOfBirth(BasePlaceOfBirth[OptStrT], Generic[OptStrT]):
27
+ place_of_birth: Annotated[
28
+ OptStrT, Field(..., description="Place of Birth", max_length=50)
29
+ ]
@@ -0,0 +1,14 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Annotated, Generic
3
+ from maleo.types.boolean import OptBoolT
4
+ from maleo.types.misc import OptListOfAnyOrStrToAnyDict
5
+
6
+
7
+ class IsBidirectional(BaseModel, Generic[OptBoolT]):
8
+ is_bidirectional: Annotated[OptBoolT, Field(..., description="Is Bidirectional")]
9
+
10
+
11
+ class Metadata(BaseModel):
12
+ metadata: Annotated[
13
+ OptListOfAnyOrStrToAnyDict, Field(None, description="Metadata")
14
+ ] = None
@@ -0,0 +1,8 @@
1
+ from pydantic import Field
2
+ from typing import Annotated, Generic
3
+ from maleo.schemas.mixins.identity import Passport as BasePassport
4
+ from maleo.types.string import OptStrT
5
+
6
+
7
+ class Passport(BasePassport, Generic[OptStrT]):
8
+ passport: Annotated[OptStrT, Field(..., description="Passport", max_length=9)]