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:
duanshuwen
2026-07-03 22:44:57 +08:00
parent 201e835eab
commit 1aac3c64b2
9 changed files with 188 additions and 28 deletions

View File

@@ -187,6 +187,11 @@ def make_hotel_group(**overrides):
title=overrides.get("title", "经典酒店"),
description=overrides.get("description", "经典城市酒店与山野度假住宿组合"),
image=overrides.get("image", "/assets/hotel.jpg"),
coverImage=overrides.get("coverImage", overrides.get("image", "/assets/hotel.jpg")),
priceAmount=overrides.get("priceAmount", 68000),
priceUnit=overrides.get("priceUnit", "起/晚"),
tags=overrides.get("tags", ["温泉", "亲子"]),
status=overrides.get("status", "published"),
sortOrder=overrides.get("sortOrder", 1),
isActive=overrides.get("isActive", True),
createdAt=datetime(2026, 1, 1),
@@ -651,6 +656,11 @@ def test_admin_site_config_includes_hotel_and_vehicle_modules():
"title": "经典酒店",
"description": "经典城市酒店与山野度假住宿组合",
"image": "/assets/hotel.jpg",
"coverImage": "/assets/hotel.jpg",
"priceAmount": 68000,
"priceUnit": "起/晚",
"tags": ["温泉", "亲子"],
"status": "published",
"sortOrder": 1,
"isActive": True,
"createdAt": "2026-01-01T00:00:00",
@@ -1081,6 +1091,11 @@ def test_public_site_config_includes_hotel_and_vehicle_modules():
assert result["hotelGroups"][0]["title"] == "经典酒店"
assert result["hotelGroups"][0]["description"] == "经典城市酒店与山野度假住宿组合"
assert result["hotelGroups"][0]["coverImage"] == "/assets/hotel.jpg"
assert result["hotelGroups"][0]["priceAmount"] == 68000
assert result["hotelGroups"][0]["priceUnit"] == "起/晚"
assert result["hotelGroups"][0]["tags"] == ["温泉", "亲子"]
assert result["hotelGroups"][0]["status"] == "published"
assert result["vehicleOptions"][0]["title"] == "5座舒适用车"
assert result["vehicleOptions"][0]["image"] == "/assets/vehicle.jpg"