Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 19 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,50 +1,31 @@
```
# Python
__pycache__/
*.pyc
*.pyo
*.pyd
*.log
*.tmp
*.swp
.DS_Store
Thumbs.db

# Local environment
.env
.env.local
.env.*
*.env.*

# IDE
.vscode/
.idea/
node_modules/
venv/
.venv/
dist/
build/
target/
.gradle/
.mypy_cache/
.pytest_cache/
*.swp
*.swo

# Logs
*.log

# Coverage
.coverage
coverage/
htmlcov/
.coverage
*.zip
*.gz
*.tar
*.tgz
*.bz2
*.xz
*.7z
*.rar
*.zst
*.lz4
*.lzh
*.cab
*.arj
*.rpm
*.deb
*.Z
*.lz
*.lzo
*.tar.gz
*.tar.bz2
*.tar.xz
*.tar.zst

# Temporary files
*.tmp
.DS_Store
Thumbs.db
```
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ dev = [
"pip-audit (>=2.10.1,<3.0.0)",
"import-linter (>=2.11,<3.0)"
]

[tool.ruff]
lint.ignore = ["F821"]
Binary file added src/__pycache__/main.cpython-312.pyc
Binary file not shown.
Binary file added src/core/__pycache__/lifespan.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file added src/core/config/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/core/events/__pycache__/bus.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file added src/core/routers/api/__pycache__/v1.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/core/security/__pycache__/jwt.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
from sqlalchemy import Index, String, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.authorization.infrastructure.models.resource_model import (
AuthorizationResourceModel,
)
from src.modules.authorization.infrastructure.models.role_permission_model import (
RolePermissionModel,
)
from src.shared.database.mixin.timestamp import SoftDeleteMixin, TimeStampMixin
from src.shared.database.model import Base

Expand Down Expand Up @@ -36,11 +30,11 @@ class PermissionModel(Base, TimeStampMixin, SoftDeleteMixin):
description: Mapped[str | None] = mapped_column(String(255), nullable=True)

# Relationships
roles: Mapped[list["RolePermissionModel"]] = relationship(
roles: Mapped[list["RolePermissionModel"]] = relationship( # type: ignore[name-defined]
back_populates="permission",
cascade="all, delete-orphan",
)
authorization_resource: Mapped["AuthorizationResourceModel"] = relationship(
authorization_resource: Mapped["AuthorizationResourceModel"] = relationship( # type: ignore[name-defined]
back_populates="permissions",
foreign_keys=[resource_id],
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from sqlalchemy import Index, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.authorization.infrastructure.models.permission_model import (
PermissionModel,
)
from src.shared.database.mixin.timestamp import SoftDeleteMixin, TimeStampMixin
from src.shared.database.model import Base

Expand All @@ -23,7 +20,7 @@ class AuthorizationResourceModel(Base, TimeStampMixin, SoftDeleteMixin):
description: Mapped[str | None] = mapped_column(String(255), nullable=True)

# Relationships
permissions: Mapped[list["PermissionModel"]] = relationship(
permissions: Mapped[list["PermissionModel"]] = relationship( # type: ignore[name-defined]
back_populates="authorization_resource",
cascade="all, delete-orphan",
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
from sqlalchemy import Index, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.authorization.infrastructure.models.permission_model import (
PermissionModel,
)
from src.modules.authorization.infrastructure.models.role_model import RoleModel
from src.shared.database.model import Base


Expand All @@ -31,11 +27,11 @@ class RolePermissionModel(Base):
permission_id: Mapped[UUID] = mapped_column(nullable=False)

# Relationships
role: Mapped["RoleModel"] = relationship(
role: Mapped["RoleModel"] = relationship( # type: ignore[name-defined]
back_populates="permissions",
foreign_keys=[role_id],
)
permission: Mapped["PermissionModel"] = relationship(
permission: Mapped["PermissionModel"] = relationship( # type: ignore[name-defined]
back_populates="roles",
foreign_keys=[permission_id],
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from sqlalchemy import Index, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.authorization.infrastructure.models.role_model import RoleModel
from src.modules.user.infrastructure.models.user_model import UserModel
from src.shared.database.model import Base

Expand All @@ -28,11 +27,11 @@ class UserHasRoleModel(Base):
role_id: Mapped[UUID] = mapped_column(nullable=False)

# Relationships
user: Mapped["UserModel"] = relationship(
user: Mapped["UserModel"] = relationship( # type: ignore[name-defined]
back_populates="role_assignments",
foreign_keys=[user_id],
)
role: Mapped["RoleModel"] = relationship(
role: Mapped["RoleModel"] = relationship( # type: ignore[name-defined]
back_populates="user_assignments",
foreign_keys=[role_id],
)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from sqlalchemy import Boolean, DateTime, Index, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.user.infrastructure.models.user_model import UserModel
from src.shared.database.mixin.timestamp import SoftDeleteMixin, TimeStampMixin
from src.shared.database.model import Base

Expand Down Expand Up @@ -53,7 +52,7 @@ class UserSessionModel(Base, TimeStampMixin, SoftDeleteMixin):
revoked_reason: Mapped[str | None] = mapped_column(String(255), nullable=True)

# Relationship
user: Mapped["UserModel"] = relationship(
user: Mapped["UserModel"] = relationship( # type: ignore[name-defined]
back_populates="sessions",
foreign_keys=[user_id],
)
34 changes: 14 additions & 20 deletions src/modules/user/infrastructure/models/user_model.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
from enum import Enum
from typing import TYPE_CHECKING

from sqlalchemy import Index, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from src.modules.authorization.infrastructure.models.user_has_role_model import (
UserHasRoleModel,
)
from src.modules.user.infrastructure.models.refresh_token_model import UserSessionModel
from src.modules.user.infrastructure.models.user_address_model import UserAddressModel
from src.modules.user.infrastructure.models.user_contact_model import UserContactModel
from src.modules.user.infrastructure.models.user_profile_model import UserProfileModel
from src.modules.user.infrastructure.models.user_security_model import UserSecurityModel
from src.modules.user.infrastructure.models.user_settings_model import UserSettingsModel
from src.modules.user.infrastructure.models.user_verification_model import (
UserVerificationModel,
)
from src.shared.database.mixin.timestamp import SoftDeleteMixin, TimeStampMixin
from src.shared.database.model import Base

if TYPE_CHECKING:
from src.modules.authorization.infrastructure.models.user_has_role_model import (
UserHasRoleModel,
)


class UserStatus(str, Enum):
ACTIVE = "active"
Expand Down Expand Up @@ -72,40 +66,40 @@ class UserModel(
)

# Relationships (one-to-one)
profile: Mapped["UserProfileModel"] = relationship(
profile: Mapped["UserProfileModel"] = relationship( # type: ignore[name-defined]
back_populates="user",
uselist=False,
cascade="all, delete-orphan",
)
security: Mapped["UserSecurityModel"] = relationship(
security: Mapped["UserSecurityModel"] = relationship( # type: ignore[name-defined]
back_populates="user",
uselist=False,
cascade="all, delete-orphan",
)
settings: Mapped["UserSettingsModel"] = relationship(
settings: Mapped["UserSettingsModel"] = relationship( # type: ignore[name-defined]
back_populates="user",
uselist=False,
cascade="all, delete-orphan",
)

# Relationships (one-to-many)
contacts: Mapped[list["UserContactModel"]] = relationship(
contacts: Mapped[list["UserContactModel"]] = relationship( # type: ignore[name-defined]
back_populates="user",
cascade="all, delete-orphan",
)
addresses: Mapped[list["UserAddressModel"]] = relationship(
addresses: Mapped[list["UserAddressModel"]] = relationship( # type: ignore[name-defined]
back_populates="user",
cascade="all, delete-orphan",
)
verifications: Mapped[list["UserVerificationModel"]] = relationship(
verifications: Mapped[list["UserVerificationModel"]] = relationship( # type: ignore[name-defined]
back_populates="user",
cascade="all, delete-orphan",
)
sessions: Mapped[list["UserSessionModel"]] = relationship(
sessions: Mapped[list["UserSessionModel"]] = relationship( # type: ignore[name-defined]
back_populates="user",
cascade="all, delete-orphan",
)
role_assignments: Mapped[list["UserHasRoleModel"]] = relationship(
role_assignments: Mapped[list["UserHasRoleModel"]] = relationship( # type: ignore[name-defined]
back_populates="user",
cascade="all, delete-orphan",
)
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from src.modules.user.domain.repositories.refresh_token_repository import (
RefreshTokenRepository,
)
from src.modules.user.infrastructure.models.refresh_token_model import RefreshTokenModel
from src.modules.user.infrastructure.models.refresh_token_model import (
UserSessionModel as RefreshTokenModel,
)


class SQLAlchemyRefreshTokenRepository(RefreshTokenRepository):
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/shared/email/__pycache__/base.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading