fix(lint): auto-fix ruff violations and tune lint rules
- Auto-fixed 4,496 lint issues (import sorting, modern syntax, etc.) - Added ignore rules for patterns intentional in this codebase: E402 (late imports), E712 (SQLAlchemy filters), B904 (raise from), SIM108/SIM105/SIM117 (readability preferences) - Added per-file ignores for tests and scripts - Excluded broken scripts/rename_terminology.py (has curly quotes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,30 +6,6 @@ Request/response schemas for platform, merchant, store, admin user, and team man
|
||||
"""
|
||||
|
||||
# Merchant schemas
|
||||
from app.modules.tenancy.schemas.merchant import (
|
||||
MerchantBase,
|
||||
MerchantCreate,
|
||||
MerchantCreateResponse,
|
||||
MerchantDetailResponse,
|
||||
MerchantListResponse,
|
||||
MerchantResponse,
|
||||
MerchantSummary,
|
||||
MerchantTransferOwnership,
|
||||
MerchantTransferOwnershipResponse,
|
||||
MerchantUpdate,
|
||||
)
|
||||
|
||||
# Store schemas
|
||||
from app.modules.tenancy.schemas.store import (
|
||||
StoreCreate,
|
||||
StoreCreateResponse,
|
||||
StoreDetailResponse,
|
||||
StoreListResponse,
|
||||
StoreResponse,
|
||||
StoreSummary,
|
||||
StoreUpdate,
|
||||
)
|
||||
|
||||
# Admin schemas
|
||||
from app.modules.tenancy.schemas.admin import (
|
||||
AdminAuditLogFilters,
|
||||
@@ -50,10 +26,10 @@ from app.modules.tenancy.schemas.admin import (
|
||||
ApplicationLogFilters,
|
||||
ApplicationLogListResponse,
|
||||
ApplicationLogResponse,
|
||||
BulkUserAction,
|
||||
BulkUserActionResponse,
|
||||
BulkStoreAction,
|
||||
BulkStoreActionResponse,
|
||||
BulkUserAction,
|
||||
BulkUserActionResponse,
|
||||
ComponentHealthStatus,
|
||||
FileLogResponse,
|
||||
LogCleanupResponse,
|
||||
@@ -73,6 +49,43 @@ from app.modules.tenancy.schemas.admin import (
|
||||
RowsPerPageUpdateResponse,
|
||||
SystemHealthResponse,
|
||||
)
|
||||
from app.modules.tenancy.schemas.merchant import (
|
||||
MerchantBase,
|
||||
MerchantCreate,
|
||||
MerchantCreateResponse,
|
||||
MerchantDetailResponse,
|
||||
MerchantListResponse,
|
||||
MerchantPortalProfileResponse,
|
||||
MerchantPortalProfileUpdate,
|
||||
MerchantPortalStoreListResponse,
|
||||
MerchantResponse,
|
||||
MerchantSummary,
|
||||
MerchantTransferOwnership,
|
||||
MerchantTransferOwnershipResponse,
|
||||
MerchantUpdate,
|
||||
)
|
||||
|
||||
# Store schemas
|
||||
from app.modules.tenancy.schemas.store import (
|
||||
StoreCreate,
|
||||
StoreCreateResponse,
|
||||
StoreDetailResponse,
|
||||
StoreListResponse,
|
||||
StoreResponse,
|
||||
StoreSummary,
|
||||
StoreUpdate,
|
||||
)
|
||||
|
||||
# Store domain schemas
|
||||
from app.modules.tenancy.schemas.store_domain import (
|
||||
DomainDeletionResponse,
|
||||
DomainVerificationInstructions,
|
||||
DomainVerificationResponse,
|
||||
StoreDomainCreate,
|
||||
StoreDomainListResponse,
|
||||
StoreDomainResponse,
|
||||
StoreDomainUpdate,
|
||||
)
|
||||
|
||||
# Team schemas
|
||||
from app.modules.tenancy.schemas.team import (
|
||||
@@ -98,17 +111,6 @@ from app.modules.tenancy.schemas.team import (
|
||||
UserPermissionsResponse,
|
||||
)
|
||||
|
||||
# Store domain schemas
|
||||
from app.modules.tenancy.schemas.store_domain import (
|
||||
DomainDeletionResponse,
|
||||
DomainVerificationInstructions,
|
||||
DomainVerificationResponse,
|
||||
StoreDomainCreate,
|
||||
StoreDomainListResponse,
|
||||
StoreDomainResponse,
|
||||
StoreDomainUpdate,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Merchant
|
||||
"MerchantBase",
|
||||
@@ -116,6 +118,9 @@ __all__ = [
|
||||
"MerchantCreateResponse",
|
||||
"MerchantDetailResponse",
|
||||
"MerchantListResponse",
|
||||
"MerchantPortalProfileResponse",
|
||||
"MerchantPortalProfileUpdate",
|
||||
"MerchantPortalStoreListResponse",
|
||||
"MerchantResponse",
|
||||
"MerchantSummary",
|
||||
"MerchantTransferOwnership",
|
||||
|
||||
@@ -10,6 +10,8 @@ from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator
|
||||
|
||||
from app.modules.tenancy.schemas.store import StoreSummary
|
||||
|
||||
|
||||
class MerchantBase(BaseModel):
|
||||
"""Base schema for merchant with common fields."""
|
||||
@@ -214,3 +216,46 @@ class MerchantTransferOwnershipResponse(BaseModel):
|
||||
|
||||
transferred_at: datetime
|
||||
transfer_reason: str | None
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Merchant Portal Schemas (for merchant-facing routes)
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class MerchantPortalProfileResponse(BaseModel):
|
||||
"""Merchant profile as seen by the merchant owner."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
name: str
|
||||
description: str | None
|
||||
contact_email: str
|
||||
contact_phone: str | None
|
||||
website: str | None
|
||||
business_address: str | None
|
||||
tax_number: str | None
|
||||
is_verified: bool
|
||||
|
||||
|
||||
class MerchantPortalProfileUpdate(BaseModel):
|
||||
"""Merchant profile update from the merchant portal.
|
||||
Excludes admin-only fields (is_active, is_verified)."""
|
||||
|
||||
name: str | None = Field(None, min_length=2, max_length=200)
|
||||
description: str | None = None
|
||||
contact_email: EmailStr | None = None
|
||||
contact_phone: str | None = None
|
||||
website: str | None = None
|
||||
business_address: str | None = None
|
||||
tax_number: str | None = None
|
||||
|
||||
|
||||
class MerchantPortalStoreListResponse(BaseModel):
|
||||
"""Paginated store list for the merchant portal."""
|
||||
|
||||
stores: list[StoreSummary]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
@@ -84,7 +84,7 @@ class TeamMemberInvite(TeamMemberBase):
|
||||
)
|
||||
|
||||
@field_validator("role_name")
|
||||
def validate_role_name(cls, v):
|
||||
def validate_role_name(self, v):
|
||||
"""Validate role name is in allowed presets."""
|
||||
if v is not None:
|
||||
allowed_roles = ["manager", "staff", "support", "viewer", "marketing"]
|
||||
@@ -95,7 +95,7 @@ class TeamMemberInvite(TeamMemberBase):
|
||||
return v.lower() if v else v
|
||||
|
||||
@field_validator("custom_permissions")
|
||||
def validate_custom_permissions(cls, v, values):
|
||||
def validate_custom_permissions(self, v, values):
|
||||
"""Ensure either role_id/role_name OR custom_permissions is provided."""
|
||||
if v is not None and len(v) > 0:
|
||||
# If custom permissions provided, role_name should be provided too
|
||||
@@ -170,7 +170,7 @@ class InvitationAccept(BaseModel):
|
||||
last_name: str = Field(..., min_length=1, max_length=100)
|
||||
|
||||
@field_validator("password")
|
||||
def validate_password_strength(cls, v):
|
||||
def validate_password_strength(self, v):
|
||||
"""Validate password meets minimum requirements."""
|
||||
if len(v) < 8:
|
||||
raise ValueError("Password must be at least 8 characters long")
|
||||
|
||||
Reference in New Issue
Block a user