refactor: clean up legacy models and migrate remaining schemas
Delete empty stub files from models/database/: - audit.py, backup.py, configuration.py, monitoring.py - notification.py, payment.py, search.py, task.py Delete re-export files: - models/database/subscription.py → app.modules.billing.models - models/database/architecture_scan.py → app.modules.dev_tools.models - models/database/test_run.py → app.modules.dev_tools.models - models/schema/subscription.py → app.modules.billing.schemas - models/schema/marketplace.py (empty) - models/schema/monitoring.py (empty) Migrate schemas to canonical module locations: - billing.py → app/modules/billing/schemas/ - vendor_product.py → app/modules/catalog/schemas/ - homepage_sections.py → app/modules/cms/schemas/ Keep as CORE (framework-level, used everywhere): - models/schema/: admin, auth, base, company, email, image, media, team, vendor* - models/database/: admin*, base, company, email, feature, media, platform*, user, vendor* Update 30+ files to use canonical import locations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ from app.services.code_quality_service import (
|
|||||||
code_quality_service,
|
code_quality_service,
|
||||||
)
|
)
|
||||||
from app.tasks.code_quality_tasks import execute_code_quality_scan
|
from app.tasks.code_quality_tasks import execute_code_quality_scan
|
||||||
from models.database.architecture_scan import ArchitectureScan
|
from app.modules.dev_tools.models import ArchitectureScan
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from app.modules.analytics.schemas import CodeQualityDashboardStatsResponse
|
from app.modules.analytics.schemas import CodeQualityDashboardStatsResponse
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from app.core.database import get_db
|
|||||||
from app.services.admin_subscription_service import admin_subscription_service
|
from app.services.admin_subscription_service import admin_subscription_service
|
||||||
from app.services.subscription_service import subscription_service
|
from app.services.subscription_service import subscription_service
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.billing import (
|
from app.modules.billing.schemas import (
|
||||||
BillingHistoryListResponse,
|
BillingHistoryListResponse,
|
||||||
BillingHistoryWithVendor,
|
BillingHistoryWithVendor,
|
||||||
SubscriptionStatsResponse,
|
SubscriptionStatsResponse,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from app.core.database import get_db
|
|||||||
from app.services.subscription_service import subscription_service
|
from app.services.subscription_service import subscription_service
|
||||||
from app.services.vendor_product_service import vendor_product_service
|
from app.services.vendor_product_service import vendor_product_service
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.vendor_product import (
|
from app.modules.catalog.schemas import (
|
||||||
CatalogVendor,
|
CatalogVendor,
|
||||||
CatalogVendorsResponse,
|
CatalogVendorsResponse,
|
||||||
RemoveProductResponse,
|
RemoveProductResponse,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from sqlalchemy.orm import Session
|
|||||||
from app.core.database import get_db
|
from app.core.database import get_db
|
||||||
from app.exceptions import ResourceNotFoundException
|
from app.exceptions import ResourceNotFoundException
|
||||||
from app.services.platform_pricing_service import platform_pricing_service
|
from app.services.platform_pricing_service import platform_pricing_service
|
||||||
from models.database.subscription import TierCode
|
from app.modules.billing.models import TierCode
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ def get_tiers(db: Session = Depends(get_db)) -> list[TierResponse]:
|
|||||||
return [_tier_to_response(tier, is_from_db=True) for tier in db_tiers]
|
return [_tier_to_response(tier, is_from_db=True) for tier in db_tiers]
|
||||||
|
|
||||||
# Fallback to hardcoded tiers
|
# Fallback to hardcoded tiers
|
||||||
from models.database.subscription import TIER_LIMITS
|
from app.modules.billing.models import TIER_LIMITS
|
||||||
|
|
||||||
tiers = []
|
tiers = []
|
||||||
for tier_code in TIER_LIMITS:
|
for tier_code in TIER_LIMITS:
|
||||||
|
|||||||
2
app/api/v1/vendor/products.py
vendored
2
app/api/v1/vendor/products.py
vendored
@@ -26,7 +26,7 @@ from app.modules.catalog.schemas import (
|
|||||||
ProductToggleResponse,
|
ProductToggleResponse,
|
||||||
ProductUpdate,
|
ProductUpdate,
|
||||||
)
|
)
|
||||||
from models.schema.vendor_product import (
|
from app.modules.catalog.schemas import (
|
||||||
VendorDirectProductCreate,
|
VendorDirectProductCreate,
|
||||||
VendorProductCreateResponse,
|
VendorProductCreateResponse,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from datetime import datetime, timezone
|
|||||||
import stripe
|
import stripe
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
BillingHistory,
|
BillingHistory,
|
||||||
StripeWebhookEvent,
|
StripeWebhookEvent,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from sqlalchemy import func
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.modules.catalog.models import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||||
from models.database.vendor import VendorUser
|
from models.database.vendor import VendorUser
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from app.api.deps import get_current_admin_api, require_module_access
|
|||||||
from app.core.database import get_db
|
from app.core.database import get_db
|
||||||
from app.modules.billing.services import admin_subscription_service, subscription_service
|
from app.modules.billing.services import admin_subscription_service, subscription_service
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.schema.billing import (
|
from app.modules.billing.schemas import (
|
||||||
BillingHistoryListResponse,
|
BillingHistoryListResponse,
|
||||||
BillingHistoryWithVendor,
|
BillingHistoryWithVendor,
|
||||||
SubscriptionStatsResponse,
|
SubscriptionStatsResponse,
|
||||||
|
|||||||
@@ -32,24 +32,70 @@ from app.modules.billing.schemas.subscription import (
|
|||||||
CanAddTeamMemberResponse,
|
CanAddTeamMemberResponse,
|
||||||
FeatureCheckResponse,
|
FeatureCheckResponse,
|
||||||
)
|
)
|
||||||
|
from app.modules.billing.schemas.billing import (
|
||||||
|
# Subscription Tier Admin schemas
|
||||||
|
SubscriptionTierBase,
|
||||||
|
SubscriptionTierCreate,
|
||||||
|
SubscriptionTierUpdate,
|
||||||
|
SubscriptionTierResponse,
|
||||||
|
SubscriptionTierListResponse,
|
||||||
|
# Vendor Subscription schemas
|
||||||
|
VendorSubscriptionResponse,
|
||||||
|
VendorSubscriptionWithVendor,
|
||||||
|
VendorSubscriptionListResponse,
|
||||||
|
VendorSubscriptionCreate,
|
||||||
|
VendorSubscriptionUpdate,
|
||||||
|
# Billing History schemas
|
||||||
|
BillingHistoryResponse,
|
||||||
|
BillingHistoryWithVendor,
|
||||||
|
BillingHistoryListResponse,
|
||||||
|
# Checkout & Portal schemas
|
||||||
|
CheckoutRequest,
|
||||||
|
CheckoutResponse,
|
||||||
|
PortalSessionResponse,
|
||||||
|
# Stats schemas
|
||||||
|
SubscriptionStatsResponse,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Tier schemas
|
# Tier schemas (subscription.py)
|
||||||
"TierFeatures",
|
"TierFeatures",
|
||||||
"TierLimits",
|
"TierLimits",
|
||||||
"TierInfo",
|
"TierInfo",
|
||||||
# Subscription CRUD schemas
|
# Subscription CRUD schemas (subscription.py)
|
||||||
"SubscriptionCreate",
|
"SubscriptionCreate",
|
||||||
"SubscriptionUpdate",
|
"SubscriptionUpdate",
|
||||||
"SubscriptionResponse",
|
"SubscriptionResponse",
|
||||||
# Usage schemas
|
# Usage schemas (subscription.py)
|
||||||
"SubscriptionUsage",
|
"SubscriptionUsage",
|
||||||
"UsageSummary",
|
"UsageSummary",
|
||||||
"SubscriptionStatusResponse",
|
"SubscriptionStatusResponse",
|
||||||
# Limit check schemas
|
# Limit check schemas (subscription.py)
|
||||||
"LimitCheckResult",
|
"LimitCheckResult",
|
||||||
"CanCreateOrderResponse",
|
"CanCreateOrderResponse",
|
||||||
"CanAddProductResponse",
|
"CanAddProductResponse",
|
||||||
"CanAddTeamMemberResponse",
|
"CanAddTeamMemberResponse",
|
||||||
"FeatureCheckResponse",
|
"FeatureCheckResponse",
|
||||||
|
# Subscription Tier Admin schemas (billing.py)
|
||||||
|
"SubscriptionTierBase",
|
||||||
|
"SubscriptionTierCreate",
|
||||||
|
"SubscriptionTierUpdate",
|
||||||
|
"SubscriptionTierResponse",
|
||||||
|
"SubscriptionTierListResponse",
|
||||||
|
# Vendor Subscription schemas (billing.py)
|
||||||
|
"VendorSubscriptionResponse",
|
||||||
|
"VendorSubscriptionWithVendor",
|
||||||
|
"VendorSubscriptionListResponse",
|
||||||
|
"VendorSubscriptionCreate",
|
||||||
|
"VendorSubscriptionUpdate",
|
||||||
|
# Billing History schemas (billing.py)
|
||||||
|
"BillingHistoryResponse",
|
||||||
|
"BillingHistoryWithVendor",
|
||||||
|
"BillingHistoryListResponse",
|
||||||
|
# Checkout & Portal schemas (billing.py)
|
||||||
|
"CheckoutRequest",
|
||||||
|
"CheckoutResponse",
|
||||||
|
"PortalSessionResponse",
|
||||||
|
# Stats schemas (billing.py)
|
||||||
|
"SubscriptionStatsResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# models/schema/billing.py
|
# app/modules/billing/schemas/billing.py
|
||||||
"""
|
"""
|
||||||
Pydantic schemas for billing and subscription operations.
|
Pydantic schemas for billing and subscription operations.
|
||||||
|
|
||||||
@@ -15,6 +15,23 @@ from app.modules.catalog.schemas.product import (
|
|||||||
ProductDeleteResponse,
|
ProductDeleteResponse,
|
||||||
ProductToggleResponse,
|
ProductToggleResponse,
|
||||||
)
|
)
|
||||||
|
from app.modules.catalog.schemas.vendor_product import (
|
||||||
|
# List/Detail schemas
|
||||||
|
VendorProductListItem,
|
||||||
|
VendorProductListResponse,
|
||||||
|
VendorProductStats,
|
||||||
|
VendorProductDetail,
|
||||||
|
# Catalog vendor schemas
|
||||||
|
CatalogVendor,
|
||||||
|
CatalogVendorsResponse,
|
||||||
|
# CRUD schemas
|
||||||
|
TranslationUpdate,
|
||||||
|
VendorProductCreate,
|
||||||
|
VendorDirectProductCreate,
|
||||||
|
VendorProductUpdate,
|
||||||
|
VendorProductCreateResponse,
|
||||||
|
RemoveProductResponse,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Catalog browsing schemas (storefront)
|
# Catalog browsing schemas (storefront)
|
||||||
@@ -29,4 +46,17 @@ __all__ = [
|
|||||||
"ProductListResponse",
|
"ProductListResponse",
|
||||||
"ProductDeleteResponse",
|
"ProductDeleteResponse",
|
||||||
"ProductToggleResponse",
|
"ProductToggleResponse",
|
||||||
|
# Vendor Product schemas (admin)
|
||||||
|
"VendorProductListItem",
|
||||||
|
"VendorProductListResponse",
|
||||||
|
"VendorProductStats",
|
||||||
|
"VendorProductDetail",
|
||||||
|
"CatalogVendor",
|
||||||
|
"CatalogVendorsResponse",
|
||||||
|
"TranslationUpdate",
|
||||||
|
"VendorProductCreate",
|
||||||
|
"VendorDirectProductCreate",
|
||||||
|
"VendorProductUpdate",
|
||||||
|
"VendorProductCreateResponse",
|
||||||
|
"RemoveProductResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# models/schema/vendor_product.py
|
# app/modules/catalog/schemas/vendor_product.py
|
||||||
"""
|
"""
|
||||||
Pydantic schemas for vendor product catalog operations.
|
Pydantic schemas for vendor product catalog operations.
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ from app.modules.cms.schemas.content_page import (
|
|||||||
ContentPageCreate,
|
ContentPageCreate,
|
||||||
ContentPageUpdate,
|
ContentPageUpdate,
|
||||||
ContentPageResponse,
|
ContentPageResponse,
|
||||||
HomepageSectionsResponse,
|
HomepageSectionsResponse as ContentPageHomepageSectionsResponse,
|
||||||
SectionUpdateResponse,
|
SectionUpdateResponse,
|
||||||
# Vendor schemas
|
# Vendor schemas
|
||||||
VendorContentPageCreate,
|
VendorContentPageCreate,
|
||||||
@@ -18,19 +18,46 @@ from app.modules.cms.schemas.content_page import (
|
|||||||
PublicContentPageResponse,
|
PublicContentPageResponse,
|
||||||
ContentPageListItem,
|
ContentPageListItem,
|
||||||
)
|
)
|
||||||
|
from app.modules.cms.schemas.homepage_sections import (
|
||||||
|
# Translatable text
|
||||||
|
TranslatableText,
|
||||||
|
# Section components
|
||||||
|
HeroButton,
|
||||||
|
HeroSection,
|
||||||
|
FeatureCard,
|
||||||
|
FeaturesSection,
|
||||||
|
PricingSection,
|
||||||
|
CTASection,
|
||||||
|
# Main structure
|
||||||
|
HomepageSections,
|
||||||
|
# API schemas
|
||||||
|
SectionUpdateRequest,
|
||||||
|
HomepageSectionsResponse,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# Admin
|
# Content Page - Admin
|
||||||
"ContentPageCreate",
|
"ContentPageCreate",
|
||||||
"ContentPageUpdate",
|
"ContentPageUpdate",
|
||||||
"ContentPageResponse",
|
"ContentPageResponse",
|
||||||
"HomepageSectionsResponse",
|
"ContentPageHomepageSectionsResponse",
|
||||||
"SectionUpdateResponse",
|
"SectionUpdateResponse",
|
||||||
# Vendor
|
# Content Page - Vendor
|
||||||
"VendorContentPageCreate",
|
"VendorContentPageCreate",
|
||||||
"VendorContentPageUpdate",
|
"VendorContentPageUpdate",
|
||||||
"CMSUsageResponse",
|
"CMSUsageResponse",
|
||||||
# Public
|
# Content Page - Public
|
||||||
"PublicContentPageResponse",
|
"PublicContentPageResponse",
|
||||||
"ContentPageListItem",
|
"ContentPageListItem",
|
||||||
|
# Homepage Sections
|
||||||
|
"TranslatableText",
|
||||||
|
"HeroButton",
|
||||||
|
"HeroSection",
|
||||||
|
"FeatureCard",
|
||||||
|
"FeaturesSection",
|
||||||
|
"PricingSection",
|
||||||
|
"CTASection",
|
||||||
|
"HomepageSections",
|
||||||
|
"SectionUpdateRequest",
|
||||||
|
"HomepageSectionsResponse",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -899,7 +899,7 @@ class ContentPageService:
|
|||||||
ContentPageNotFoundException: If page not found
|
ContentPageNotFoundException: If page not found
|
||||||
ValidationError: If sections schema invalid
|
ValidationError: If sections schema invalid
|
||||||
"""
|
"""
|
||||||
from models.schema.homepage_sections import HomepageSections
|
from app.modules.cms.schemas import HomepageSections
|
||||||
|
|
||||||
page = ContentPageService.get_page_by_id_or_raise(db, page_id)
|
page = ContentPageService.get_page_by_id_or_raise(db, page_id)
|
||||||
|
|
||||||
@@ -941,7 +941,7 @@ class ContentPageService:
|
|||||||
ContentPageNotFoundException: If page not found
|
ContentPageNotFoundException: If page not found
|
||||||
ValueError: If section name is invalid
|
ValueError: If section name is invalid
|
||||||
"""
|
"""
|
||||||
from models.schema.homepage_sections import (
|
from app.modules.cms.schemas import (
|
||||||
HeroSection,
|
HeroSection,
|
||||||
FeaturesSection,
|
FeaturesSection,
|
||||||
PricingSection,
|
PricingSection,
|
||||||
@@ -989,7 +989,7 @@ class ContentPageService:
|
|||||||
Returns:
|
Returns:
|
||||||
Empty sections dict with language placeholders
|
Empty sections dict with language placeholders
|
||||||
"""
|
"""
|
||||||
from models.schema.homepage_sections import HomepageSections
|
from app.modules.cms.schemas import HomepageSections
|
||||||
|
|
||||||
if languages is None:
|
if languages is None:
|
||||||
languages = ["fr", "de", "en"]
|
languages = ["fr", "de", "en"]
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ from datetime import UTC, datetime
|
|||||||
from sqlalchemy import case, desc, func
|
from sqlalchemy import case, desc, func
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.architecture_scan import ArchitectureScan
|
from app.modules.dev_tools.models import ArchitectureScan
|
||||||
from app.modules.marketplace.models import MarketplaceImportJob
|
from app.modules.marketplace.models import MarketplaceImportJob
|
||||||
from models.database.test_run import TestRun
|
from app.modules.dev_tools.models import TestRun
|
||||||
|
|
||||||
|
|
||||||
class BackgroundTasksService:
|
class BackgroundTasksService:
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ async def homepage(
|
|||||||
context["platform"] = platform
|
context["platform"] = platform
|
||||||
|
|
||||||
# Include subscription tiers for pricing section
|
# Include subscription tiers for pricing section
|
||||||
from models.database.subscription import TIER_LIMITS, TierCode
|
from app.modules.billing.models import TIER_LIMITS, TierCode
|
||||||
|
|
||||||
tiers = []
|
tiers = []
|
||||||
for tier_code, limits in TIER_LIMITS.items():
|
for tier_code, limits in TIER_LIMITS.items():
|
||||||
@@ -202,7 +202,7 @@ async def homepage(
|
|||||||
context["platform"] = platform
|
context["platform"] = platform
|
||||||
|
|
||||||
# Fetch tiers for display (use API service internally)
|
# Fetch tiers for display (use API service internally)
|
||||||
from models.database.subscription import TIER_LIMITS, TierCode
|
from app.modules.billing.models import TIER_LIMITS, TierCode
|
||||||
|
|
||||||
tiers = []
|
tiers = []
|
||||||
for tier_code, limits in TIER_LIMITS.items():
|
for tier_code, limits in TIER_LIMITS.items():
|
||||||
@@ -276,7 +276,7 @@ async def pricing_page(
|
|||||||
context = get_platform_context(request, db)
|
context = get_platform_context(request, db)
|
||||||
|
|
||||||
# Reuse tier data from homepage
|
# Reuse tier data from homepage
|
||||||
from models.database.subscription import TIER_LIMITS, TierCode
|
from app.modules.billing.models import TIER_LIMITS, TierCode
|
||||||
|
|
||||||
tiers = []
|
tiers = []
|
||||||
for tier_code, limits in TIER_LIMITS.items():
|
for tier_code, limits in TIER_LIMITS.items():
|
||||||
@@ -352,7 +352,7 @@ async def signup_page(
|
|||||||
context["is_annual"] = annual
|
context["is_annual"] = annual
|
||||||
|
|
||||||
# Get tiers for tier selection step
|
# Get tiers for tier selection step
|
||||||
from models.database.subscription import TIER_LIMITS, TierCode
|
from app.modules.billing.models import TIER_LIMITS, TierCode
|
||||||
|
|
||||||
tiers = []
|
tiers = []
|
||||||
for tier_code, limits in TIER_LIMITS.items():
|
for tier_code, limits in TIER_LIMITS.items():
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from sqlalchemy import func
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.modules.catalog.models import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
CapacitySnapshot,
|
CapacitySnapshot,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
VendorSubscription,
|
VendorSubscription,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ from app.exceptions.feature import (
|
|||||||
TierNotFoundError,
|
TierNotFoundError,
|
||||||
)
|
)
|
||||||
from models.database.feature import Feature, FeatureCode
|
from models.database.feature import Feature, FeatureCode
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class PlatformHealthService:
|
|||||||
|
|
||||||
Returns aggregated limits and current usage for capacity planning.
|
Returns aggregated limits and current usage for capacity planning.
|
||||||
"""
|
"""
|
||||||
from models.database.subscription import VendorSubscription
|
from app.modules.billing.models import VendorSubscription
|
||||||
from models.database.vendor import VendorUser
|
from models.database.vendor import VendorUser
|
||||||
|
|
||||||
# Get all active subscriptions with their limits
|
# Get all active subscriptions with their limits
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Handles database operations for subscription tiers and add-on products.
|
|||||||
|
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
SubscriptionTier,
|
SubscriptionTier,
|
||||||
TIER_LIMITS,
|
TIER_LIMITS,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from app.services.onboarding_service import OnboardingService
|
|||||||
from app.services.stripe_service import stripe_service
|
from app.services.stripe_service import stripe_service
|
||||||
from middleware.auth import AuthManager
|
from middleware.auth import AuthManager
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
TierCode,
|
TierCode,
|
||||||
TIER_LIMITS,
|
TIER_LIMITS,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from datetime import UTC, datetime
|
|||||||
|
|
||||||
from app.core.database import SessionLocal
|
from app.core.database import SessionLocal
|
||||||
from app.services.admin_notification_service import admin_notification_service
|
from app.services.admin_notification_service import admin_notification_service
|
||||||
from models.database.architecture_scan import ArchitectureScan, ArchitectureViolation
|
from app.modules.dev_tools.models import ArchitectureScan, ArchitectureViolation
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from datetime import UTC, datetime, timedelta
|
|||||||
|
|
||||||
from app.core.database import SessionLocal
|
from app.core.database import SessionLocal
|
||||||
from app.services.stripe_service import stripe_service
|
from app.services.stripe_service import stripe_service
|
||||||
from models.database.subscription import SubscriptionStatus, VendorSubscription
|
from app.modules.billing.models import SubscriptionStatus, VendorSubscription
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import logging
|
|||||||
|
|
||||||
from app.core.database import SessionLocal
|
from app.core.database import SessionLocal
|
||||||
from app.services.test_runner_service import test_runner_service
|
from app.services.test_runner_service import test_runner_service
|
||||||
from models.database.test_run import TestRun
|
from app.modules.dev_tools.models import TestRun
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ class ArchitectureScan(Base):
|
|||||||
**Import in Service:**
|
**Import in Service:**
|
||||||
```python
|
```python
|
||||||
# app/services/code_quality_service.py
|
# app/services/code_quality_service.py
|
||||||
from models.database.architecture_scan import ArchitectureScan
|
from app.modules.dev_tools.models import ArchitectureScan
|
||||||
```
|
```
|
||||||
|
|
||||||
**Pydantic Schema:**
|
**Pydantic Schema:**
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from .admin import (
|
|||||||
from app.modules.messaging.models import AdminNotification
|
from app.modules.messaging.models import AdminNotification
|
||||||
from .admin_menu_config import AdminMenuConfig, FrontendType, MANDATORY_MENU_ITEMS
|
from .admin_menu_config import AdminMenuConfig, FrontendType, MANDATORY_MENU_ITEMS
|
||||||
from .admin_platform import AdminPlatform
|
from .admin_platform import AdminPlatform
|
||||||
from .architecture_scan import (
|
from app.modules.dev_tools.models import (
|
||||||
ArchitectureScan,
|
ArchitectureScan,
|
||||||
ArchitectureViolation,
|
ArchitectureViolation,
|
||||||
ViolationAssignment,
|
ViolationAssignment,
|
||||||
@@ -82,7 +82,7 @@ from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, Ven
|
|||||||
from app.modules.orders.models import Order, OrderItem
|
from app.modules.orders.models import Order, OrderItem
|
||||||
from app.modules.orders.models import OrderItemException
|
from app.modules.orders.models import OrderItemException
|
||||||
from app.modules.catalog.models import Product, ProductTranslation
|
from app.modules.catalog.models import Product, ProductTranslation
|
||||||
from .subscription import (
|
from app.modules.billing.models import (
|
||||||
AddOnCategory,
|
AddOnCategory,
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
BillingHistory,
|
BillingHistory,
|
||||||
@@ -95,7 +95,7 @@ from .subscription import (
|
|||||||
VendorAddOn,
|
VendorAddOn,
|
||||||
VendorSubscription,
|
VendorSubscription,
|
||||||
)
|
)
|
||||||
from .test_run import TestCollection, TestResult, TestRun
|
from app.modules.dev_tools.models import TestCollection, TestResult, TestRun
|
||||||
from .user import User
|
from .user import User
|
||||||
from .vendor import Role, Vendor, VendorUser
|
from .vendor import Role, Vendor, VendorUser
|
||||||
from .vendor_domain import VendorDomain
|
from .vendor_domain import VendorDomain
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# models/database/architecture_scan.py
|
|
||||||
"""
|
|
||||||
Architecture Scan Models - LEGACY LOCATION
|
|
||||||
|
|
||||||
This file exists for backward compatibility.
|
|
||||||
The canonical location is now: app/modules/dev_tools/models/architecture_scan.py
|
|
||||||
|
|
||||||
All imports should use the new location:
|
|
||||||
from app.modules.dev_tools.models import ArchitectureScan, ArchitectureViolation, ...
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export from canonical location for backward compatibility
|
|
||||||
from app.modules.dev_tools.models.architecture_scan import (
|
|
||||||
ArchitectureScan,
|
|
||||||
ArchitectureViolation,
|
|
||||||
ArchitectureRule,
|
|
||||||
ViolationAssignment,
|
|
||||||
ViolationComment,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"ArchitectureScan",
|
|
||||||
"ArchitectureViolation",
|
|
||||||
"ArchitectureRule",
|
|
||||||
"ViolationAssignment",
|
|
||||||
"ViolationComment",
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# AuditLog, DataExportLog models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# BackupLog, RestoreLog models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# PlatformConfig, VendorConfig, FeatureFlag models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# PerformanceMetric, ErrorLog, SystemAlert models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# NotificationTemplate, NotificationQueue, NotificationLog models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Payment, PaymentMethod, VendorPaymentConfig models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# SearchIndex, SearchQuery models
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
# models/database/subscription.py
|
|
||||||
"""
|
|
||||||
Legacy location for subscription models.
|
|
||||||
|
|
||||||
MIGRATED: All models have been moved to app.modules.billing.models.subscription.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.billing.models import (
|
|
||||||
VendorSubscription,
|
|
||||||
SubscriptionTier,
|
|
||||||
TierCode,
|
|
||||||
SubscriptionStatus,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export everything from the new canonical location
|
|
||||||
from app.modules.billing.models.subscription import (
|
|
||||||
# Enums
|
|
||||||
TierCode,
|
|
||||||
SubscriptionStatus,
|
|
||||||
AddOnCategory,
|
|
||||||
BillingPeriod,
|
|
||||||
# Models
|
|
||||||
SubscriptionTier,
|
|
||||||
AddOnProduct,
|
|
||||||
VendorAddOn,
|
|
||||||
StripeWebhookEvent,
|
|
||||||
BillingHistory,
|
|
||||||
VendorSubscription,
|
|
||||||
CapacitySnapshot,
|
|
||||||
# Legacy constants
|
|
||||||
TIER_LIMITS,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
# Enums
|
|
||||||
"TierCode",
|
|
||||||
"SubscriptionStatus",
|
|
||||||
"AddOnCategory",
|
|
||||||
"BillingPeriod",
|
|
||||||
# Models
|
|
||||||
"SubscriptionTier",
|
|
||||||
"AddOnProduct",
|
|
||||||
"VendorAddOn",
|
|
||||||
"StripeWebhookEvent",
|
|
||||||
"BillingHistory",
|
|
||||||
"VendorSubscription",
|
|
||||||
"CapacitySnapshot",
|
|
||||||
# Legacy constants
|
|
||||||
"TIER_LIMITS",
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# TaskLog model
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# models/database/test_run.py
|
|
||||||
"""
|
|
||||||
Test Run Models - LEGACY LOCATION
|
|
||||||
|
|
||||||
This file exists for backward compatibility.
|
|
||||||
The canonical location is now: app/modules/dev_tools/models/test_run.py
|
|
||||||
|
|
||||||
All imports should use the new location:
|
|
||||||
from app.modules.dev_tools.models import TestRun, TestResult, TestCollection
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export from canonical location for backward compatibility
|
|
||||||
from app.modules.dev_tools.models.test_run import (
|
|
||||||
TestRun,
|
|
||||||
TestResult,
|
|
||||||
TestCollection,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"TestRun",
|
|
||||||
"TestResult",
|
|
||||||
"TestCollection",
|
|
||||||
]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Marketplace import job models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Monitoring models
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
# models/schema/subscription.py
|
|
||||||
"""
|
|
||||||
Legacy location for subscription schemas.
|
|
||||||
|
|
||||||
MIGRATED: All schemas have been moved to app.modules.billing.schemas.subscription.
|
|
||||||
|
|
||||||
New location:
|
|
||||||
from app.modules.billing.schemas import (
|
|
||||||
SubscriptionCreate,
|
|
||||||
SubscriptionResponse,
|
|
||||||
TierInfo,
|
|
||||||
)
|
|
||||||
|
|
||||||
This file re-exports from the new location for backward compatibility.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Re-export everything from the new canonical location
|
|
||||||
from app.modules.billing.schemas.subscription import (
|
|
||||||
# Tier schemas
|
|
||||||
TierFeatures,
|
|
||||||
TierLimits,
|
|
||||||
TierInfo,
|
|
||||||
# Subscription CRUD schemas
|
|
||||||
SubscriptionCreate,
|
|
||||||
SubscriptionUpdate,
|
|
||||||
SubscriptionResponse,
|
|
||||||
# Usage schemas
|
|
||||||
SubscriptionUsage,
|
|
||||||
UsageSummary,
|
|
||||||
SubscriptionStatusResponse,
|
|
||||||
# Limit check schemas
|
|
||||||
LimitCheckResult,
|
|
||||||
CanCreateOrderResponse,
|
|
||||||
CanAddProductResponse,
|
|
||||||
CanAddTeamMemberResponse,
|
|
||||||
FeatureCheckResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
# Tier schemas
|
|
||||||
"TierFeatures",
|
|
||||||
"TierLimits",
|
|
||||||
"TierInfo",
|
|
||||||
# Subscription CRUD schemas
|
|
||||||
"SubscriptionCreate",
|
|
||||||
"SubscriptionUpdate",
|
|
||||||
"SubscriptionResponse",
|
|
||||||
# Usage schemas
|
|
||||||
"SubscriptionUsage",
|
|
||||||
"UsageSummary",
|
|
||||||
"SubscriptionStatusResponse",
|
|
||||||
# Limit check schemas
|
|
||||||
"LimitCheckResult",
|
|
||||||
"CanCreateOrderResponse",
|
|
||||||
"CanAddProductResponse",
|
|
||||||
"CanAddTeamMemberResponse",
|
|
||||||
"FeatureCheckResponse",
|
|
||||||
]
|
|
||||||
@@ -6,7 +6,7 @@ Tests the /api/v1/platform/pricing/* endpoints.
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
SubscriptionTier,
|
SubscriptionTier,
|
||||||
TierCode,
|
TierCode,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from unittest.mock import MagicMock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from models.database.company import Company
|
from models.database.company import Company
|
||||||
from models.database.subscription import TierCode
|
from app.modules.billing.models import TierCode
|
||||||
from models.database.user import User
|
from models.database.user import User
|
||||||
from models.database.vendor import Vendor
|
from models.database.vendor import Vendor
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from app.tasks.subscription_tasks import (
|
|||||||
reset_period_counters,
|
reset_period_counters,
|
||||||
sync_stripe_status,
|
sync_stripe_status,
|
||||||
)
|
)
|
||||||
from models.database.subscription import SubscriptionStatus, VendorSubscription
|
from app.modules.billing.models import SubscriptionStatus, VendorSubscription
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from app.services.billing_service import (
|
|||||||
SubscriptionNotCancelledError,
|
SubscriptionNotCancelledError,
|
||||||
TierNotFoundError,
|
TierNotFoundError,
|
||||||
)
|
)
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
AddOnProduct,
|
AddOnProduct,
|
||||||
BillingHistory,
|
BillingHistory,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from app.services.capacity_forecast_service import (
|
|||||||
CapacityForecastService,
|
CapacityForecastService,
|
||||||
capacity_forecast_service,
|
capacity_forecast_service,
|
||||||
)
|
)
|
||||||
from models.database.subscription import CapacitySnapshot
|
from app.modules.billing.models import CapacitySnapshot
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import pytest
|
|||||||
from app.exceptions import FeatureNotFoundError, InvalidFeatureCodesError, TierNotFoundError
|
from app.exceptions import FeatureNotFoundError, InvalidFeatureCodesError, TierNotFoundError
|
||||||
from app.services.feature_service import FeatureService, feature_service
|
from app.services.feature_service import FeatureService, feature_service
|
||||||
from models.database.feature import Feature
|
from models.database.feature import Feature
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from unittest.mock import MagicMock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.handlers.stripe_webhook import StripeWebhookHandler
|
from app.handlers.stripe_webhook import StripeWebhookHandler
|
||||||
from models.database.subscription import (
|
from app.modules.billing.models import (
|
||||||
BillingHistory,
|
BillingHistory,
|
||||||
StripeWebhookEvent,
|
StripeWebhookEvent,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import pytest
|
|||||||
|
|
||||||
from app.services.usage_service import UsageService, usage_service
|
from app.services.usage_service import UsageService, usage_service
|
||||||
from app.modules.catalog.models import Product
|
from app.modules.catalog.models import Product
|
||||||
from models.database.subscription import SubscriptionTier, VendorSubscription
|
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||||
from models.database.vendor import VendorUser
|
from models.database.vendor import VendorUser
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user