Add improvements

This commit is contained in:
Urtzi Alfaro
2026-01-12 14:24:14 +01:00
parent 6037faaf8c
commit 230bbe6a19
61 changed files with 1668 additions and 894 deletions

View File

@@ -17,11 +17,6 @@ class TenantService(StandardFastAPIService):
expected_migration_version = "00001"
async def on_startup(self, app):
"""Custom startup logic including migration verification"""
await self.verify_migrations()
await super().on_startup(app)
async def verify_migrations(self):
"""Verify database schema matches the latest migrations."""
try:
@@ -67,6 +62,9 @@ class TenantService(StandardFastAPIService):
async def on_startup(self, app: FastAPI):
"""Custom startup logic for tenant service"""
# Verify migrations first
await self.verify_migrations()
# Import models to ensure they're registered with SQLAlchemy
from app.models.tenants import Tenant, TenantMember, Subscription
from app.models.tenant_settings import TenantSettings
@@ -87,6 +85,11 @@ class TenantService(StandardFastAPIService):
await start_scheduler(self.database_manager, redis_client, settings)
self.logger.info("Usage tracking scheduler started")
# Run startup seeders (pilot coupon, etc.)
from app.jobs.startup_seeder import run_startup_seeders
await run_startup_seeders(self.database_manager)
self.logger.info("Startup seeders completed")
async def on_shutdown(self, app: FastAPI):
"""Custom shutdown logic for tenant service"""
# Stop usage tracking scheduler