maleo-identity 0.0.85__py3-none-any.whl → 0.1.24__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.
- maleo/identity/constants/api_key.py +13 -0
- maleo/identity/constants/organization.py +3 -10
- maleo/identity/constants/organization_registration_code.py +5 -17
- maleo/identity/constants/organization_relation.py +13 -0
- maleo/identity/constants/patient.py +7 -0
- maleo/identity/constants/user.py +3 -20
- maleo/identity/constants/user_medical_role.py +13 -0
- maleo/identity/constants/user_organization_role.py +5 -39
- maleo/identity/constants/user_profile.py +3 -21
- maleo/identity/constants/user_system_role.py +9 -8
- maleo/identity/enums/api_key.py +25 -0
- maleo/identity/enums/organization.py +16 -3
- maleo/identity/enums/organization_registration_code.py +9 -0
- maleo/identity/enums/organization_relation.py +22 -0
- maleo/identity/enums/patient.py +29 -0
- maleo/identity/enums/user.py +16 -7
- maleo/identity/enums/user_medical_role.py +22 -0
- maleo/identity/enums/user_organization_role.py +19 -12
- maleo/identity/enums/user_profile.py +7 -9
- maleo/identity/enums/user_system_role.py +30 -0
- maleo/identity/mixins/api_key.py +72 -0
- maleo/identity/mixins/common.py +29 -0
- maleo/identity/mixins/organization.py +68 -8
- maleo/identity/mixins/organization_registration_code.py +126 -9
- maleo/identity/mixins/organization_relation.py +80 -0
- maleo/identity/mixins/patient.py +65 -0
- maleo/identity/mixins/user.py +86 -24
- maleo/identity/mixins/user_medical_role.py +68 -0
- maleo/identity/mixins/user_organization_role.py +68 -4
- maleo/identity/mixins/user_profile.py +84 -53
- maleo/identity/mixins/user_system_role.py +72 -4
- maleo/identity/schemas/api_key.py +171 -0
- maleo/identity/schemas/common.py +335 -0
- maleo/identity/schemas/organization.py +311 -0
- maleo/identity/schemas/organization_registration_code.py +314 -0
- maleo/identity/schemas/organization_relation.py +315 -0
- maleo/identity/schemas/patient.py +349 -0
- maleo/identity/schemas/user.py +318 -0
- maleo/identity/schemas/user_medical_role.py +316 -0
- maleo/identity/schemas/user_organization_role.py +317 -0
- maleo/identity/schemas/user_profile.py +362 -0
- maleo/identity/schemas/user_system_role.py +339 -0
- maleo/identity/types/api_key.py +7 -0
- maleo/identity/types/organization.py +4 -0
- maleo/identity/types/organization_registration_code.py +4 -0
- maleo/identity/types/organization_relation.py +7 -0
- maleo/identity/types/patient.py +4 -0
- maleo/identity/types/user.py +4 -0
- maleo/identity/types/user_medical_role.py +7 -0
- maleo/identity/types/user_organization_role.py +7 -0
- maleo/identity/types/user_profile.py +4 -0
- maleo/identity/types/user_system_role.py +8 -0
- maleo/identity/utils/organization.py +32 -0
- maleo/identity/utils/user.py +32 -0
- maleo_identity-0.1.24.dist-info/METADATA +119 -0
- maleo_identity-0.1.24.dist-info/RECORD +66 -0
- maleo_identity-0.1.24.dist-info/licenses/LICENSE +57 -0
- maleo/identity/client/manager.py +0 -157
- maleo/identity/client/services/__init__.py +0 -0
- maleo/identity/client/services/organization.py +0 -1944
- maleo/identity/client/services/organization_registration_code.py +0 -470
- maleo/identity/client/services/organization_role.py +0 -276
- maleo/identity/client/services/user.py +0 -1559
- maleo/identity/client/services/user_organization.py +0 -276
- maleo/identity/client/services/user_organization_role.py +0 -278
- maleo/identity/client/services/user_profile.py +0 -276
- maleo/identity/client/services/user_system_role.py +0 -276
- maleo/identity/constants/organization_role.py +0 -35
- maleo/identity/constants/user_organization.py +0 -58
- maleo/identity/db.py +0 -4
- maleo/identity/dtos/__init__.py +0 -0
- maleo/identity/dtos/configuration.py +0 -15
- maleo/identity/dtos/data/__init__.py +0 -0
- maleo/identity/dtos/data/organization_registration_code.py +0 -15
- maleo/identity/dtos/data/user_profile.py +0 -29
- maleo/identity/dtos/settings.py +0 -17
- maleo/identity/enums/general.py +0 -5
- maleo/identity/enums/organization_role.py +0 -7
- maleo/identity/enums/user_organization.py +0 -14
- maleo/identity/mixins/organization_role.py +0 -15
- maleo/identity/mixins/user_organization.py +0 -6
- maleo/identity/models/__init__.py +0 -0
- maleo/identity/models/organization.py +0 -62
- maleo/identity/models/organization_registration_code.py +0 -33
- maleo/identity/models/organization_role.py +0 -37
- maleo/identity/models/user.py +0 -39
- maleo/identity/models/user_organization.py +0 -48
- maleo/identity/models/user_organization_role.py +0 -61
- maleo/identity/models/user_profile.py +0 -33
- maleo/identity/models/user_system_role.py +0 -26
- maleo/identity/schemas/data/__init__.py +0 -0
- maleo/identity/schemas/data/organization.py +0 -36
- maleo/identity/schemas/data/organization_registration_code.py +0 -27
- maleo/identity/schemas/data/organization_role.py +0 -32
- maleo/identity/schemas/data/user.py +0 -33
- maleo/identity/schemas/data/user_organization.py +0 -23
- maleo/identity/schemas/data/user_organization_role.py +0 -13
- maleo/identity/schemas/data/user_profile.py +0 -59
- maleo/identity/schemas/data/user_system_role.py +0 -25
- maleo/identity/schemas/metadata/__init__.py +0 -0
- maleo/identity/schemas/metadata/user.py +0 -6
- maleo/identity/schemas/parameter/__init__.py +0 -0
- maleo/identity/schemas/parameter/client/__init__.py +0 -0
- maleo/identity/schemas/parameter/client/organization.py +0 -74
- maleo/identity/schemas/parameter/client/organization_registration_code.py +0 -24
- maleo/identity/schemas/parameter/client/organization_role.py +0 -42
- maleo/identity/schemas/parameter/client/user.py +0 -44
- maleo/identity/schemas/parameter/client/user_organization.py +0 -62
- maleo/identity/schemas/parameter/client/user_organization_role.py +0 -49
- maleo/identity/schemas/parameter/client/user_profile.py +0 -28
- maleo/identity/schemas/parameter/client/user_system_role.py +0 -43
- maleo/identity/schemas/parameter/general/__init__.py +0 -0
- maleo/identity/schemas/parameter/general/organization.py +0 -43
- maleo/identity/schemas/parameter/general/organization_registration_code.py +0 -54
- maleo/identity/schemas/parameter/general/organization_role.py +0 -14
- maleo/identity/schemas/parameter/general/user.py +0 -101
- maleo/identity/schemas/parameter/general/user_organization.py +0 -18
- maleo/identity/schemas/parameter/general/user_organization_role.py +0 -15
- maleo/identity/schemas/parameter/general/user_profile.py +0 -70
- maleo/identity/schemas/parameter/general/user_system_role.py +0 -30
- maleo/identity/schemas/parameter/service/__init__.py +0 -0
- maleo/identity/schemas/parameter/service/organization.py +0 -60
- maleo/identity/schemas/parameter/service/organization_registration_code.py +0 -24
- maleo/identity/schemas/parameter/service/organization_role.py +0 -35
- maleo/identity/schemas/parameter/service/user.py +0 -47
- maleo/identity/schemas/parameter/service/user_organization_role.py +0 -36
- maleo/identity/schemas/parameter/service/user_profile.py +0 -28
- maleo/identity/schemas/parameter/service/user_system_role.py +0 -31
- maleo/identity/types/base/__init__.py +0 -0
- maleo/identity/types/base/organization.py +0 -5
- maleo/identity/types/base/organization_registration_code.py +0 -4
- maleo/identity/types/base/user.py +0 -5
- maleo/identity/types/base/user_profile.py +0 -5
- maleo_identity-0.0.85.dist-info/METADATA +0 -40
- maleo_identity-0.0.85.dist-info/RECORD +0 -105
- /maleo/identity/{client → utils}/__init__.py +0 -0
- {maleo_identity-0.0.85.dist-info → maleo_identity-0.1.24.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.85.dist-info → maleo_identity-0.1.24.dist-info}/top_level.txt +0 -0
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from maleo.soma.mixins.general import UserId
|
|
2
|
-
from maleo.identity.mixins.user_profile import (
|
|
3
|
-
IdCard,
|
|
4
|
-
LeadingTitle,
|
|
5
|
-
FirstName,
|
|
6
|
-
MiddleName,
|
|
7
|
-
LastName,
|
|
8
|
-
EndingTitle,
|
|
9
|
-
FullName,
|
|
10
|
-
BirthPlace,
|
|
11
|
-
BirthDate,
|
|
12
|
-
AvatarName,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class UserProfileDTO(
|
|
17
|
-
AvatarName,
|
|
18
|
-
BirthDate,
|
|
19
|
-
BirthPlace,
|
|
20
|
-
FullName,
|
|
21
|
-
EndingTitle,
|
|
22
|
-
LastName,
|
|
23
|
-
MiddleName,
|
|
24
|
-
FirstName,
|
|
25
|
-
LeadingTitle,
|
|
26
|
-
IdCard,
|
|
27
|
-
UserId,
|
|
28
|
-
):
|
|
29
|
-
pass
|
maleo/identity/dtos/settings.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from pydantic import model_validator
|
|
2
|
-
from typing import Self
|
|
3
|
-
from maleo.soma.dtos.settings import Settings as BaseSettings
|
|
4
|
-
from maleo.soma.enums.service import ServiceKey, ServiceName
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Settings(BaseSettings):
|
|
8
|
-
@model_validator(mode="after")
|
|
9
|
-
def validate_service_key_name(self) -> Self:
|
|
10
|
-
assert (
|
|
11
|
-
self.SERVICE_KEY is ServiceKey.IDENTITY
|
|
12
|
-
), f"'SERVICE_KEY' must be '{ServiceKey.IDENTITY}'"
|
|
13
|
-
assert (
|
|
14
|
-
self.SERVICE_NAME is ServiceName.IDENTITY
|
|
15
|
-
), f"'SERVICE_NAME' must be '{ServiceName.IDENTITY}'"
|
|
16
|
-
|
|
17
|
-
return self
|
maleo/identity/enums/general.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from enum import StrEnum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ExpandableField(StrEnum):
|
|
5
|
-
USER = "user"
|
|
6
|
-
USER_TYPE = "user_type"
|
|
7
|
-
SYSTEM_ROLES = "system_roles"
|
|
8
|
-
SYSTEM_ROLE_DETAILS = "system_roles.system_role_details"
|
|
9
|
-
PROFILE = "profile"
|
|
10
|
-
GENDER = "profile.gender"
|
|
11
|
-
BLOOD_TYPE = "profile.blood_type"
|
|
12
|
-
ORGANIZATION = "organization"
|
|
13
|
-
ORGANIZATION_TYPE = "organization.organization_type"
|
|
14
|
-
REGISTRATION_CODE = "organization.registration_code"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from maleo.soma.mixins.parameter import Expand as BaseExpand
|
|
3
|
-
from maleo.identity.enums.organization_role import ExpandableField
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Expand(BaseExpand[ExpandableField]):
|
|
7
|
-
pass
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Key(BaseModel):
|
|
11
|
-
key: str = Field(..., max_length=50, description="Organization role's key")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Name(BaseModel):
|
|
15
|
-
name: str = Field(..., max_length=50, description="Organization role's name")
|
|
File without changes
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Integer, String, Enum, UUID
|
|
4
|
-
from uuid import uuid4
|
|
5
|
-
from maleo.soma.models.table import DataTable
|
|
6
|
-
from maleo.metadata.enums.organization_type import OrganizationType
|
|
7
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class OrganizationsMixin:
|
|
11
|
-
organization_type = Column(
|
|
12
|
-
name="organization_type",
|
|
13
|
-
type_=Enum(OrganizationType, name="organization_type"),
|
|
14
|
-
default=OrganizationType.REGULAR,
|
|
15
|
-
nullable=False,
|
|
16
|
-
)
|
|
17
|
-
parent_id = Column(
|
|
18
|
-
"parent_id",
|
|
19
|
-
Integer,
|
|
20
|
-
ForeignKey("organizations.id", ondelete="SET NULL", onupdate="CASCADE"),
|
|
21
|
-
)
|
|
22
|
-
key = Column(name="key", type_=String(255), unique=True, nullable=False)
|
|
23
|
-
name = Column(name="name", type_=String(255), nullable=False)
|
|
24
|
-
secret = Column(
|
|
25
|
-
name="secret", type_=UUID, default=uuid4, unique=True, nullable=False
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class OrganizationsTable(OrganizationsMixin, DataTable, MaleoIdentityBase):
|
|
30
|
-
__tablename__ = "organizations"
|
|
31
|
-
parent = relationship(
|
|
32
|
-
"OrganizationsTable",
|
|
33
|
-
remote_side="OrganizationsTable.id",
|
|
34
|
-
# back_populates="children"
|
|
35
|
-
)
|
|
36
|
-
# children = relationship(
|
|
37
|
-
# "OrganizationsTable",
|
|
38
|
-
# back_populates="parent",
|
|
39
|
-
# cascade="all",
|
|
40
|
-
# lazy="select",
|
|
41
|
-
# foreign_keys="[OrganizationsTable.parent_id]",
|
|
42
|
-
# order_by="OrganizationsTable.id"
|
|
43
|
-
# )
|
|
44
|
-
registration_code = relationship(
|
|
45
|
-
"OrganizationRegistrationCodesTable",
|
|
46
|
-
back_populates="organization",
|
|
47
|
-
cascade="all",
|
|
48
|
-
lazy="select",
|
|
49
|
-
uselist=False,
|
|
50
|
-
)
|
|
51
|
-
user_organization = relationship(
|
|
52
|
-
"UserOrganizationsTable",
|
|
53
|
-
back_populates="organization",
|
|
54
|
-
cascade="all, delete-orphan",
|
|
55
|
-
uselist=False,
|
|
56
|
-
)
|
|
57
|
-
organization_roles = relationship(
|
|
58
|
-
"OrganizationRolesTable",
|
|
59
|
-
back_populates="organization",
|
|
60
|
-
cascade="all, delete-orphan",
|
|
61
|
-
uselist=False,
|
|
62
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Integer, UUID
|
|
4
|
-
from uuid import uuid4
|
|
5
|
-
from maleo.soma.models.table import DataTable
|
|
6
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class OrganizationRegistrationCodesMixin:
|
|
10
|
-
# Foreign Key OrganizationsTable
|
|
11
|
-
organization_id = Column(
|
|
12
|
-
Integer,
|
|
13
|
-
ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
14
|
-
unique=True,
|
|
15
|
-
nullable=False,
|
|
16
|
-
)
|
|
17
|
-
code = Column(name="code", type_=UUID, default=uuid4, unique=True, nullable=False)
|
|
18
|
-
max_uses = Column(name="max_uses", type_=Integer, nullable=False, default=1)
|
|
19
|
-
current_uses = Column(name="current_uses", type_=Integer, nullable=False, default=0)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class OrganizationRegistrationCodesTable(
|
|
23
|
-
OrganizationRegistrationCodesMixin, DataTable, MaleoIdentityBase
|
|
24
|
-
):
|
|
25
|
-
__tablename__ = "organization_registration_codes"
|
|
26
|
-
|
|
27
|
-
organization = relationship(
|
|
28
|
-
"OrganizationsTable",
|
|
29
|
-
back_populates="registration_code",
|
|
30
|
-
cascade="all",
|
|
31
|
-
lazy="select",
|
|
32
|
-
uselist=False,
|
|
33
|
-
)
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Integer, String, Boolean
|
|
4
|
-
from maleo.soma.models.table import DataTable
|
|
5
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class OrganizationRolesMixin:
|
|
9
|
-
# Foreign Key OrganizationsTable
|
|
10
|
-
organization_id = Column(
|
|
11
|
-
Integer,
|
|
12
|
-
ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
13
|
-
nullable=False,
|
|
14
|
-
)
|
|
15
|
-
is_default = Column(name="is_default", type_=Boolean, nullable=False, default=False)
|
|
16
|
-
order = Column(name="order", type_=Integer)
|
|
17
|
-
key = Column(name="key", type_=String(50), nullable=False)
|
|
18
|
-
name = Column(name="name", type_=String(50), nullable=False)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class OrganizationRolesTable(OrganizationRolesMixin, DataTable, MaleoIdentityBase):
|
|
22
|
-
__tablename__ = "organization_roles"
|
|
23
|
-
|
|
24
|
-
organization = relationship(
|
|
25
|
-
"OrganizationsTable",
|
|
26
|
-
back_populates="organization_roles",
|
|
27
|
-
cascade="all",
|
|
28
|
-
lazy="select",
|
|
29
|
-
uselist=False,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
user_organization_roles = relationship(
|
|
33
|
-
"UserOrganizationRolesTable",
|
|
34
|
-
back_populates="organization_role",
|
|
35
|
-
cascade="all, delete-orphan",
|
|
36
|
-
lazy="select",
|
|
37
|
-
)
|
maleo/identity/models/user.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import String, Enum
|
|
4
|
-
from maleo.soma.models.table import DataTable
|
|
5
|
-
from maleo.metadata.enums.user_type import UserType
|
|
6
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class UsersMixin:
|
|
10
|
-
user_type = Column(
|
|
11
|
-
name="user_type",
|
|
12
|
-
type_=Enum(UserType, name="user_type"),
|
|
13
|
-
default=UserType.REGULAR,
|
|
14
|
-
nullable=False,
|
|
15
|
-
)
|
|
16
|
-
username = Column(name="username", type_=String(50), unique=True, nullable=False)
|
|
17
|
-
email = Column(name="email", type_=String(255), unique=True, nullable=False)
|
|
18
|
-
phone = Column(name="phone", type_=String(15), nullable=False)
|
|
19
|
-
password = Column(name="password", type_=String(255), nullable=False)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class UsersTable(UsersMixin, DataTable, MaleoIdentityBase):
|
|
23
|
-
__tablename__ = "users"
|
|
24
|
-
|
|
25
|
-
profile = relationship(
|
|
26
|
-
"UserProfilesTable",
|
|
27
|
-
back_populates="user",
|
|
28
|
-
uselist=False,
|
|
29
|
-
cascade="all, delete-orphan",
|
|
30
|
-
)
|
|
31
|
-
system_roles = relationship(
|
|
32
|
-
"UserSystemRolesTable", back_populates="user", cascade="all, delete-orphan"
|
|
33
|
-
)
|
|
34
|
-
user_organization = relationship(
|
|
35
|
-
"UserOrganizationsTable",
|
|
36
|
-
back_populates="user",
|
|
37
|
-
cascade="all, delete-orphan",
|
|
38
|
-
uselist=False,
|
|
39
|
-
)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Integer
|
|
4
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
5
|
-
from maleo.soma.models.table import DataTable
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class UserOrganizationsMixin:
|
|
9
|
-
# Foreign Key UsersTable
|
|
10
|
-
user_id = Column(
|
|
11
|
-
Integer,
|
|
12
|
-
ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
13
|
-
nullable=False,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
# Foreign Key OrganizationsTable
|
|
17
|
-
organization_id = Column(
|
|
18
|
-
Integer,
|
|
19
|
-
ForeignKey("organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
20
|
-
nullable=False,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class UserOrganizationsTable(UserOrganizationsMixin, DataTable, MaleoIdentityBase):
|
|
25
|
-
__tablename__ = "user_organizations"
|
|
26
|
-
|
|
27
|
-
user = relationship(
|
|
28
|
-
"UsersTable",
|
|
29
|
-
back_populates="user_organization",
|
|
30
|
-
cascade="all",
|
|
31
|
-
lazy="select",
|
|
32
|
-
uselist=False,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
organization = relationship(
|
|
36
|
-
"OrganizationsTable",
|
|
37
|
-
back_populates="user_organization",
|
|
38
|
-
cascade="all",
|
|
39
|
-
lazy="select",
|
|
40
|
-
uselist=False,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
user_organization_roles = relationship(
|
|
44
|
-
"UserOrganizationRolesTable",
|
|
45
|
-
back_populates="user_organization",
|
|
46
|
-
cascade="all, delete-orphan",
|
|
47
|
-
lazy="select",
|
|
48
|
-
)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Integer
|
|
4
|
-
from maleo.soma.models.table import DataTable
|
|
5
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class UserOrganizationRolesMixin:
|
|
9
|
-
# Foreign Key UserOrganizationsTable
|
|
10
|
-
user_organization_id = Column(
|
|
11
|
-
Integer,
|
|
12
|
-
ForeignKey("user_organizations.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
13
|
-
nullable=False,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
# Foreign Key OrganizationRolesTable
|
|
17
|
-
organization_role_id = Column(
|
|
18
|
-
Integer,
|
|
19
|
-
ForeignKey("organization_roles.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
20
|
-
nullable=False,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class UserOrganizationRolesTable(
|
|
25
|
-
UserOrganizationRolesMixin, DataTable, MaleoIdentityBase
|
|
26
|
-
):
|
|
27
|
-
__tablename__ = "user_organization_roles"
|
|
28
|
-
|
|
29
|
-
user_organization = relationship(
|
|
30
|
-
"UserOrganizationsTable",
|
|
31
|
-
back_populates="user_organization_roles",
|
|
32
|
-
cascade="all",
|
|
33
|
-
lazy="select",
|
|
34
|
-
uselist=False,
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
user = relationship(
|
|
38
|
-
"UsersTable",
|
|
39
|
-
secondary="user_organizations",
|
|
40
|
-
primaryjoin="UserOrganizationRolesTable.user_organization_id == UserOrganizationsTable.id",
|
|
41
|
-
secondaryjoin="UserOrganizationsTable.user_id == UsersTable.id",
|
|
42
|
-
uselist=False,
|
|
43
|
-
viewonly=True,
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
organization = relationship(
|
|
47
|
-
"OrganizationsTable",
|
|
48
|
-
secondary="user_organizations",
|
|
49
|
-
primaryjoin="UserOrganizationRolesTable.user_organization_id == UserOrganizationsTable.id",
|
|
50
|
-
secondaryjoin="UserOrganizationsTable.organization_id == OrganizationsTable.id",
|
|
51
|
-
uselist=False,
|
|
52
|
-
viewonly=True,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
organization_role = relationship(
|
|
56
|
-
"OrganizationRolesTable",
|
|
57
|
-
back_populates="user_organization_roles",
|
|
58
|
-
cascade="all",
|
|
59
|
-
lazy="select",
|
|
60
|
-
uselist=False,
|
|
61
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import String, Enum, Integer, Date, Text
|
|
4
|
-
from maleo.soma.models.table import DataTable
|
|
5
|
-
from maleo.metadata.enums.blood_type import BloodType
|
|
6
|
-
from maleo.metadata.enums.gender import Gender
|
|
7
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class UserProfilesMixin:
|
|
11
|
-
# Foreign Key and Relationship to UsersTable
|
|
12
|
-
user_id = Column(
|
|
13
|
-
Integer,
|
|
14
|
-
ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
15
|
-
nullable=False,
|
|
16
|
-
)
|
|
17
|
-
id_card = Column(name="id_card", type_=String(16))
|
|
18
|
-
leading_title = Column(name="leading_title", type_=String(25))
|
|
19
|
-
first_name = Column(name="first_name", type_=String(50), nullable=False)
|
|
20
|
-
middle_name = Column(name="middle_name", type_=String(50))
|
|
21
|
-
last_name = Column(name="last_name", type_=String(50), nullable=False)
|
|
22
|
-
ending_title = Column(name="ending_title", type_=String(25))
|
|
23
|
-
full_name = Column(name="full_name", type_=String(200), nullable=False)
|
|
24
|
-
birth_place = Column(name="birth_place", type_=String(50))
|
|
25
|
-
birth_date = Column(name="birth_date", type_=Date)
|
|
26
|
-
gender = Column(name="gender", type_=Enum(Gender, name="gender"))
|
|
27
|
-
blood_type = Column(name="blood_type", type_=Enum(BloodType, name="blood_type"))
|
|
28
|
-
avatar_name = Column(name="avatar_name", type_=Text, nullable=False)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class UserProfilesTable(UserProfilesMixin, DataTable, MaleoIdentityBase):
|
|
32
|
-
__tablename__ = "user_profiles"
|
|
33
|
-
user = relationship("UsersTable", back_populates="profile")
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from sqlalchemy import Column, ForeignKey
|
|
2
|
-
from sqlalchemy.orm import relationship
|
|
3
|
-
from sqlalchemy.types import Enum, Integer
|
|
4
|
-
from maleo.soma.models.table import DataTable
|
|
5
|
-
from maleo.metadata.enums.system_role import SystemRole
|
|
6
|
-
from maleo.identity.db import MaleoIdentityBase
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class UserSystemRolesMixin:
|
|
10
|
-
user_id = Column(
|
|
11
|
-
Integer,
|
|
12
|
-
ForeignKey("users.id", ondelete="CASCADE", onupdate="CASCADE"),
|
|
13
|
-
nullable=False,
|
|
14
|
-
)
|
|
15
|
-
system_role = Column(
|
|
16
|
-
name="system_role",
|
|
17
|
-
type_=Enum(SystemRole, name="system_role"),
|
|
18
|
-
default=SystemRole.USER,
|
|
19
|
-
nullable=False,
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class UserSystemRolesTable(UserSystemRolesMixin, DataTable, MaleoIdentityBase):
|
|
24
|
-
__tablename__ = "user_system_roles"
|
|
25
|
-
# Foreign Key and Relationship to UsersTable
|
|
26
|
-
user = relationship("UsersTable", back_populates="system_roles")
|
|
File without changes
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Optional
|
|
3
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
4
|
-
from maleo.soma.mixins.general import OptionalParentId
|
|
5
|
-
from maleo.metadata.schemas.data.organization_type import (
|
|
6
|
-
SimpleOrganizationTypeMixin,
|
|
7
|
-
OptionalExpandedOrganizationTypeMixin,
|
|
8
|
-
)
|
|
9
|
-
from maleo.identity.mixins.organization import Key, Name
|
|
10
|
-
from .organization_registration_code import (
|
|
11
|
-
OptionalOrganizationRegistrationCodeDataMixin,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class OrganizationDataSchema(
|
|
16
|
-
OptionalOrganizationRegistrationCodeDataMixin,
|
|
17
|
-
Name,
|
|
18
|
-
Key,
|
|
19
|
-
OptionalParentId,
|
|
20
|
-
OptionalExpandedOrganizationTypeMixin,
|
|
21
|
-
SimpleOrganizationTypeMixin,
|
|
22
|
-
DataStatus,
|
|
23
|
-
DataTimestamp,
|
|
24
|
-
DataIdentifier,
|
|
25
|
-
):
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class OrganizationDataMixin(BaseModel):
|
|
30
|
-
organization: OrganizationDataSchema = Field(..., description="Organization.")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class OptionalOrganizationDataMixin(BaseModel):
|
|
34
|
-
organization: Optional[OrganizationDataSchema] = Field(
|
|
35
|
-
None, description="Organization. (Optional)"
|
|
36
|
-
)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Optional
|
|
3
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
4
|
-
from maleo.identity.dtos.data.organization_registration_code import (
|
|
5
|
-
OrganizationRegistrationCodeDTO,
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class OrganizationRegistrationCodeDataSchema(
|
|
10
|
-
OrganizationRegistrationCodeDTO,
|
|
11
|
-
DataStatus,
|
|
12
|
-
DataTimestamp,
|
|
13
|
-
DataIdentifier,
|
|
14
|
-
):
|
|
15
|
-
pass
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class OrganizationRegistrationCodeDataMixin(BaseModel):
|
|
19
|
-
registration_code: OrganizationRegistrationCodeDataSchema = Field(
|
|
20
|
-
..., description="Organization's Registration Code."
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class OptionalOrganizationRegistrationCodeDataMixin(BaseModel):
|
|
25
|
-
registration_code: Optional[OrganizationRegistrationCodeDataSchema] = Field(
|
|
26
|
-
None, description="Organization's Registration Code. (Optional)"
|
|
27
|
-
)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Optional
|
|
3
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
4
|
-
from maleo.soma.mixins.general import IsDefault, Order, OrganizationId
|
|
5
|
-
from maleo.identity.mixins.organization_role import Key, Name
|
|
6
|
-
from .organization import OptionalOrganizationDataMixin
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class OrganizationRoleDataSchema(
|
|
10
|
-
Name,
|
|
11
|
-
Key,
|
|
12
|
-
Order,
|
|
13
|
-
IsDefault,
|
|
14
|
-
OptionalOrganizationDataMixin,
|
|
15
|
-
OrganizationId,
|
|
16
|
-
DataStatus,
|
|
17
|
-
DataTimestamp,
|
|
18
|
-
DataIdentifier,
|
|
19
|
-
):
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class OrganizationRoleDataMixin(BaseModel):
|
|
24
|
-
organization_role: OrganizationRoleDataSchema = Field(
|
|
25
|
-
..., description="Organization role."
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class OptionalOrganizationRoleDataMixin(BaseModel):
|
|
30
|
-
organization_role: Optional[OrganizationRoleDataSchema] = Field(
|
|
31
|
-
None, description="Organization role. (Optional)"
|
|
32
|
-
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from typing import Optional
|
|
3
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
4
|
-
from maleo.metadata.schemas.data.user_type import (
|
|
5
|
-
SimpleUserTypeMixin,
|
|
6
|
-
OptionalExpandedUserTypeMixin,
|
|
7
|
-
)
|
|
8
|
-
from maleo.identity.mixins.user import Username, Email, Phone
|
|
9
|
-
from .user_profile import OptionalUserProfileDataMixin
|
|
10
|
-
from .user_system_role import ListOfUserSystemRolesDataMixin
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class UserDataSchema(
|
|
14
|
-
OptionalUserProfileDataMixin,
|
|
15
|
-
ListOfUserSystemRolesDataMixin,
|
|
16
|
-
Phone,
|
|
17
|
-
Email,
|
|
18
|
-
Username,
|
|
19
|
-
OptionalExpandedUserTypeMixin,
|
|
20
|
-
SimpleUserTypeMixin,
|
|
21
|
-
DataStatus,
|
|
22
|
-
DataTimestamp,
|
|
23
|
-
DataIdentifier,
|
|
24
|
-
):
|
|
25
|
-
pass
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class UserDataMixin(BaseModel):
|
|
29
|
-
user: UserDataSchema = Field(..., description="User.")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class OptionalUserDataMixin(BaseModel):
|
|
33
|
-
user: Optional[UserDataSchema] = Field(None, description="User. (Optional)")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
3
|
-
from maleo.soma.mixins.general import UserId, OrganizationId
|
|
4
|
-
from .organization import OrganizationDataMixin
|
|
5
|
-
from .user import UserDataMixin
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class UserOrganizationDataSchema(
|
|
9
|
-
OrganizationDataMixin,
|
|
10
|
-
OrganizationId,
|
|
11
|
-
UserDataMixin,
|
|
12
|
-
UserId,
|
|
13
|
-
DataStatus,
|
|
14
|
-
DataTimestamp,
|
|
15
|
-
DataIdentifier,
|
|
16
|
-
):
|
|
17
|
-
pass
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class UserOrganizationDataMixin(BaseModel):
|
|
21
|
-
user_organization: UserOrganizationDataSchema = Field(
|
|
22
|
-
..., description="User organization"
|
|
23
|
-
)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from maleo.soma.mixins.data import DataIdentifier, DataTimestamp, DataStatus
|
|
2
|
-
from maleo.identity.schemas.data.organization_role import OrganizationRoleDataMixin
|
|
3
|
-
from maleo.identity.schemas.data.user_organization import UserOrganizationDataMixin
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class UserOrganizationRoleDataSchema(
|
|
7
|
-
OrganizationRoleDataMixin,
|
|
8
|
-
UserOrganizationDataMixin,
|
|
9
|
-
DataStatus,
|
|
10
|
-
DataTimestamp,
|
|
11
|
-
DataIdentifier,
|
|
12
|
-
):
|
|
13
|
-
pass
|