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:
@@ -12,51 +12,59 @@ Usage:
|
||||
)
|
||||
"""
|
||||
|
||||
from app.modules.billing.schemas.billing import (
|
||||
BillingHistoryListResponse,
|
||||
# Billing History schemas
|
||||
BillingHistoryResponse,
|
||||
BillingHistoryWithMerchant,
|
||||
# Checkout & Portal schemas
|
||||
CheckoutRequest,
|
||||
CheckoutResponse,
|
||||
FeatureCatalogResponse,
|
||||
# Feature Catalog schemas
|
||||
FeatureDeclarationResponse,
|
||||
# Merchant Feature Override schemas
|
||||
MerchantFeatureOverrideEntry,
|
||||
MerchantFeatureOverrideResponse,
|
||||
MerchantSubscriptionAdminCreate,
|
||||
# Merchant Subscription Admin schemas
|
||||
MerchantSubscriptionAdminResponse,
|
||||
MerchantSubscriptionAdminUpdate,
|
||||
MerchantSubscriptionListResponse,
|
||||
MerchantSubscriptionWithMerchant,
|
||||
PortalSessionResponse,
|
||||
# Stats schemas
|
||||
SubscriptionStatsResponse,
|
||||
SubscriptionTierBase,
|
||||
SubscriptionTierCreate,
|
||||
SubscriptionTierListResponse,
|
||||
SubscriptionTierResponse,
|
||||
SubscriptionTierUpdate,
|
||||
# Subscription Tier Admin schemas
|
||||
TierFeatureLimitEntry,
|
||||
)
|
||||
from app.modules.billing.schemas.subscription import (
|
||||
# Tier schemas
|
||||
TierFeatureLimitResponse,
|
||||
TierInfo,
|
||||
# Subscription schemas
|
||||
MerchantSubscriptionCreate,
|
||||
MerchantSubscriptionUpdate,
|
||||
MerchantSubscriptionResponse,
|
||||
MerchantSubscriptionStatusResponse,
|
||||
ChangeTierRequest,
|
||||
ChangeTierResponse,
|
||||
FeatureCheckResponse,
|
||||
# Feature summary schemas
|
||||
FeatureSummaryResponse,
|
||||
# Limit check schemas
|
||||
LimitCheckResult,
|
||||
FeatureCheckResponse,
|
||||
)
|
||||
from app.modules.billing.schemas.billing import (
|
||||
# Subscription Tier Admin schemas
|
||||
TierFeatureLimitEntry,
|
||||
SubscriptionTierBase,
|
||||
SubscriptionTierCreate,
|
||||
SubscriptionTierUpdate,
|
||||
SubscriptionTierResponse,
|
||||
SubscriptionTierListResponse,
|
||||
# Merchant Subscription Admin schemas
|
||||
MerchantSubscriptionAdminResponse,
|
||||
MerchantSubscriptionWithMerchant,
|
||||
MerchantSubscriptionListResponse,
|
||||
MerchantSubscriptionAdminCreate,
|
||||
MerchantSubscriptionAdminUpdate,
|
||||
# Merchant Feature Override schemas
|
||||
MerchantFeatureOverrideEntry,
|
||||
MerchantFeatureOverrideResponse,
|
||||
# Billing History schemas
|
||||
BillingHistoryResponse,
|
||||
BillingHistoryWithMerchant,
|
||||
BillingHistoryListResponse,
|
||||
# Checkout & Portal schemas
|
||||
CheckoutRequest,
|
||||
CheckoutResponse,
|
||||
PortalSessionResponse,
|
||||
# Stats schemas
|
||||
SubscriptionStatsResponse,
|
||||
# Feature Catalog schemas
|
||||
FeatureDeclarationResponse,
|
||||
FeatureCatalogResponse,
|
||||
MerchantPortalAvailableTiersResponse,
|
||||
MerchantPortalInvoiceListResponse,
|
||||
MerchantPortalSubscriptionDetailResponse,
|
||||
# Merchant portal schemas
|
||||
MerchantPortalSubscriptionItem,
|
||||
MerchantPortalSubscriptionListResponse,
|
||||
# Subscription schemas
|
||||
MerchantSubscriptionCreate,
|
||||
MerchantSubscriptionResponse,
|
||||
MerchantSubscriptionStatusResponse,
|
||||
MerchantSubscriptionUpdate,
|
||||
# Tier schemas
|
||||
TierFeatureLimitResponse,
|
||||
TierInfo,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
@@ -73,6 +81,14 @@ __all__ = [
|
||||
# Limit check schemas (subscription.py)
|
||||
"LimitCheckResult",
|
||||
"FeatureCheckResponse",
|
||||
# Merchant portal schemas (subscription.py)
|
||||
"MerchantPortalSubscriptionItem",
|
||||
"MerchantPortalSubscriptionListResponse",
|
||||
"MerchantPortalSubscriptionDetailResponse",
|
||||
"MerchantPortalAvailableTiersResponse",
|
||||
"ChangeTierRequest",
|
||||
"ChangeTierResponse",
|
||||
"MerchantPortalInvoiceListResponse",
|
||||
# Subscription Tier Admin schemas (billing.py)
|
||||
"TierFeatureLimitEntry",
|
||||
"SubscriptionTierBase",
|
||||
|
||||
@@ -9,7 +9,6 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Subscription Tier Schemas
|
||||
# ============================================================================
|
||||
|
||||
@@ -9,7 +9,6 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Tier Information Schemas
|
||||
# ============================================================================
|
||||
@@ -141,3 +140,82 @@ class FeatureCheckResponse(BaseModel):
|
||||
message: str | None = None
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Merchant Portal Schemas (for merchant-facing routes)
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class MerchantPortalSubscriptionItem(BaseModel):
|
||||
"""Subscription item with tier and platform names for merchant portal list."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
# Base subscription fields (mirror MerchantSubscriptionResponse)
|
||||
id: int
|
||||
merchant_id: int
|
||||
platform_id: int
|
||||
tier_id: int | None
|
||||
status: str
|
||||
is_annual: bool
|
||||
period_start: datetime
|
||||
period_end: datetime
|
||||
trial_ends_at: datetime | None
|
||||
stripe_customer_id: str | None = None
|
||||
cancelled_at: datetime | None = None
|
||||
is_active: bool
|
||||
is_trial: bool
|
||||
trial_days_remaining: int | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
# Enrichment fields
|
||||
tier: str | None = None
|
||||
tier_name: str | None = None
|
||||
platform_name: str = ""
|
||||
|
||||
|
||||
class MerchantPortalSubscriptionListResponse(BaseModel):
|
||||
"""Paginated subscription list for merchant portal."""
|
||||
|
||||
subscriptions: list[MerchantPortalSubscriptionItem]
|
||||
total: int
|
||||
|
||||
|
||||
class MerchantPortalSubscriptionDetailResponse(BaseModel):
|
||||
"""Subscription detail with tier info for merchant portal."""
|
||||
|
||||
subscription: MerchantPortalSubscriptionItem
|
||||
tier: TierInfo | None = None
|
||||
|
||||
|
||||
class MerchantPortalAvailableTiersResponse(BaseModel):
|
||||
"""Available tiers for a platform."""
|
||||
|
||||
tiers: list[dict]
|
||||
current_tier: str | None = None
|
||||
|
||||
|
||||
class ChangeTierRequest(BaseModel):
|
||||
"""Request for changing subscription tier."""
|
||||
|
||||
tier_code: str
|
||||
is_annual: bool = False
|
||||
|
||||
|
||||
class ChangeTierResponse(BaseModel):
|
||||
"""Response after tier change."""
|
||||
|
||||
message: str
|
||||
new_tier: str | None = None
|
||||
effective_immediately: bool = False
|
||||
|
||||
|
||||
class MerchantPortalInvoiceListResponse(BaseModel):
|
||||
"""Paginated invoice list for merchant portal."""
|
||||
|
||||
invoices: list[dict]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user