feat(hotelGroups): add offer display fields and related logic
- Add new database columns (coverImage, priceAmount, priceUnit, tags, status) to HotelGroup model - Create hotel_group_dict serializer to handle image/coverImage synchronization and tag formatting - Update site config endpoints to use the new serializer and filter published hotel groups - Add Alembic migration for the new database schema changes - Update test fixtures and API contract tests for the new fields - Revise public and admin API documentation to document the new hotel group fields and usage rules
This commit is contained in:
@@ -2,7 +2,7 @@ from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session, selectinload
|
||||
from ..models import Campaign, CtaBanner, Destination, HeroSlide, HotelGroup, MapImage, ThemeCard, VehicleOption
|
||||
from ..route_sections import route_section_dict, route_section_query
|
||||
from ..serializers import destination_dict, model_dict
|
||||
from ..serializers import destination_dict, hotel_group_dict, model_dict
|
||||
|
||||
|
||||
def site_config(db: Session, active_only: bool, include_public_extras: bool = True) -> dict:
|
||||
@@ -19,7 +19,7 @@ def site_config(db: Session, active_only: bool, include_public_extras: bool = Tr
|
||||
map_stmt = map_stmt.where(MapImage.isActive.is_(True))
|
||||
theme_stmt = theme_stmt.where(ThemeCard.isActive.is_(True))
|
||||
cta_stmt = cta_stmt.where(CtaBanner.isActive.is_(True))
|
||||
hotel_stmt = hotel_stmt.where(HotelGroup.isActive.is_(True))
|
||||
hotel_stmt = hotel_stmt.where(HotelGroup.isActive.is_(True), HotelGroup.status == "published")
|
||||
vehicle_stmt = vehicle_stmt.where(VehicleOption.isActive.is_(True))
|
||||
|
||||
hero_slides = db.scalars(hero_stmt).all()
|
||||
@@ -41,6 +41,6 @@ def site_config(db: Session, active_only: bool, include_public_extras: bool = Tr
|
||||
route_sections = [section for section in route_sections if section.isActive]
|
||||
result["campaigns"] = [model_dict(item) for item in campaigns]
|
||||
result["routeSections"] = [route_section_dict(item, public=True) for item in route_sections]
|
||||
result["hotelGroups"] = [model_dict(item) for item in db.scalars(hotel_stmt).all()]
|
||||
result["hotelGroups"] = [hotel_group_dict(item) for item in db.scalars(hotel_stmt).all()]
|
||||
result["vehicleOptions"] = [model_dict(item) for item in db.scalars(vehicle_stmt).all()]
|
||||
return result
|
||||
Reference in New Issue
Block a user