maleo-identity 0.1.10__py3-none-any.whl → 0.1.12__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.
@@ -1,4 +1,5 @@
1
1
  from maleo.schemas.resource import Resource, ResourceIdentifier
2
+ from maleo.types.string import DoubleStrs
2
3
 
3
4
 
4
5
  USER_SYSTEM_ROLE_RESOURCE = Resource(
@@ -11,3 +12,6 @@ USER_SYSTEM_ROLE_RESOURCE = Resource(
11
12
  ],
12
13
  details=None,
13
14
  )
15
+
16
+
17
+ COMPOSITE_COLUMS: DoubleStrs = ("user_id", "system_role")
@@ -1,5 +1,5 @@
1
1
  from enum import StrEnum
2
- from maleo.types.string import ListOfStrs
2
+ from maleo.types.string import ListOfStrs, ManyStrs
3
3
 
4
4
 
5
5
  class IdentifierType(StrEnum):
@@ -11,3 +11,15 @@ class IdentifierType(StrEnum):
11
11
  @classmethod
12
12
  def choices(cls) -> ListOfStrs:
13
13
  return [e.value for e in cls]
14
+
15
+ @property
16
+ def columns(self) -> ManyStrs:
17
+ if self is IdentifierType.ID:
18
+ return ("id",)
19
+ elif self is IdentifierType.UUID:
20
+ return ("uuid",)
21
+ elif self is IdentifierType.API_KEY:
22
+ return ("api_key",)
23
+ elif self is IdentifierType.COMPOSITE:
24
+ return ("user_id", "organization_id")
25
+ raise ValueError(f"Unknown column(s) for identifier type: {self}")
@@ -1,5 +1,5 @@
1
1
  from enum import StrEnum
2
- from maleo.types.string import ListOfStrs
2
+ from maleo.types.string import ListOfStrs, ManyStrs
3
3
 
4
4
 
5
5
  class IdentifierType(StrEnum):
@@ -10,3 +10,13 @@ class IdentifierType(StrEnum):
10
10
  @classmethod
11
11
  def choices(cls) -> ListOfStrs:
12
12
  return [e.value for e in cls]
13
+
14
+ @property
15
+ def columns(self) -> ManyStrs:
16
+ if self is IdentifierType.ID:
17
+ return ("id",)
18
+ elif self is IdentifierType.UUID:
19
+ return ("uuid",)
20
+ elif self is IdentifierType.COMPOSITE:
21
+ return ("source_id", "target_id", "relation")
22
+ raise ValueError(f"Unknown column(s) for identifier type: {self}")
@@ -1,5 +1,5 @@
1
1
  from enum import StrEnum
2
- from maleo.types.string import ListOfStrs
2
+ from maleo.types.string import ListOfStrs, ManyStrs
3
3
 
4
4
 
5
5
  class IdentifierType(StrEnum):
@@ -10,3 +10,13 @@ class IdentifierType(StrEnum):
10
10
  @classmethod
11
11
  def choices(cls) -> ListOfStrs:
12
12
  return [e.value for e in cls]
13
+
14
+ @property
15
+ def columns(self) -> ManyStrs:
16
+ if self is IdentifierType.ID:
17
+ return ("id",)
18
+ elif self is IdentifierType.UUID:
19
+ return ("uuid",)
20
+ elif self is IdentifierType.COMPOSITE:
21
+ return ("user_id", "organization_id", "medical_role")
22
+ raise ValueError(f"Unknown column(s) for identifier type: {self}")
@@ -1,5 +1,5 @@
1
1
  from enum import StrEnum
2
- from maleo.types.string import ListOfStrs
2
+ from maleo.types.string import ListOfStrs, ManyStrs
3
3
 
4
4
 
5
5
  class IdentifierType(StrEnum):
@@ -10,3 +10,13 @@ class IdentifierType(StrEnum):
10
10
  @classmethod
11
11
  def choices(cls) -> ListOfStrs:
12
12
  return [e.value for e in cls]
13
+
14
+ @property
15
+ def columns(self) -> ManyStrs:
16
+ if self is IdentifierType.ID:
17
+ return ("id",)
18
+ elif self is IdentifierType.UUID:
19
+ return ("uuid",)
20
+ elif self is IdentifierType.COMPOSITE:
21
+ return ("user_id", "organization_id", "organization_role")
22
+ raise ValueError(f"Unknown column(s) for identifier type: {self}")
@@ -1,5 +1,5 @@
1
1
  from enum import StrEnum
2
- from maleo.types.string import ListOfStrs
2
+ from maleo.types.string import ListOfStrs, ManyStrs
3
3
 
4
4
 
5
5
  class IdentifierType(StrEnum):
@@ -10,3 +10,13 @@ class IdentifierType(StrEnum):
10
10
  @classmethod
11
11
  def choices(cls) -> ListOfStrs:
12
12
  return [e.value for e in cls]
13
+
14
+ @property
15
+ def columns(self) -> ManyStrs:
16
+ if self is IdentifierType.ID:
17
+ return ("id",)
18
+ elif self is IdentifierType.UUID:
19
+ return ("uuid",)
20
+ elif self is IdentifierType.COMPOSITE:
21
+ return ("user_id", "system_role")
22
+ raise ValueError(f"Unknown column(s) for identifier type: {self}")
@@ -2,6 +2,8 @@ from pydantic import BaseModel, Field
2
2
  from typing import Annotated, Literal, TypeGuard
3
3
  from uuid import UUID
4
4
  from maleo.schemas.mixins.identity import Identifier
5
+ from maleo.types.any import ManyAny
6
+ from maleo.types.string import ManyStrs
5
7
  from ..enums.api_key import IdentifierType
6
8
  from ..types.api_key import CompositeIdentifier, IdentifierValueType
7
9
 
@@ -11,7 +13,10 @@ class APIKey(BaseModel):
11
13
 
12
14
 
13
15
  class APIKeyIdentifier(Identifier[IdentifierType, IdentifierValueType]):
14
- pass
16
+ @property
17
+ def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
18
+ values = self.value if isinstance(self.value, tuple) else (self.value,)
19
+ return self.type.columns, values
15
20
 
16
21
 
17
22
  class IdAPIKeyIdentifier(Identifier[Literal[IdentifierType.ID], int]):
@@ -2,8 +2,10 @@ from pydantic import BaseModel, Field
2
2
  from typing import Annotated, Generic, Literal, TypeGuard
3
3
  from uuid import UUID
4
4
  from maleo.schemas.mixins.identity import Identifier
5
+ from maleo.types.any import ManyAny
5
6
  from maleo.types.boolean import OptBoolT
6
7
  from maleo.types.misc import OptListOfAnyOrStrToAnyDict
8
+ from maleo.types.string import ManyStrs
7
9
  from ..enums.organization_relation import IdentifierType
8
10
  from ..types.organization_relation import CompositeIdentifier, IdentifierValueType
9
11
 
@@ -17,7 +19,10 @@ class Meta(BaseModel):
17
19
 
18
20
 
19
21
  class OrganizationRelationIdentifier(Identifier[IdentifierType, IdentifierValueType]):
20
- pass
22
+ @property
23
+ def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
24
+ values = self.value if isinstance(self.value, tuple) else (self.value,)
25
+ return self.type.columns, values
21
26
 
22
27
 
23
28
  class IdOrganizationRelationIdentifier(Identifier[Literal[IdentifierType.ID], int]):
@@ -2,12 +2,17 @@ from pydantic import Field
2
2
  from typing import Annotated, Literal, TypeGuard
3
3
  from uuid import UUID
4
4
  from maleo.schemas.mixins.identity import Identifier
5
+ from maleo.types.any import ManyAny
6
+ from maleo.types.string import ManyStrs
5
7
  from ..enums.user_medical_role import IdentifierType
6
8
  from ..types.user_medical_role import CompositeIdentifier, IdentifierValueType
7
9
 
8
10
 
9
11
  class UserMedicalRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
10
- pass
12
+ @property
13
+ def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
14
+ values = self.value if isinstance(self.value, tuple) else (self.value,)
15
+ return self.type.columns, values
11
16
 
12
17
 
13
18
  class IdUserMedicalRoleIdentifier(Identifier[Literal[IdentifierType.ID], int]):
@@ -2,12 +2,17 @@ from pydantic import Field
2
2
  from typing import Annotated, Literal, TypeGuard
3
3
  from uuid import UUID
4
4
  from maleo.schemas.mixins.identity import Identifier
5
+ from maleo.types.any import ManyAny
6
+ from maleo.types.string import ManyStrs
5
7
  from ..enums.user_organization_role import IdentifierType
6
8
  from ..types.user_organization_role import CompositeIdentifier, IdentifierValueType
7
9
 
8
10
 
9
11
  class UserOrganizationRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
10
- pass
12
+ @property
13
+ def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
14
+ values = self.value if isinstance(self.value, tuple) else (self.value,)
15
+ return self.type.columns, values
11
16
 
12
17
 
13
18
  class IdUserOrganizationRoleIdentifier(Identifier[Literal[IdentifierType.ID], int]):
@@ -2,12 +2,17 @@ from pydantic import Field
2
2
  from typing import Annotated, Literal, TypeGuard
3
3
  from uuid import UUID
4
4
  from maleo.schemas.mixins.identity import Identifier
5
+ from maleo.types.any import ManyAny
6
+ from maleo.types.string import ManyStrs
5
7
  from ..enums.user_system_role import IdentifierType
6
8
  from ..types.user_system_role import CompositeIdentifier, IdentifierValueType
7
9
 
8
10
 
9
11
  class UserSystemRoleIdentifier(Identifier[IdentifierType, IdentifierValueType]):
10
- pass
12
+ @property
13
+ def columns_and_values(self) -> tuple[ManyStrs, ManyAny]:
14
+ values = self.value if isinstance(self.value, tuple) else (self.value,)
15
+ return self.type.columns, values
11
16
 
12
17
 
13
18
  class IdUserSystemRoleIdentifier(Identifier[Literal[IdentifierType.ID], int]):
maleo/identity/models.py CHANGED
@@ -58,6 +58,11 @@ class Patient(
58
58
  DataIdentifier,
59
59
  ):
60
60
  __tablename__ = "patients"
61
+ user_id: Mapped[int] = mapped_column(
62
+ Integer,
63
+ ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"),
64
+ nullable=False,
65
+ )
61
66
  organization_id: Mapped[int] = mapped_column(
62
67
  Integer,
63
68
  ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo-identity
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: MaleoIdentity service package
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: Proprietary
@@ -1,5 +1,5 @@
1
1
  maleo/identity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- maleo/identity/models.py,sha256=gxsLPJeNG6cddGx8V7k30LJkCKPPdQ77dXOQUSSZuiM,10132
2
+ maleo/identity/models.py,sha256=CkcLrrcT_WEvNdp_FvUfnJZ8wVMVwrE4zrbor_Cvc_0,10293
3
3
  maleo/identity/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  maleo/identity/constants/api_key.py,sha256=e7CsTodUBgyoX30SJUnYx457WBZeRFyyeaOFGsZ-7mY,264
5
5
  maleo/identity/constants/organization.py,sha256=Jeewz4VlaTmuHHDqNZUZyLD3bdndQjpx9K0EabhCFUM,259
@@ -10,30 +10,30 @@ maleo/identity/constants/user.py,sha256=vlF60H4-THtoOpwyAHMYqaLknXsQOANCLTngbyhN
10
10
  maleo/identity/constants/user_medical_role.py,sha256=HVeXXb191qpAJJHtSgJ0NdFlLCxeEQBOKRr7JCQN8Pg,304
11
11
  maleo/identity/constants/user_organization_role.py,sha256=-6z8e5-OJWmm_47_zbbp61JxiRGGytELqk0iZ5yX4Wk,324
12
12
  maleo/identity/constants/user_profile.py,sha256=trDI4mNlcbA1_ignknMy07I6H-VqAytlfB8ejoQ7XH0,259
13
- maleo/identity/constants/user_system_role.py,sha256=_p5FI2X7yBUJuA06ia_vIkDRyfY4WZweQD08G3wCuRw,300
13
+ maleo/identity/constants/user_system_role.py,sha256=JPnKbuP_kqNngfQubhnL9_L2NlvNb5sKsnNwyO5YPXU,402
14
14
  maleo/identity/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- maleo/identity/enums/api_key.py,sha256=WST6RsRrvJGeSL5ugVeZNKXReGsh9GEPDxmRy-owiEk,276
15
+ maleo/identity/enums/api_key.py,sha256=twpkiI21x52roagXHJjq4vhMLv9WPGhWFtPM55LSZ-w,721
16
16
  maleo/identity/enums/organization.py,sha256=akxi_BJqRMokQ59K4KMZDkO-yLVC0Q_A7jErOiuixqs,406
17
17
  maleo/identity/enums/organization_registration_code.py,sha256=ZkteIpOW6MOLEHBbmDUaRGalTlTWUIRlimz-FohBWiM,282
18
- maleo/identity/enums/organization_relation.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
18
+ maleo/identity/enums/organization_relation.py,sha256=-GxBCzUi-PFrICnHqray2PtFZb6LoG7NluDmyjljOa8,628
19
19
  maleo/identity/enums/patient.py,sha256=rMyUPFApFV9Mf3H-hsvTf4KFbHVkR-GAIluGfdQMpHc,274
20
20
  maleo/identity/enums/user.py,sha256=Y81ZPrZa8Of84AwFmPtrFygK_kXuWYxMZXUm2FFISK8,436
21
- maleo/identity/enums/user_medical_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
22
- maleo/identity/enums/user_organization_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
21
+ maleo/identity/enums/user_medical_role.py,sha256=KvPDu66wIh_sqvx0dyW38aTlCt5e_kRDcJ05Rk0rOd4,636
22
+ maleo/identity/enums/user_organization_role.py,sha256=bV07sZYttbJPfefkp7u9Bkc4V1e3xsyhtErtpkXb-Xg,641
23
23
  maleo/identity/enums/user_profile.py,sha256=LgX7Ct-MAfx7o0W8MICzpHMfDhi7wpiJfRszn6vr1zc,272
24
- maleo/identity/enums/user_system_role.py,sha256=jH9AIYKhxPtK-I02KVrYfZ9Wdo-KNCFk0rDBauwt-Ps,252
24
+ maleo/identity/enums/user_system_role.py,sha256=njHPqJGDw3BMgY_i05ywyQX86Pc8ZSpg4_SeiXSwD2A,616
25
25
  maleo/identity/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- maleo/identity/mixins/api_key.py,sha256=WbRhcO_wdQnn4ow62eg4kRoPYMyNFjXvi5pivRNdP14,2093
26
+ maleo/identity/mixins/api_key.py,sha256=kyFX5gZNZ9aDe8QL31a4XOzF-0tAMpCNl8Fi9Lb4gkQ,2357
27
27
  maleo/identity/mixins/common.py,sha256=diWtUiPMI_ypHtDrmI5y8IArxCdomo9Gt6X69iFhyuw,905
28
28
  maleo/identity/mixins/organization.py,sha256=cJQWOWaRj5F3ITCrpLU7R8hOUM-OWZz_T7H0aV6nc2I,2440
29
29
  maleo/identity/mixins/organization_registration_code.py,sha256=--XHacpOTCdOLou2I9wE3DiWD_H5MeIotGsg3KJCVaw,3418
30
- maleo/identity/mixins/organization_relation.py,sha256=b76eiW6Qrw-Ce6qASaYOVTK4Ox7UAltvLl3sbPra9mY,2591
30
+ maleo/identity/mixins/organization_relation.py,sha256=f3HRunKAMq4sJspOVG6qdu_e5jknA6jzcte7P96qPrk,2855
31
31
  maleo/identity/mixins/patient.py,sha256=kLJKyc5KDgHvK9ljfiaZJJExnovbCWO70HdtHkdKYeQ,3120
32
32
  maleo/identity/mixins/user.py,sha256=PrBEF9GDMewh4UUwWRKF5mVr9exEjBlczLAmbfY3gKY,3421
33
- maleo/identity/mixins/user_medical_role.py,sha256=p1QHv_X9bce0zpDTzjuZP6LVNrKaE5vlFRmNDU7vRyk,2131
34
- maleo/identity/mixins/user_organization_role.py,sha256=KOSGPLhcnNB7ejD-OhDsSgRAv7aiMOrhgW5-3RR8H90,2222
33
+ maleo/identity/mixins/user_medical_role.py,sha256=p4_YDi-OAoNHNKcCUhLtwqBLs6KLVqp40--4pFBkC0s,2395
34
+ maleo/identity/mixins/user_organization_role.py,sha256=E09ZGfL5gI-J7GVyCodcDKqNsgoF4q6exVaBnwPHSWY,2486
35
35
  maleo/identity/mixins/user_profile.py,sha256=QbCIiuKeottVLMWg3MJQe6e7nl_RcF6K5yhtCjqf3OA,3697
36
- maleo/identity/mixins/user_system_role.py,sha256=wxCX7HpT5xYuOqC-rPqnXqdEU5WEf_JLYg7l1zhQIwM,2114
36
+ maleo/identity/mixins/user_system_role.py,sha256=n016-hDsR9YJLZxvrASHzMfEHWDsvhT1ZusgLKE0850,2378
37
37
  maleo/identity/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  maleo/identity/schemas/api_key.py,sha256=3wFfQBiNQEFAF2ZStfczvFhCgM3zC4A2wfWyZshJhhA,4675
39
39
  maleo/identity/schemas/common.py,sha256=YseA6bREI4YFdSHGXK3eS4CIibqm7ZmMBcxLKBiB64Y,8218
@@ -60,8 +60,8 @@ maleo/identity/types/user_system_role.py,sha256=6KIDk7kCWBlrloNLfIElflS5N8oBYqPe
60
60
  maleo/identity/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  maleo/identity/utils/organization.py,sha256=aEegzeoNLUptrScUB5kWrYlJj7dzTZeVXymltE5lWpE,874
62
62
  maleo/identity/utils/user.py,sha256=1pyfmAbXkAEOo6WM2KRA_kRnFi0O_A2ZUEqv01wY-cU,794
63
- maleo_identity-0.1.10.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
64
- maleo_identity-0.1.10.dist-info/METADATA,sha256=QRRoqWPwC8ZUWJUv5De36A_oK3gdLO3sR0z6Cs74XIg,3546
65
- maleo_identity-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
66
- maleo_identity-0.1.10.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
67
- maleo_identity-0.1.10.dist-info/RECORD,,
63
+ maleo_identity-0.1.12.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
64
+ maleo_identity-0.1.12.dist-info/METADATA,sha256=R-hcRmV9yz9MOIBLr7QF2gpgNYJ6J580g7HcE7gxGwE,3546
65
+ maleo_identity-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
66
+ maleo_identity-0.1.12.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
67
+ maleo_identity-0.1.12.dist-info/RECORD,,