Files
orion/create_project_structure.bat

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