feat: Add hotel and webhook endpoint management
- Introduced Hotel and WebhookEndpoint models to manage hotel configurations and webhook settings. - Implemented sync_config_to_database function to synchronize hotel data from configuration to the database. - Added HotelService for accessing hotel configurations and managing customer data. - Created WebhookProcessor interface and specific processors for handling different webhook types (Wix form and generic). - Enhanced webhook processing logic to handle incoming requests and create/update reservations and customers. - Added logging for better traceability of operations related to hotels and webhooks.
This commit is contained in:
@@ -251,6 +251,18 @@ async def run_startup_tasks(
|
||||
config: Application configuration dictionary
|
||||
engine: SQLAlchemy async engine (optional, for backfill tasks)
|
||||
"""
|
||||
# Sync config to database (hotels and webhook endpoints)
|
||||
if config:
|
||||
from .hotel_service import sync_config_to_database
|
||||
async with sessionmaker() as session:
|
||||
stats = await sync_config_to_database(session, config)
|
||||
_LOGGER.info(
|
||||
"Config sync: %d hotels created, %d updated, %d endpoints created",
|
||||
stats["hotels_created"],
|
||||
stats["hotels_updated"],
|
||||
stats["endpoints_created"]
|
||||
)
|
||||
|
||||
# Hash any existing customers that don't have hashed data
|
||||
async with sessionmaker() as session:
|
||||
customer_service = CustomerService(session)
|
||||
|
||||
Reference in New Issue
Block a user