feat: add hotel and vehicle option site modules
Add full support for hotel group and vehicle option site management features: - Define SQLAlchemy models and alembic migration for the new database tables - Add default sample content entries in content.py - Extend admin and public API routes to support the new modules - Update seed script to populate default hotel and vehicle data - Update all relevant documentation and test cases
This commit is contained in:
@@ -20,6 +20,7 @@ from ..models import (
|
||||
CtaBanner,
|
||||
Destination,
|
||||
HeroSlide,
|
||||
HotelGroup,
|
||||
Lead,
|
||||
MapImage,
|
||||
MediaAsset,
|
||||
@@ -29,6 +30,7 @@ from ..models import (
|
||||
RouteSectionProduct,
|
||||
SiteVersion,
|
||||
ThemeCard,
|
||||
VehicleOption,
|
||||
utc_now,
|
||||
)
|
||||
from ..schemas import AdminProductQuery, LeadQuery, LeadStatus, LeadStatusIn, LoginIn, ProductCreateIn, ProductStatus, ProductUpdateIn, SiteConfigPatchIn, SiteConfigReorderIn
|
||||
@@ -103,6 +105,24 @@ SITE_CONFIG_MODULES = {
|
||||
"empty_to_none": {"subtitle"},
|
||||
"create_defaults": {},
|
||||
},
|
||||
"hotelGroups": {
|
||||
"model": HotelGroup,
|
||||
"entity": "hotel_group",
|
||||
"primary": "title",
|
||||
"fields": {"title", "description", "image", "isActive", "sortOrder"},
|
||||
"none_to_empty": set(),
|
||||
"empty_to_none": {"description", "image"},
|
||||
"create_defaults": {"description": None, "image": None},
|
||||
},
|
||||
"vehicleOptions": {
|
||||
"model": VehicleOption,
|
||||
"entity": "vehicle_option",
|
||||
"primary": "title",
|
||||
"fields": {"title", "description", "image", "isActive", "sortOrder"},
|
||||
"none_to_empty": set(),
|
||||
"empty_to_none": {"description", "image"},
|
||||
"create_defaults": {"description": None, "image": None},
|
||||
},
|
||||
"ctaBanners": {
|
||||
"model": CtaBanner,
|
||||
"entity": "cta_banner",
|
||||
@@ -629,6 +649,14 @@ def admin_site_config(_user: AdminUser = Depends(require_admin), db: Session = D
|
||||
for item in db.scalars(select(Campaign).order_by(Campaign.updatedAt.desc())).all()
|
||||
],
|
||||
"routeSections": [route_section_dict(item) for item in db.scalars(route_section_query()).all()],
|
||||
"hotelGroups": [
|
||||
model_dict(item)
|
||||
for item in db.scalars(select(HotelGroup).order_by(HotelGroup.sortOrder.asc())).all()
|
||||
],
|
||||
"vehicleOptions": [
|
||||
model_dict(item)
|
||||
for item in db.scalars(select(VehicleOption).order_by(VehicleOption.sortOrder.asc())).all()
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user