refactor: 清理废弃业务模块并更新全栈配置

- 移除后端产品、目的地、活动专题等废弃模块的数据库表与业务代码,删除冗余API接口
- 删除小程序端详情页、线路组件等冗余代码,移除搜索工具与测试用例,调整导航逻辑
- 清理管理端废弃的类型定义、编辑器与测试代码
- 更新项目文档,修正模块维护说明与接口文档内容
This commit is contained in:
duanshuwen committed 2026-08-17 22:43:49 +08:00
1 parent 72e6071bb1
commit 548f91c37f
80 files changed
+953 -12702

No files matched your search

@@ -6,8 +6,8 @@ Create Date: 2026-07-01
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
from app.models import MapImage
revision = "0002_add_map_image"
@@ -19,10 +19,18 @@ depends_on = None
def upgrade() -> None:
bind = op.get_bind()
if "MapImage" not in set(inspect(bind).get_table_names()):
MapImage.__table__.create(bind)
op.create_table(
"MapImage",
sa.Column("id", sa.String(), nullable=False),
sa.Column("image", sa.String(), nullable=False),
sa.Column("isActive", sa.Boolean(), nullable=False, server_default=sa.true()),
sa.Column("createdAt", sa.DateTime(), nullable=False),
sa.Column("updatedAt", sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
def downgrade() -> None:
bind = op.get_bind()
if "MapImage" in set(inspect(bind).get_table_names()):
MapImage.__table__.drop(bind)
op.drop_table("MapImage")
@@ -33,22 +33,10 @@ def upgrade() -> None:
sa.PrimaryKeyConstraint("id"),
)
if "RouteSectionProduct" not in existing_tables:
op.create_table(
"RouteSectionProduct",
sa.Column("sectionId", sa.String(), nullable=False),
sa.Column("productId", sa.String(), nullable=False),
sa.Column("sortOrder", sa.Integer(), nullable=False, server_default="0"),
sa.ForeignKeyConstraint(["productId"], ["Product.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["sectionId"], ["RouteSection.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("sectionId", "productId"),
)
def downgrade() -> None:
bind = op.get_bind()
existing_tables = set(inspect(bind).get_table_names())
if "RouteSectionProduct" in existing_tables:
op.drop_table("RouteSectionProduct")
if "RouteSection" in existing_tables:
op.drop_table("RouteSection")
@@ -80,23 +80,12 @@ def upgrade() -> None:
sa.PrimaryKeyConstraint("id"),
)
if "DemandRecommendationProduct" not in existing_tables:
op.create_table(
"DemandRecommendationProduct",
sa.Column("recommendationId", sa.String(), nullable=False),
sa.Column("productId", sa.String(), nullable=False),
sa.Column("sortOrder", sa.Integer(), nullable=False, server_default="0"),
sa.ForeignKeyConstraint(["productId"], ["Product.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["recommendationId"], ["DemandRecommendation.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("recommendationId", "productId"),
)
def downgrade() -> None:
bind = op.get_bind()
existing_tables = set(inspect(bind).get_table_names())
for table_name in [
"DemandRecommendationProduct",
"DemandRecommendation",
"DemandForm",
"DemandFeatureCard",
@@ -0,0 +1,57 @@
"""Remove the retired product domain and its foreign-key references.
Revision ID: 0009_remove_product_domain
Revises: 0008_demand_page_modules
Create Date: 2026-08-17
"""
from alembic import op
from sqlalchemy import inspect
revision = "0009_remove_product_domain"
down_revision = "0008_demand_page_modules"
branch_labels = None
depends_on = None
PRODUCT_TABLES = (
"CampaignProduct",
"RouteSectionProduct",
"DemandRecommendationProduct",
"ProductImage",
"Product",
)
def _drop_column_with_foreign_keys(table_name: str, column_name: str) -> None:
bind = op.get_bind()
inspector = inspect(bind)
if table_name not in inspector.get_table_names():
return
columns = {column["name"] for column in inspector.get_columns(table_name)}
if column_name not in columns:
return
for foreign_key in inspector.get_foreign_keys(table_name):
if column_name in foreign_key.get("constrained_columns", []):
constraint_name = foreign_key.get("name")
if constraint_name:
op.drop_constraint(constraint_name, table_name, type_="foreignkey")
op.drop_column(table_name, column_name)
def upgrade() -> None:
bind = op.get_bind()
existing_tables = set(inspect(bind).get_table_names())
_drop_column_with_foreign_keys("Lead", "sourceProductId")
_drop_column_with_foreign_keys("Order", "productId")
for table_name in (*PRODUCT_TABLES[:3], "RouteSection", "DemandRecommendation", *PRODUCT_TABLES[3:]):
if table_name in existing_tables:
op.drop_table(table_name)
def downgrade() -> None:
# The retired product schema intentionally has no downgrade path. Restore it from a backup if needed.
pass
@@ -0,0 +1,45 @@
"""Remove the retired province destination module.
Revision ID: 0010_remove_destination_module
Revises: 0009_remove_product_domain
Create Date: 2026-08-17
"""
from alembic import op
from sqlalchemy import inspect
revision = "0010_remove_destination_module"
down_revision = "0009_remove_product_domain"
branch_labels = None
depends_on = None
def _drop_referencing_foreign_keys(table_name: str) -> None:
bind = op.get_bind()
inspector = inspect(bind)
for current_table in inspector.get_table_names():
if current_table == table_name:
continue
for foreign_key in inspector.get_foreign_keys(current_table):
if foreign_key.get("referred_table") != table_name:
continue
constraint_name = foreign_key.get("name")
if constraint_name:
op.drop_constraint(constraint_name, current_table, type_="foreignkey")
def upgrade() -> None:
bind = op.get_bind()
existing_tables = set(inspect(bind).get_table_names())
for table_name in ("DestinationAlias", "Destination"):
if table_name not in existing_tables:
continue
_drop_referencing_foreign_keys(table_name)
op.drop_table(table_name)
def downgrade() -> None:
# The retired destination module has no downgrade path. Restore it from a backup if needed.
pass
@@ -0,0 +1,26 @@
"""Remove the retired more-services CTA module.
Revision ID: 0011_remove_cta_banner_module
Revises: 0010_remove_destination_module
Create Date: 2026-08-17
"""
from alembic import op
from sqlalchemy import inspect
revision = "0011_remove_cta_banner_module"
down_revision = "0010_remove_destination_module"
branch_labels = None
depends_on = None
def upgrade() -> None:
bind = op.get_bind()
if "CtaBanner" in set(inspect(bind).get_table_names()):
op.drop_table("CtaBanner")
def downgrade() -> None:
# The retired CTA module has no downgrade path. Restore it from a backup if needed.
pass
@@ -0,0 +1,27 @@
"""Remove the retired campaign and hotel site modules.
Revision ID: 0012_remove_offer_modules
Revises: 0011_remove_cta_banner_module
Create Date: 2026-08-17
"""
from alembic import op
from sqlalchemy import inspect
revision = "0012_remove_offer_modules"
down_revision = "0011_remove_cta_banner_module"
branch_labels = None
depends_on = None
def upgrade() -> None:
existing_tables = set(inspect(op.get_bind()).get_table_names())
for table_name in ("Campaign", "HotelGroup"):
if table_name in existing_tables:
op.drop_table(table_name)
def downgrade() -> None:
# The retired offer modules have no downgrade path. Restore them from a backup if needed.
pass
@@ -0,0 +1,27 @@
"""Remove the retired map and theme site modules.
Revision ID: 0013_remove_map_theme_modules
Revises: 0012_remove_offer_modules
Create Date: 2026-08-17
"""
from alembic import op
from sqlalchemy import inspect
revision = "0013_remove_map_theme_modules"
down_revision = "0012_remove_offer_modules"
branch_labels = None
depends_on = None
def upgrade() -> None:
existing_tables = set(inspect(op.get_bind()).get_table_names())
for table_name in ("MapImage", "ThemeCard"):
if table_name in existing_tables:
op.drop_table(table_name)
def downgrade() -> None:
# The retired site modules have no downgrade path. Restore them from a backup if needed.
pass
@@ -0,0 +1,24 @@
"""Remove the destination regions module.
Revision ID: 0014_remove_destination_regions_module
Revises: 0013_remove_map_theme_modules
"""
from alembic import op
from sqlalchemy import inspect
revision = "0014_remove_destination_regions_module"
down_revision = "0013_remove_map_theme_modules"
branch_labels = None
depends_on = None
def upgrade() -> None:
existing_tables = set(inspect(op.get_bind()).get_table_names())
if "DestinationRegion" in existing_tables:
op.drop_table("DestinationRegion")
def downgrade() -> None:
pass