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

@@ -2,6 +2,15 @@ from enum import StrEnum
2
2
  from maleo.types.string import ListOfStrs
3
3
 
4
4
 
5
+ class Granularity(StrEnum):
6
+ STANDARD = "standard"
7
+ FULL = "full"
8
+
9
+ @classmethod
10
+ def choices(cls) -> ListOfStrs:
11
+ return [e.value for e in cls]
12
+
13
+
5
14
  class IdentifierType(StrEnum):
6
15
  ID = "id"
7
16
  UUID = "uuid"
@@ -10,3 +19,12 @@ class IdentifierType(StrEnum):
10
19
  @classmethod
11
20
  def choices(cls) -> ListOfStrs:
12
21
  return [e.value for e in cls]
22
+
23
+
24
+ class SchemaType(StrEnum):
25
+ CORE = "core"
26
+ COMPLETE = "complete"
27
+
28
+ @classmethod
29
+ def choices(cls) -> ListOfStrs:
30
+ return [e.value for e in cls]
@@ -2,6 +2,15 @@ from enum import StrEnum
2
2
  from maleo.types.string import ListOfStrs
3
3
 
4
4
 
5
+ class Granularity(StrEnum):
6
+ STANDARD = "standard"
7
+ FULL = "full"
8
+
9
+ @classmethod
10
+ def choices(cls) -> ListOfStrs:
11
+ return [e.value for e in cls]
12
+
13
+
5
14
  class IdentifierType(StrEnum):
6
15
  ID = "id"
7
16
  UUID = "uuid"
@@ -11,3 +20,12 @@ class IdentifierType(StrEnum):
11
20
  @classmethod
12
21
  def choices(cls) -> ListOfStrs:
13
22
  return [e.value for e in cls]
23
+
24
+
25
+ class SchemaType(StrEnum):
26
+ CORE = "core"
27
+ COMPLETE = "complete"
28
+
29
+ @classmethod
30
+ def choices(cls) -> ListOfStrs:
31
+ return [e.value for e in cls]
maleo/identity/models.py CHANGED
@@ -276,7 +276,7 @@ class User(
276
276
  )
277
277
 
278
278
  @declared_attr
279
- def system_roles(cls) -> Mapped["UserSystemRole | None"]:
279
+ def system_roles(cls) -> Mapped[list["UserSystemRole"]]:
280
280
  return relationship(
281
281
  "UserSystemRole", back_populates="user", cascade="all, delete-orphan"
282
282
  )
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, Field
2
- from typing import Annotated, Generic, TypeVar
2
+ from typing import Annotated, Generic, TypeVar, Type
3
3
  from maleo.enums.identity import OptBloodType, BloodTypeMixin, OptGender, GenderMixin
4
4
  from maleo.enums.medical import MedicalRole, FullMedicalRoleMixin
5
5
  from maleo.enums.organization import (
@@ -72,6 +72,9 @@ class FullOrganizationCoreSchema(
72
72
  pass
73
73
 
74
74
 
75
+ AnyOrganizationCoreSchemaType = (
76
+ Type[StandardOrganizationCoreSchema] | Type[FullOrganizationCoreSchema]
77
+ )
75
78
  AnyOrganizationCoreSchema = StandardOrganizationCoreSchema | FullOrganizationCoreSchema
76
79
  AnyOrganizationCoreSchemaT = TypeVar(
77
80
  "AnyOrganizationCoreSchemaT", bound=AnyOrganizationCoreSchema
@@ -188,6 +191,7 @@ class FullUserCoreSchema(UserSystemRolesCoreSchemaMixin, StandardUserCoreSchema)
188
191
  pass
189
192
 
190
193
 
194
+ AnyUserCoreSchemaType = Type[StandardUserCoreSchema] | Type[FullUserCoreSchema]
191
195
  AnyUserCoreSchema = StandardUserCoreSchema | FullUserCoreSchema
192
196
  AnyUserCoreSchemaT = TypeVar("AnyUserCoreSchemaT", bound=AnyUserCoreSchema)
193
197
 
@@ -228,6 +232,18 @@ class FullUserCompleteSchema(UserOrganizationsSchemaMixin, FullUserCoreSchema):
228
232
  pass
229
233
 
230
234
 
235
+ AnyUserCompleteSchemaType = (
236
+ Type[StandardUserCompleteSchema] | Type[FullUserCompleteSchema]
237
+ )
238
+ AnyUserCompleteSchema = StandardUserCompleteSchema | FullUserCompleteSchema
239
+ AnyUserCompleteSchemaT = TypeVar("AnyUserCompleteSchemaT", bound=AnyUserCompleteSchema)
240
+
241
+
242
+ AnyUserSchemaType = AnyUserCoreSchemaType | AnyUserCompleteSchemaType
243
+ AnyUserSchema = AnyUserCoreSchema | AnyUserCompleteSchema
244
+ AnyUserSchemaT = TypeVar("AnyUserSchemaT", bound=AnyUserSchema)
245
+
246
+
231
247
  class OrganizationUserSchema(
232
248
  UserAndOrganizationSchema,
233
249
  UserCoreSchemaMixin[StandardUserCoreSchema],
@@ -255,3 +271,21 @@ class FullOrganizationCompleteSchema(
255
271
  OrganizationUsersSchemaMixin, FullOrganizationCoreSchema
256
272
  ):
257
273
  pass
274
+
275
+
276
+ AnyOrganizationCompleteSchemaType = (
277
+ Type[StandardOrganizationCompleteSchema] | Type[FullOrganizationCompleteSchema]
278
+ )
279
+ AnyOrganizationCompleteSchema = (
280
+ StandardOrganizationCompleteSchema | FullOrganizationCompleteSchema
281
+ )
282
+ AnyOrganizationCompleteSchemaT = TypeVar(
283
+ "AnyOrganizationCompleteSchemaT", bound=AnyOrganizationCompleteSchema
284
+ )
285
+
286
+
287
+ AnyOrganizationSchemaType = (
288
+ AnyOrganizationCoreSchemaType | AnyOrganizationCompleteSchemaType
289
+ )
290
+ AnyOrganizationSchema = AnyOrganizationCoreSchema | AnyOrganizationCompleteSchema
291
+ AnyOrganizationSchemaT = TypeVar("AnyOrganizationSchemaT", bound=AnyOrganizationSchema)
File without changes
@@ -0,0 +1,56 @@
1
+ from typing import Literal, Type, overload
2
+ from ..schemas.common import (
3
+ StandardOrganizationCoreSchema,
4
+ FullOrganizationCoreSchema,
5
+ StandardOrganizationCompleteSchema,
6
+ FullOrganizationCompleteSchema,
7
+ AnyOrganizationSchemaType,
8
+ )
9
+ from ..enums.organization import Granularity, SchemaType
10
+
11
+
12
+ @overload
13
+ def get_schema_model(
14
+ granularity: Literal[Granularity.STANDARD],
15
+ schema_type: Literal[SchemaType.CORE],
16
+ /,
17
+ ) -> Type[StandardOrganizationCoreSchema]: ...
18
+ @overload
19
+ def get_schema_model(
20
+ granularity: Literal[Granularity.STANDARD],
21
+ schema_type: Literal[SchemaType.COMPLETE],
22
+ /,
23
+ ) -> Type[StandardOrganizationCompleteSchema]: ...
24
+ @overload
25
+ def get_schema_model(
26
+ granularity: Literal[Granularity.FULL],
27
+ schema_type: Literal[SchemaType.CORE],
28
+ /,
29
+ ) -> Type[FullOrganizationCoreSchema]: ...
30
+ @overload
31
+ def get_schema_model(
32
+ granularity: Literal[Granularity.FULL],
33
+ schema_type: Literal[SchemaType.COMPLETE],
34
+ /,
35
+ ) -> Type[FullOrganizationCompleteSchema]: ...
36
+ @overload
37
+ def get_schema_model(
38
+ granularity: Granularity = Granularity.STANDARD,
39
+ schema_type: SchemaType = SchemaType.CORE,
40
+ /,
41
+ ) -> AnyOrganizationSchemaType: ...
42
+ def get_schema_model(
43
+ granularity: Granularity = Granularity.STANDARD,
44
+ schema_type: SchemaType = SchemaType.CORE,
45
+ /,
46
+ ) -> AnyOrganizationSchemaType:
47
+ if granularity is Granularity.STANDARD:
48
+ if schema_type is SchemaType.CORE:
49
+ return StandardOrganizationCoreSchema
50
+ elif schema_type is SchemaType.COMPLETE:
51
+ return StandardOrganizationCompleteSchema
52
+ elif granularity is Granularity.FULL:
53
+ if schema_type is SchemaType.CORE:
54
+ return FullOrganizationCoreSchema
55
+ elif schema_type is SchemaType.COMPLETE:
56
+ return FullOrganizationCompleteSchema
@@ -0,0 +1,56 @@
1
+ from typing import Literal, Type, overload
2
+ from ..schemas.common import (
3
+ StandardUserCoreSchema,
4
+ FullUserCoreSchema,
5
+ StandardUserCompleteSchema,
6
+ FullUserCompleteSchema,
7
+ AnyUserSchemaType,
8
+ )
9
+ from ..enums.user import Granularity, SchemaType
10
+
11
+
12
+ @overload
13
+ def get_schema_model(
14
+ granularity: Literal[Granularity.STANDARD],
15
+ schema_type: Literal[SchemaType.CORE],
16
+ /,
17
+ ) -> Type[StandardUserCoreSchema]: ...
18
+ @overload
19
+ def get_schema_model(
20
+ granularity: Literal[Granularity.STANDARD],
21
+ schema_type: Literal[SchemaType.COMPLETE],
22
+ /,
23
+ ) -> Type[StandardUserCompleteSchema]: ...
24
+ @overload
25
+ def get_schema_model(
26
+ granularity: Literal[Granularity.FULL],
27
+ schema_type: Literal[SchemaType.CORE],
28
+ /,
29
+ ) -> Type[FullUserCoreSchema]: ...
30
+ @overload
31
+ def get_schema_model(
32
+ granularity: Literal[Granularity.FULL],
33
+ schema_type: Literal[SchemaType.COMPLETE],
34
+ /,
35
+ ) -> Type[FullUserCompleteSchema]: ...
36
+ @overload
37
+ def get_schema_model(
38
+ granularity: Granularity = Granularity.STANDARD,
39
+ schema_type: SchemaType = SchemaType.CORE,
40
+ /,
41
+ ) -> AnyUserSchemaType: ...
42
+ def get_schema_model(
43
+ granularity: Granularity = Granularity.STANDARD,
44
+ schema_type: SchemaType = SchemaType.CORE,
45
+ /,
46
+ ) -> AnyUserSchemaType:
47
+ if granularity is Granularity.STANDARD:
48
+ if schema_type is SchemaType.CORE:
49
+ return StandardUserCoreSchema
50
+ elif schema_type is SchemaType.COMPLETE:
51
+ return StandardUserCompleteSchema
52
+ elif granularity is Granularity.FULL:
53
+ if schema_type is SchemaType.CORE:
54
+ return FullUserCoreSchema
55
+ elif schema_type is SchemaType.COMPLETE:
56
+ return FullUserCompleteSchema
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo-identity
3
- Version: 0.0.95
3
+ Version: 0.0.97
4
4
  Summary: MaleoIdentity service package
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: Proprietary
@@ -1,14 +1,14 @@
1
1
  maleo/identity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo/identity/models.py,sha256=jCDCBx0jImvFSKxZ3qoIIh5NkjDjuZuFhpACXDU9ONo,10658
2
+ maleo/identity/models.py,sha256=XqxpJxCOgnOdVriB-lrP4G1HV-WpzUWzVj3xzIkN6q0,10657
3
3
  maleo/identity/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  maleo/identity/constants/organization.py,sha256=9GXKRvYRFMIWX56VhpHw_AAuQmelwQwZT4_3hPusw7U,607
5
5
  maleo/identity/constants/organization_registration_code.py,sha256=dseUWnG3-rQv-e4d4wWpMmAHEgDLznfV1VXGMQFXM7Y,783
6
6
  maleo/identity/constants/user.py,sha256=1gUDHHaxY0i4N6Nw_JAPP6iRz1oU3-gJuCsalGP6hoM,559
7
7
  maleo/identity/constants/user_profile.py,sha256=5O8VuqJfC8ZYtXpYaLm1eFYLjpUrOOgdpTvQ8E5l5zQ,644
8
8
  maleo/identity/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- maleo/identity/enums/organization.py,sha256=asSxFs-TwJQtOZ2Xn_IEYJ8bLYAF7hnsmv-J1WgT9bY,240
9
+ maleo/identity/enums/organization.py,sha256=8Rq5N-Bkvkmf6EamRo_ETndxosz3irWAGVs3SjqdyLU,571
10
10
  maleo/identity/enums/organization_registration_code.py,sha256=ZkteIpOW6MOLEHBbmDUaRGalTlTWUIRlimz-FohBWiM,282
11
- maleo/identity/enums/user.py,sha256=fbW-F_5RqpbaFOGBf-fgX5aCHDf8Nyt-diBAzJBaEIM,270
11
+ maleo/identity/enums/user.py,sha256=3ulqp0dKddK9EqJS0J6V0d5n5Dj6IDPjtEnJyeWtZxY,601
12
12
  maleo/identity/enums/user_profile.py,sha256=LgX7Ct-MAfx7o0W8MICzpHMfDhi7wpiJfRszn6vr1zc,272
13
13
  maleo/identity/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  maleo/identity/mixins/organization.py,sha256=KMl7Zz_SXu6SvF_1fTibN2vORFGWH7P22cxS_T4KXmE,574
@@ -16,7 +16,7 @@ maleo/identity/mixins/organization_registration_code.py,sha256=G-kgdf2IzKENEyZcV
16
16
  maleo/identity/mixins/user.py,sha256=UHoMgFJXptE9x9QsR07KG2bgp5OlCNqvYjEtP9S3TIY,1054
17
17
  maleo/identity/mixins/user_profile.py,sha256=WhAEoeaqe1zmLr_s5n8Du4DXDlKFae-biXjOWHTg5I4,1667
18
18
  maleo/identity/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- maleo/identity/schemas/common.py,sha256=-QR1UjSk7onu9CHG0KKweB9Tw2_ZuAUeMtOTE-CaBPs,6590
19
+ maleo/identity/schemas/common.py,sha256=ehsu6GAOWpGiGD66zWPUyp8mriB7KKJ2ydOahNygp-k,7874
20
20
  maleo/identity/schemas/organization.py,sha256=jsic_Vh4i3OjUYFWGEhy9GkEYxJ7jlfrWCKiW7qfUFs,4544
21
21
  maleo/identity/schemas/organization_registration_code.py,sha256=iN11JSSk22Ad7OjILdRaEIV_e63K1seil-Ol9VjldTk,4444
22
22
  maleo/identity/schemas/user.py,sha256=9ay-q8wVt67esgMd07Y2HAQhg14yOHuoaDiOmhJ_rGM,4935
@@ -26,8 +26,11 @@ maleo/identity/types/organization.py,sha256=wLu9QcVDfiMke3-Smfs-LI3zV5QiMuCKkoa0
26
26
  maleo/identity/types/organization_registration_code.py,sha256=wLu9QcVDfiMke3-Smfs-LI3zV5QiMuCKkoa0CCRmh4s,93
27
27
  maleo/identity/types/user.py,sha256=wLu9QcVDfiMke3-Smfs-LI3zV5QiMuCKkoa0CCRmh4s,93
28
28
  maleo/identity/types/user_profile.py,sha256=wLu9QcVDfiMke3-Smfs-LI3zV5QiMuCKkoa0CCRmh4s,93
29
- maleo_identity-0.0.95.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
30
- maleo_identity-0.0.95.dist-info/METADATA,sha256=zAa-RsNBni146uTmL59HYfg0_Cam3zxUvEW3eC1ZCao,3546
31
- maleo_identity-0.0.95.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
- maleo_identity-0.0.95.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
33
- maleo_identity-0.0.95.dist-info/RECORD,,
29
+ maleo/identity/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
+ maleo/identity/utils/organization.py,sha256=pcx3ay5S0CjvgCHST0dJM3OykNXTQO8wr4Ium0H8_Ek,1824
31
+ maleo/identity/utils/user.py,sha256=5GjWmOnELzk2pF7gJNfGlQh9rnNI5oy9z1d9tVQp3oI,1696
32
+ maleo_identity-0.0.97.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
33
+ maleo_identity-0.0.97.dist-info/METADATA,sha256=Rfh49XxqKr2DVMcNA0UjnWSIZcALN_ejMudxPrxmfrY,3546
34
+ maleo_identity-0.0.97.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ maleo_identity-0.0.97.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
36
+ maleo_identity-0.0.97.dist-info/RECORD,,