Files
orion/create_project_structure.bat

356 lines
18 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
echo ========================================
echo FastAPI Project Structure Builder
echo (Safe Mode - Won't Override Existing Files)
echo ========================================
echo.
:: Create root directories
call :CreateDir "app"
call :CreateDir "app\api"
call :CreateDir "app\api\v1"
call :CreateDir "app\api\v1\admin"
call :CreateDir "app\api\v1\vendor"
call :CreateDir "app\api\v1\public"
call :CreateDir "app\api\v1\public\vendors"
call :CreateDir "app\api\v1\shared"
call :CreateDir "app\core"
call :CreateDir "app\exceptions"
call :CreateDir "app\services"
call :CreateDir "tasks"
call :CreateDir "models"
call :CreateDir "models\database"
call :CreateDir "models\schema"
call :CreateDir "middleware"
call :CreateDir "storage"
call :CreateDir "static"
call :CreateDir "static\admin"
call :CreateDir "static\vendor"
call :CreateDir "static\vendor\admin"
call :CreateDir "static\vendor\admin\marketplace"
call :CreateDir "static\shop"
call :CreateDir "static\shop\account"
call :CreateDir "static\css"
call :CreateDir "static\css\admin"
call :CreateDir "static\css\vendor"
call :CreateDir "static\css\shop"
call :CreateDir "static\css\shared"
call :CreateDir "static\css\themes"
call :CreateDir "static\js"
call :CreateDir "static\js\shared"
call :CreateDir "static\js\admin"
call :CreateDir "static\js\vendor"
call :CreateDir "static\js\shop"
echo.
echo Creating Python files...
echo.
:: Root files
call :CreatePyFile "main.py" "FastAPI application entry point"
:: API files
call :CreatePyFile "app\api\deps.py" "Common dependencies"
call :CreatePyFile "app\api\main.py" "API router setup"
call :CreatePyFile "app\api\__init__.py" ""
call :CreatePyFile "app\api\v1\__init__.py" ""
:: Admin API files
call :CreatePyFile "app\api\v1\admin\__init__.py" ""
call :CreatePyFile "app\api\v1\admin\auth.py" "Admin authentication"
call :CreatePyFile "app\api\v1\admin\vendors.py" "Vendor management - CRUD and bulk import"
call :CreatePyFile "app\api\v1\admin\dashboard.py" "Admin dashboard and statistics"
call :CreatePyFile "app\api\v1\admin\users.py" "User management across vendors"
call :CreatePyFile "app\api\v1\admin\marketplace.py" "System-wide marketplace monitoring"
call :CreatePyFile "app\api\v1\admin\monitoring.py" "Platform monitoring and alerts"
:: Vendor API files
call :CreatePyFile "app\api\v1\vendor\__init__.py" ""
call :CreatePyFile "app\api\v1\vendor\auth.py" "Vendor team authentication"
call :CreatePyFile "app\api\v1\vendor\dashboard.py" "Vendor dashboard and statistics"
call :CreatePyFile "app\api\v1\vendor\products.py" "Vendor catalog management - Product table"
call :CreatePyFile "app\api\v1\vendor\marketplace.py" "Marketplace import and selection - MarketplaceProduct table"
call :CreatePyFile "app\api\v1\vendor\orders.py" "Vendor order management"
call :CreatePyFile "app\api\v1\vendor\customers.py" "Vendor customer management"
call :CreatePyFile "app\api\v1\vendor\teams.py" "Team member management"
call :CreatePyFile "app\api\v1\vendor\inventory.py" "Inventory operations - vendor catalog products"
call :CreatePyFile "app\api\v1\vendor\payments.py" "Payment configuration and processing"
call :CreatePyFile "app\api\v1\vendor\media.py" "File and media management"
call :CreatePyFile "app\api\v1\vendor\notifications.py" "Notification management"
call :CreatePyFile "app\api\v1\vendor\settings.py" "Vendor settings and configuration"
:: Public API files
call :CreatePyFile "app\api\v1\public\__init__.py" ""
call :CreatePyFile "app\api\v1\public\vendors\shop.py" "Public shop info"
call :CreatePyFile "app\api\v1\public\vendors\products.py" "Public product catalog - Product table only"
call :CreatePyFile "app\api\v1\public\vendors\search.py" "Product search functionality"
call :CreatePyFile "app\api\v1\public\vendors\cart.py" "Shopping cart operations"
call :CreatePyFile "app\api\v1\public\vendors\orders.py" "Order placement"
call :CreatePyFile "app\api\v1\public\vendors\payments.py" "Payment processing"
call :CreatePyFile "app\api\v1\public\vendors\auth.py" "Customer authentication"
:: Shared API files
call :CreatePyFile "app\api\v1\shared\health.py" "Health checks"
call :CreatePyFile "app\api\v1\shared\webhooks.py" "External webhooks - Stripe, etc"
call :CreatePyFile "app\api\v1\shared\uploads.py" "File upload handling"
:: Core files
call :CreatePyFile "app\core\__init__.py" ""
call :CreatePyFile "app\core\config.py" "Configuration settings"
call :CreatePyFile "app\core\database.py" "Database setup"
call :CreatePyFile "app\core\lifespan.py" "App lifecycle management"
:: Exception files
call :CreatePyFile "app\exceptions\__init__.py" "All exception exports"
call :CreatePyFile "app\exceptions\base.py" "Base exception classes"
call :CreatePyFile "app\exceptions\handler.py" "Unified FastAPI exception handlers"
call :CreatePyFile "app\exceptions\auth.py" "Authentication and authorization exceptions"
call :CreatePyFile "app\exceptions\admin.py" "Admin operation exceptions"
call :CreatePyFile "app\exceptions\marketplace.py" "Import and marketplace exceptions"
call :CreatePyFile "app\exceptions\marketplace_product.py" "Marketplace staging exceptions"
call :CreatePyFile "app\exceptions\product.py" "Vendor catalog exceptions"
call :CreatePyFile "app\exceptions\vendor.py" "Vendor management exceptions"
call :CreatePyFile "app\exceptions\customer.py" "Customer management exceptions"
call :CreatePyFile "app\exceptions\order.py" "Order management exceptions"
call :CreatePyFile "app\exceptions\payment.py" "Payment processing exceptions"
call :CreatePyFile "app\exceptions\inventory.py" "Inventory management exceptions"
call :CreatePyFile "app\exceptions\media.py" "Media and file management exceptions"
call :CreatePyFile "app\exceptions\notification.py" "Notification exceptions"
call :CreatePyFile "app\exceptions\search.py" "Search exceptions"
call :CreatePyFile "app\exceptions\monitoring.py" "Monitoring exceptions"
call :CreatePyFile "app\exceptions\backup.py" "Backup and recovery exceptions"
:: Service files
call :CreatePyFile "app\services\__init__.py" ""
call :CreatePyFile "app\services\auth_service.py" "Authentication and authorization services"
call :CreatePyFile "app\services\admin_service.py" "Admin services"
call :CreatePyFile "app\services\vendor_service.py" "Vendor management services"
call :CreatePyFile "app\services\customer_service.py" "Customer services - vendor-scoped"
call :CreatePyFile "app\services\team_service.py" "Team management services"
call :CreatePyFile "app\services\marketplace_service.py" "Marketplace import services - MarketplaceProduct"
call :CreatePyFile "app\services\marketplace_product_service.py" "Marketplace staging services"
call :CreatePyFile "app\services\product_service.py" "Vendor catalog services - Product"
call :CreatePyFile "app\services\order_service.py" "Order services - vendor-scoped"
call :CreatePyFile "app\services\payment_service.py" "Payment processing services"
call :CreatePyFile "app\services\inventory_service.py" "Inventory services - vendor catalog"
call :CreatePyFile "app\services\media_service.py" "File and media management services"
call :CreatePyFile "app\services\notification_service.py" "Email and notification services"
call :CreatePyFile "app\services\search_service.py" "Search and indexing services"
call :CreatePyFile "app\services\cache_service.py" "Caching services"
call :CreatePyFile "app\services\audit_service.py" "Audit logging services"
call :CreatePyFile "app\services\monitoring_service.py" "Application monitoring services"
call :CreatePyFile "app\services\backup_service.py" "Backup and recovery services"
call :CreatePyFile "app\services\configuration_service.py" "Configuration management services"
call :CreatePyFile "app\services\stats_service.py" "Statistics services - vendor-aware"
:: Task files
call :CreatePyFile "tasks\__init__.py" ""
call :CreatePyFile "tasks\task_manager.py" "Celery configuration and task management"
call :CreatePyFile "tasks\marketplace_import.py" "Marketplace CSV import tasks"
call :CreatePyFile "tasks\email_tasks.py" "Email sending tasks"
call :CreatePyFile "tasks\media_processing.py" "Image processing and optimization tasks"
call :CreatePyFile "tasks\search_indexing.py" "Search index maintenance tasks"
call :CreatePyFile "tasks\analytics_tasks.py" "Analytics and reporting tasks"
call :CreatePyFile "tasks\cleanup_tasks.py" "Data cleanup and maintenance tasks"
call :CreatePyFile "tasks\backup_tasks.py" "Backup and recovery tasks"
:: Database model files
call :CreatePyFile "models\__init__.py" ""
call :CreatePyFile "models\database\__init__.py" "Import all models for easy access"
call :CreatePyFile "models\database\base.py" "Base model class and common mixins"
call :CreatePyFile "models\database\user.py" "User model - with vendor relationships"
call :CreatePyFile "models\database\vendor.py" "Vendor, VendorUser, Role models"
call :CreatePyFile "models\database\customer.py" "Customer, CustomerAddress models - vendor-scoped"
call :CreatePyFile "models\database\marketplace_product.py" "MarketplaceProduct model - staging data"
call :CreatePyFile "models\database\product.py" "Product model - vendor catalog"
call :CreatePyFile "models\database\order.py" "Order, OrderItem models - vendor-scoped"
call :CreatePyFile "models\database\payment.py" "Payment, PaymentMethod, VendorPaymentConfig models"
call :CreatePyFile "models\database\inventory.py" "Inventory, InventoryMovement models - catalog products"
call :CreatePyFile "models\database\marketplace.py" "MarketplaceImportJob model"
call :CreatePyFile "models\database\media.py" "MediaFile, ProductMedia models"
call :CreatePyFile "models\database\notification.py" "NotificationTemplate, NotificationQueue, NotificationLog models"
call :CreatePyFile "models\database\search.py" "SearchIndex, SearchQuery models"
call :CreatePyFile "models\database\audit.py" "AuditLog, DataExportLog models"
call :CreatePyFile "models\database\monitoring.py" "PerformanceMetric, ErrorLog, SystemAlert models"
call :CreatePyFile "models\database\backup.py" "BackupLog, RestoreLog models"
call :CreatePyFile "models\database\configuration.py" "PlatformConfig, VendorConfig, FeatureFlag models"
call :CreatePyFile "models\database\task.py" "TaskLog model"
call :CreatePyFile "models\database\admin.py" "Admin-specific models"
:: Schema model files
call :CreatePyFile "models\schema\__init__.py" "Common imports"
call :CreatePyFile "models\schema\base.py" "Base Pydantic models"
call :CreatePyFile "models\schema\auth.py" "Login, Token, User response models"
call :CreatePyFile "models\schema\vendor.py" "Vendor management models"
call :CreatePyFile "models\schema\customer.py" "Customer request and response models"
call :CreatePyFile "models\schema\team.py" "Team management models"
call :CreatePyFile "models\schema\marketplace_product.py" "Marketplace staging models"
call :CreatePyFile "models\schema\product.py" "Vendor catalog models"
call :CreatePyFile "models\schema\order.py" "Order models - vendor-scoped"
call :CreatePyFile "models\schema\payment.py" "Payment models"
call :CreatePyFile "models\schema\inventory.py" "Inventory operation models"
call :CreatePyFile "models\schema\marketplace.py" "Marketplace import job models"
call :CreatePyFile "models\schema\media.py" "Media and file management models"
call :CreatePyFile "models\schema\notification.py" "Notification models"
call :CreatePyFile "models\schema\search.py" "Search models"
call :CreatePyFile "models\schema\monitoring.py" "Monitoring models"
call :CreatePyFile "models\schema\admin.py" "Admin operation models"
call :CreatePyFile "models\schema\stats.py" "Statistics response models"
:: Middleware files
call :CreatePyFile "middleware\__init__.py" ""
call :CreatePyFile "middleware\auth.py" "JWT authentication"
call :CreatePyFile "middleware\vendor_context.py" "Vendor context detection and injection"
call :CreatePyFile "middleware\rate_limiter.py" "Rate limiting"
call :CreatePyFile "middleware\logging_middleware.py" "Request logging"
call :CreatePyFile "middleware\decorators.py" "Cross-cutting concern decorators"
:: Storage files
call :CreatePyFile "storage\__init__.py" ""
call :CreatePyFile "storage\backends.py" "Storage backend implementations"
call :CreatePyFile "storage\utils.py" "Storage utilities"
echo.
echo Creating HTML files...
echo.
:: HTML files - Admin
call :CreateHtmlFile "static\admin\login.html" "Admin login page"
call :CreateHtmlFile "static\admin\dashboard.html" "Admin dashboard"
call :CreateHtmlFile "static\admin\vendors.html" "Vendor management"
call :CreateHtmlFile "static\admin\users.html" "User management"
call :CreateHtmlFile "static\admin\marketplace.html" "System-wide marketplace monitoring"
call :CreateHtmlFile "static\admin\monitoring.html" "System monitoring"
:: HTML files - Vendor
call :CreateHtmlFile "static\vendor\login.html" "Vendor team login"
call :CreateHtmlFile "static\vendor\dashboard.html" "Vendor dashboard"
call :CreateHtmlFile "static\vendor\admin\products.html" "Catalog management - Product table"
call :CreateHtmlFile "static\vendor\admin\marketplace\imports.html" "Import jobs and history"
call :CreateHtmlFile "static\vendor\admin\marketplace\browse.html" "Browse marketplace products - staging"
call :CreateHtmlFile "static\vendor\admin\marketplace\selected.html" "Selected products - pre-publish"
call :CreateHtmlFile "static\vendor\admin\marketplace\config.html" "Marketplace configuration"
call :CreateHtmlFile "static\vendor\admin\orders.html" "Order management"
call :CreateHtmlFile "static\vendor\admin\customers.html" "Customer management"
call :CreateHtmlFile "static\vendor\admin\teams.html" "Team management"
call :CreateHtmlFile "static\vendor\admin\inventory.html" "Inventory management - catalog products"
call :CreateHtmlFile "static\vendor\admin\payments.html" "Payment configuration"
call :CreateHtmlFile "static\vendor\admin\media.html" "Media library"
call :CreateHtmlFile "static\vendor\admin\notifications.html" "Notification templates and logs"
call :CreateHtmlFile "static\vendor\admin\settings.html" "Vendor settings"
:: HTML files - Shop
call :CreateHtmlFile "static\shop\home.html" "Shop homepage"
call :CreateHtmlFile "static\shop\products.html" "Product catalog - Product table only"
call :CreateHtmlFile "static\shop\product.html" "Product detail page"
call :CreateHtmlFile "static\shop\search.html" "Search results page"
call :CreateHtmlFile "static\shop\cart.html" "Shopping cart"
call :CreateHtmlFile "static\shop\checkout.html" "Checkout process"
call :CreateHtmlFile "static\shop\account\login.html" "Customer login"
call :CreateHtmlFile "static\shop\account\register.html" "Customer registration"
call :CreateHtmlFile "static\shop\account\profile.html" "Customer profile"
call :CreateHtmlFile "static\shop\account\orders.html" "Order history"
call :CreateHtmlFile "static\shop\account\addresses.html" "Address management"
echo.
echo Creating JavaScript files...
echo.
:: JavaScript files - Shared
call :CreateJsFile "static\js\shared\vendor-context.js" "Vendor context detection and management"
call :CreateJsFile "static\js\shared\api-client.js" "API communication utilities"
call :CreateJsFile "static\js\shared\notification.js" "Notification handling"
call :CreateJsFile "static\js\shared\media-upload.js" "File upload utilities"
call :CreateJsFile "static\js\shared\search.js" "Search functionality"
:: JavaScript files - Admin
call :CreateJsFile "static\js\admin\dashboard.js" "Admin dashboard"
call :CreateJsFile "static\js\admin\vendors.js" "Vendor management"
call :CreateJsFile "static\js\admin\monitoring.js" "System monitoring"
call :CreateJsFile "static\js\admin\analytics.js" "Admin analytics"
:: JavaScript files - Vendor
call :CreateJsFile "static\js\vendor\products.js" "Catalog management"
call :CreateJsFile "static\js\vendor\marketplace.js" "Marketplace integration"
call :CreateJsFile "static\js\vendor\orders.js" "Order management"
call :CreateJsFile "static\js\vendor\payments.js" "Payment configuration"
call :CreateJsFile "static\js\vendor\media.js" "Media management"
call :CreateJsFile "static\js\vendor\dashboard.js" "Vendor dashboard"
:: JavaScript files - Shop
call :CreateJsFile "static\js\shop\catalog.js" "Product browsing"
call :CreateJsFile "static\js\shop\search.js" "Product search"
call :CreateJsFile "static\js\shop\cart.js" "Shopping cart"
call :CreateJsFile "static\js\shop\checkout.js" "Checkout process"
call :CreateJsFile "static\js\shop\account.js" "Customer account"
echo.
echo ========================================
echo Build Complete!
echo ========================================
echo.
goto :eof
:: Function to create directory if it doesn't exist
:CreateDir
if not exist "%~1" (
mkdir "%~1"
echo [CREATED] Directory: %~1
) else (
echo [EXISTS] Directory: %~1
)
goto :eof
:: Function to create Python file if it doesn't exist
:CreatePyFile
if not exist "%~1" (
if "%~2"=="" (
echo. > "%~1"
) else (
echo # %~2 > "%~1"
)
echo [CREATED] File: %~1
) else (
echo [SKIPPED] File: %~1 - already exists
)
goto :eof
:: Function to create HTML file if it doesn't exist
:CreateHtmlFile
if not exist "%~1" (
(
echo ^<!DOCTYPE html^>
echo ^<html lang="en"^>
echo ^<head^>
echo ^<meta charset="UTF-8"^>
echo ^<meta name="viewport" content="width=device-width, initial-scale=1.0"^>
echo ^<title^>%~2^</title^>
echo ^</head^>
echo ^<body^>
echo ^<!-- %~2 --^>
echo ^</body^>
echo ^</html^>
) > "%~1"
echo [CREATED] File: %~1
) else (
echo [SKIPPED] File: %~1 - already exists
)
goto :eof
:: Function to create JavaScript file if it doesn't exist
:CreateJsFile
if not exist "%~1" (
echo // %~2 > "%~1"
echo [CREATED] File: %~1
) else (
echo [SKIPPED] File: %~1 - already exists
)
goto :eof