refactor: 清理废弃业务模块并更新全栈配置
- 移除后端产品、目的地、活动专题等废弃模块的数据库表与业务代码,删除冗余API接口 - 删除小程序端详情页、线路组件等冗余代码,移除搜索工具与测试用例,调整导航逻辑 - 清理管理端废弃的类型定义、编辑器与测试代码 - 更新项目文档,修正模块维护说明与接口文档内容
This commit is contained in:
1 parent
72e6071bb1
commit
548f91c37f
80 files changed
+953
-12702
No files matched your search
+1
-225
@@ -1,6 +1,6 @@
|
||||
from datetime import datetime, timezone
|
||||
from uuid import uuid4
|
||||
from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
|
||||
from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, Text
|
||||
from sqlalchemy.dialects.postgresql import ARRAY, JSONB
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from .database import Base
|
||||
@@ -59,45 +59,6 @@ class HeroSlide(Base):
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class Destination(Base):
|
||||
__tablename__ = "Destination"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
name: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
||||
slug: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
||||
region: Mapped[str | None] = mapped_column(String)
|
||||
image: Mapped[str | None] = mapped_column(String)
|
||||
isHot: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
aliases: Mapped[list["DestinationAlias"]] = relationship(back_populates="destination", cascade="all, delete-orphan")
|
||||
products: Mapped[list["Product"]] = relationship(back_populates="destination")
|
||||
|
||||
|
||||
class DestinationAlias(Base):
|
||||
__tablename__ = "DestinationAlias"
|
||||
__table_args__ = (UniqueConstraint("alias", "destinationId"),)
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
alias: Mapped[str] = mapped_column(String, nullable=False)
|
||||
destinationId: Mapped[str] = mapped_column(String, ForeignKey("Destination.id", ondelete="CASCADE"), nullable=False)
|
||||
|
||||
destination: Mapped[Destination] = relationship(back_populates="aliases")
|
||||
|
||||
|
||||
class MapImage(Base):
|
||||
__tablename__ = "MapImage"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
image: Mapped[str] = mapped_column(String, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class DestinationHero(Base):
|
||||
__tablename__ = "DestinationHero"
|
||||
|
||||
@@ -111,65 +72,6 @@ class DestinationHero(Base):
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class DestinationRegion(Base):
|
||||
__tablename__ = "DestinationRegion"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
label: Mapped[str] = mapped_column(String, nullable=False)
|
||||
keyword: Mapped[str | None] = mapped_column(String)
|
||||
spots: Mapped[str | None] = mapped_column(Text)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class ThemeCard(Base):
|
||||
__tablename__ = "ThemeCard"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
label: Mapped[str] = mapped_column(String, nullable=False)
|
||||
image: Mapped[str] = mapped_column(String, nullable=False)
|
||||
targetType: Mapped[str | None] = mapped_column(String)
|
||||
targetValue: Mapped[str | None] = mapped_column(String)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class CtaBanner(Base):
|
||||
__tablename__ = "CtaBanner"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
alt: Mapped[str] = mapped_column(String, nullable=False)
|
||||
image: Mapped[str] = mapped_column(String, nullable=False)
|
||||
targetType: Mapped[str] = mapped_column(String, nullable=False)
|
||||
targetValue: Mapped[str | None] = mapped_column(String)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class HotelGroup(Base):
|
||||
__tablename__ = "HotelGroup"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
title: Mapped[str] = mapped_column(String, nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(Text)
|
||||
image: Mapped[str | None] = mapped_column(String)
|
||||
coverImage: Mapped[str | None] = mapped_column(String)
|
||||
priceAmount: Mapped[int | None] = mapped_column(Integer)
|
||||
priceUnit: Mapped[str | None] = mapped_column(String, default="起/晚")
|
||||
tags: Mapped[list[str]] = mapped_column(ARRAY(String), default=list, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String, default="published", nullable=False)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class VehicleOption(Base):
|
||||
__tablename__ = "VehicleOption"
|
||||
|
||||
@@ -183,103 +85,6 @@ class VehicleOption(Base):
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class Product(Base):
|
||||
__tablename__ = "Product"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
sourceId: Mapped[int | None] = mapped_column(Integer, unique=True)
|
||||
title: Mapped[str] = mapped_column(String, nullable=False)
|
||||
subtitle: Mapped[str | None] = mapped_column(String)
|
||||
destinationId: Mapped[str | None] = mapped_column(String, ForeignKey("Destination.id", ondelete="SET NULL"))
|
||||
priceAmount: Mapped[int | None] = mapped_column(Integer)
|
||||
priceUnit: Mapped[str] = mapped_column(String, default="起/人", nullable=False)
|
||||
tags: Mapped[list[str]] = mapped_column(ARRAY(String), default=list, nullable=False)
|
||||
coverImage: Mapped[str | None] = mapped_column(String)
|
||||
summary: Mapped[str | None] = mapped_column(Text)
|
||||
detailSections: Mapped[dict | list | None] = mapped_column(JSONB)
|
||||
status: Mapped[str] = mapped_column(String, default="published", nullable=False)
|
||||
sortWeight: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
publishedAt: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
destination: Mapped[Destination | None] = relationship(back_populates="products")
|
||||
images: Mapped[list["ProductImage"]] = relationship(back_populates="product", cascade="all, delete-orphan")
|
||||
campaignLinks: Mapped[list["CampaignProduct"]] = relationship(back_populates="product", cascade="all, delete-orphan")
|
||||
routeSectionLinks: Mapped[list["RouteSectionProduct"]] = relationship(back_populates="product", cascade="all, delete-orphan")
|
||||
demandRecommendationLinks: Mapped[list["DemandRecommendationProduct"]] = relationship(back_populates="product", cascade="all, delete-orphan")
|
||||
leads: Mapped[list["Lead"]] = relationship(back_populates="sourceProduct")
|
||||
orders: Mapped[list["Order"]] = relationship(back_populates="product")
|
||||
|
||||
|
||||
class ProductImage(Base):
|
||||
__tablename__ = "ProductImage"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
productId: Mapped[str] = mapped_column(String, ForeignKey("Product.id", ondelete="CASCADE"), nullable=False)
|
||||
url: Mapped[str] = mapped_column(String, nullable=False)
|
||||
alt: Mapped[str | None] = mapped_column(String)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
|
||||
product: Mapped[Product] = relationship(back_populates="images")
|
||||
|
||||
|
||||
class Campaign(Base):
|
||||
__tablename__ = "Campaign"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
slug: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
||||
title: Mapped[str] = mapped_column(String, nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(Text)
|
||||
coverImage: Mapped[str | None] = mapped_column(String)
|
||||
priceAmount: Mapped[int | None] = mapped_column(Integer)
|
||||
priceUnit: Mapped[str | None] = mapped_column(String, default="起/人")
|
||||
tags: Mapped[list[str]] = mapped_column(ARRAY(String), default=list, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String, default="published", nullable=False)
|
||||
startsAt: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
endsAt: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
products: Mapped[list["CampaignProduct"]] = relationship(back_populates="campaign", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class CampaignProduct(Base):
|
||||
__tablename__ = "CampaignProduct"
|
||||
|
||||
campaignId: Mapped[str] = mapped_column(String, ForeignKey("Campaign.id", ondelete="CASCADE"), primary_key=True)
|
||||
productId: Mapped[str] = mapped_column(String, ForeignKey("Product.id", ondelete="CASCADE"), primary_key=True)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
|
||||
campaign: Mapped[Campaign] = relationship(back_populates="products")
|
||||
product: Mapped[Product] = relationship(back_populates="campaignLinks")
|
||||
|
||||
|
||||
class RouteSection(Base):
|
||||
__tablename__ = "RouteSection"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
title: Mapped[str] = mapped_column(String, nullable=False)
|
||||
subtitle: Mapped[str | None] = mapped_column(Text)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
products: Mapped[list["RouteSectionProduct"]] = relationship(back_populates="section", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class RouteSectionProduct(Base):
|
||||
__tablename__ = "RouteSectionProduct"
|
||||
|
||||
sectionId: Mapped[str] = mapped_column(String, ForeignKey("RouteSection.id", ondelete="CASCADE"), primary_key=True)
|
||||
productId: Mapped[str] = mapped_column(String, ForeignKey("Product.id", ondelete="CASCADE"), primary_key=True)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
|
||||
section: Mapped[RouteSection] = relationship(back_populates="products")
|
||||
product: Mapped[Product] = relationship(back_populates="routeSectionLinks")
|
||||
|
||||
|
||||
class DemandHero(Base):
|
||||
__tablename__ = "DemandHero"
|
||||
|
||||
@@ -323,31 +128,6 @@ class DemandForm(Base):
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
|
||||
class DemandRecommendation(Base):
|
||||
__tablename__ = "DemandRecommendation"
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
title: Mapped[str] = mapped_column(String, nullable=False)
|
||||
subtitle: Mapped[str | None] = mapped_column(Text)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
isActive: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
products: Mapped[list["DemandRecommendationProduct"]] = relationship(back_populates="recommendation", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class DemandRecommendationProduct(Base):
|
||||
__tablename__ = "DemandRecommendationProduct"
|
||||
|
||||
recommendationId: Mapped[str] = mapped_column(String, ForeignKey("DemandRecommendation.id", ondelete="CASCADE"), primary_key=True)
|
||||
productId: Mapped[str] = mapped_column(String, ForeignKey("Product.id", ondelete="CASCADE"), primary_key=True)
|
||||
sortOrder: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
|
||||
recommendation: Mapped[DemandRecommendation] = relationship(back_populates="products")
|
||||
product: Mapped[Product] = relationship(back_populates="demandRecommendationLinks")
|
||||
|
||||
|
||||
class Lead(Base):
|
||||
__tablename__ = "Lead"
|
||||
|
||||
@@ -360,13 +140,11 @@ class Lead(Base):
|
||||
budgetMax: Mapped[int | None] = mapped_column(Integer)
|
||||
note: Mapped[str | None] = mapped_column(Text)
|
||||
sourcePage: Mapped[str | None] = mapped_column(String)
|
||||
sourceProductId: Mapped[str | None] = mapped_column(String, ForeignKey("Product.id", ondelete="SET NULL"))
|
||||
status: Mapped[str] = mapped_column(String, default="new", nullable=False)
|
||||
assignedUserId: Mapped[str | None] = mapped_column(String, ForeignKey("AdminUser.id", ondelete="SET NULL"))
|
||||
createdAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, nullable=False)
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
sourceProduct: Mapped[Product | None] = relationship(back_populates="leads")
|
||||
assignedUser: Mapped[AdminUser | None] = relationship(back_populates="assignedLeads", foreign_keys=[assignedUserId])
|
||||
followups: Mapped[list["LeadFollowup"]] = relationship(back_populates="lead", cascade="all, delete-orphan")
|
||||
|
||||
@@ -402,7 +180,6 @@ class Order(Base):
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True, default=new_id)
|
||||
customerId: Mapped[str | None] = mapped_column(String, ForeignKey("Customer.id", ondelete="SET NULL"))
|
||||
productId: Mapped[str | None] = mapped_column(String, ForeignKey("Product.id", ondelete="SET NULL"))
|
||||
status: Mapped[str] = mapped_column(String, default="draft", nullable=False)
|
||||
travelDate: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
amount: Mapped[int | None] = mapped_column(Integer)
|
||||
@@ -411,7 +188,6 @@ class Order(Base):
|
||||
updatedAt: Mapped[datetime] = mapped_column(DateTime, default=utc_now, onupdate=utc_now, nullable=False)
|
||||
|
||||
customer: Mapped[Customer | None] = relationship(back_populates="orders")
|
||||
product: Mapped[Product | None] = relationship(back_populates="orders")
|
||||
|
||||
|
||||
class SiteVersion(Base):
|
||||
|
||||
Reference in new issue
Block a user