maleo-identity 0.0.95__tar.gz → 0.0.97__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.

Files changed (43) hide show
  1. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/PKG-INFO +1 -1
  2. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/maleo_identity.egg-info/PKG-INFO +1 -1
  3. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/maleo_identity.egg-info/SOURCES.txt +4 -1
  4. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/pyproject.toml +5 -2
  5. maleo_identity-0.0.97/src/enums/organization.py +30 -0
  6. maleo_identity-0.0.97/src/enums/user.py +31 -0
  7. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/models.py +1 -1
  8. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/common.py +35 -1
  9. maleo_identity-0.0.97/src/utils/__init__.py +0 -0
  10. maleo_identity-0.0.97/src/utils/organization.py +56 -0
  11. maleo_identity-0.0.97/src/utils/user.py +56 -0
  12. maleo_identity-0.0.95/src/enums/organization.py +0 -12
  13. maleo_identity-0.0.95/src/enums/user.py +0 -13
  14. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/LICENSE +0 -0
  15. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/README.md +0 -0
  16. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/maleo_identity.egg-info/dependency_links.txt +0 -0
  17. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/maleo_identity.egg-info/requires.txt +0 -0
  18. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/maleo_identity.egg-info/top_level.txt +0 -0
  19. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/setup.cfg +0 -0
  20. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/__init__.py +0 -0
  21. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/constants/__init__.py +0 -0
  22. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/constants/organization.py +0 -0
  23. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/constants/organization_registration_code.py +0 -0
  24. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/constants/user.py +0 -0
  25. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/constants/user_profile.py +0 -0
  26. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/enums/__init__.py +0 -0
  27. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/enums/organization_registration_code.py +0 -0
  28. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/enums/user_profile.py +0 -0
  29. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/mixins/__init__.py +0 -0
  30. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/mixins/organization.py +0 -0
  31. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/mixins/organization_registration_code.py +0 -0
  32. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/mixins/user.py +0 -0
  33. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/mixins/user_profile.py +0 -0
  34. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/__init__.py +0 -0
  35. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/organization.py +0 -0
  36. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/organization_registration_code.py +0 -0
  37. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/user.py +0 -0
  38. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/schemas/user_profile.py +0 -0
  39. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/types/__init__.py +0 -0
  40. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/types/organization.py +0 -0
  41. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/types/organization_registration_code.py +0 -0
  42. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/types/user.py +0 -0
  43. {maleo_identity-0.0.95 → maleo_identity-0.0.97}/src/types/user_profile.py +0 -0
@@ -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,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
@@ -33,4 +33,7 @@ src/types/__init__.py
33
33
  src/types/organization.py
34
34
  src/types/organization_registration_code.py
35
35
  src/types/user.py
36
- src/types/user_profile.py
36
+ src/types/user_profile.py
37
+ src/utils/__init__.py
38
+ src/utils/organization.py
39
+ src/utils/user.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo-identity" # PyPI package name
7
- version = "0.0.95"
7
+ version = "0.0.97"
8
8
  description = "MaleoIdentity service package"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
@@ -101,6 +101,7 @@ packages = [
101
101
  "maleo.identity.mixins",
102
102
  "maleo.identity.schemas",
103
103
  "maleo.identity.types",
104
+ "maleo.identity.utils",
104
105
  ]
105
106
 
106
107
  [tool.setuptools.package-data]
@@ -110,6 +111,7 @@ packages = [
110
111
  "maleo.identity.mixins" = ["*.json", "*.yaml"]
111
112
  "maleo.identity.schemas" = ["*.json", "*.yaml"]
112
113
  "maleo.identity.types" = ["*.json", "*.yaml"]
114
+ "maleo.identity.utils" = ["*.json", "*.yaml"]
113
115
 
114
116
  [tool.setuptools.package-dir]
115
117
  "maleo.identity" = "src"
@@ -117,4 +119,5 @@ packages = [
117
119
  "maleo.identity.enums" = "src/enums"
118
120
  "maleo.identity.mixins" = "src/mixins"
119
121
  "maleo.identity.schemas" = "src/schemas"
120
- "maleo.identity.types" = "src/types"
122
+ "maleo.identity.types" = "src/types"
123
+ "maleo.identity.utils" = "src/utils"
@@ -0,0 +1,30 @@
1
+ from enum import StrEnum
2
+ from maleo.types.string import ListOfStrs
3
+
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
+
14
+ class IdentifierType(StrEnum):
15
+ ID = "id"
16
+ UUID = "uuid"
17
+ KEY = "key"
18
+
19
+ @classmethod
20
+ def choices(cls) -> ListOfStrs:
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]
@@ -0,0 +1,31 @@
1
+ from enum import StrEnum
2
+ from maleo.types.string import ListOfStrs
3
+
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
+
14
+ class IdentifierType(StrEnum):
15
+ ID = "id"
16
+ UUID = "uuid"
17
+ USERNAME = "username"
18
+ EMAIL = "email"
19
+
20
+ @classmethod
21
+ def choices(cls) -> ListOfStrs:
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]
@@ -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,12 +0,0 @@
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
- KEY = "key"
9
-
10
- @classmethod
11
- def choices(cls) -> ListOfStrs:
12
- return [e.value for e in cls]
@@ -1,13 +0,0 @@
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
- USERNAME = "username"
9
- EMAIL = "email"
10
-
11
- @classmethod
12
- def choices(cls) -> ListOfStrs:
13
- return [e.value for e in cls]
File without changes