Fixed some tests and added schemas
This commit is contained in:
@@ -32,6 +32,8 @@ from sqlalchemy import and_, select, update
|
||||
from sqlalchemy.ext.asyncio import async_sessionmaker
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from alpine_bits_python.schemas import WebhookRequestData
|
||||
|
||||
from .alpinebits_server import (
|
||||
AlpineBitsActionName,
|
||||
AlpineBitsClientInfo,
|
||||
@@ -888,8 +890,9 @@ async def handle_webhook_unified(
|
||||
webhook_request.status = WebhookStatus.PROCESSING
|
||||
webhook_request.processing_started_at = timestamp
|
||||
else:
|
||||
# 5. Create new webhook_request
|
||||
webhook_request = WebhookRequest(
|
||||
|
||||
|
||||
webhook_request_data = WebhookRequestData(
|
||||
payload_hash=payload_hash,
|
||||
webhook_endpoint_id=webhook_endpoint.id,
|
||||
hotel_id=webhook_endpoint.hotel_id,
|
||||
@@ -900,6 +903,9 @@ async def handle_webhook_unified(
|
||||
source_ip=request.client.host if request.client else None,
|
||||
user_agent=request.headers.get("user-agent"),
|
||||
)
|
||||
# 5. Create new webhook_request
|
||||
webhook_request = WebhookRequest(**webhook_request_data.model_dump())
|
||||
|
||||
db_session.add(webhook_request)
|
||||
await db_session.flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user