db_modeling_for_capi #5

Merged
jonas merged 23 commits from db_modeling_for_capi into main 2025-10-10 14:57:52 +00:00
Showing only changes of commit b9adb8c7d9 - Show all commits

View File

@@ -5,7 +5,7 @@ import logging
import os
import urllib.parse
from collections import defaultdict
from datetime import UTC, date, datetime
from datetime import date, datetime
from functools import partial
from pathlib import Path
from typing import Any
@@ -419,6 +419,16 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db
or "Frangart Inn" # fallback
)
submissionTime = data.get("submissionTime") # 2025-10-07T05:48:41.855Z
try:
if submissionTime:
submissionTime = datetime.fromisoformat(
submissionTime[:-1]
) # Remove Z and convert
except Exception as e:
_LOGGER.error("Error parsing submissionTime: %s", e)
submissionTime = None
reservation = ReservationData(
unique_id=unique_id,
start_date=date.fromisoformat(start_date),
@@ -429,7 +439,7 @@ async def process_wix_form_submission(request: Request, data: dict[str, Any], db
hotel_code=hotel_code,
hotel_name=hotel_name,
offer=offer,
created_at=datetime.now(UTC),
created_at=submissionTime,
utm_source=data.get("field:utm_source"),
utm_medium=data.get("field:utm_medium"),
utm_campaign=data.get("field:utm_campaign"),