feat: 实现Operation-Agent核心功能及电商平台适配器
refactor: 重构项目结构,分离server和dashboard代码 style: 统一代码风格,修复lint警告 test: 添加平台适配器工厂测试用例 ci: 更新CI/CD流程,增加语义验证和性能测试 docs: 添加语义中心文档,定义统一数据模型和状态机
This commit is contained in:
20
server/src/types/enums/PlatformType.ts
Normal file
20
server/src/types/enums/PlatformType.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export enum PlatformType {
|
||||
AMAZON = 'amazon',
|
||||
SHOPEE = 'shopee',
|
||||
ALIEXPRESS = 'aliexpress',
|
||||
TIKTOK = 'tiktok',
|
||||
EBAY = 'ebay',
|
||||
LAZADA = 'lazada',
|
||||
WISH = 'wish',
|
||||
SHEIN = 'shein',
|
||||
JD_WORLDWIDE = 'jd_worldwide',
|
||||
WALMART = 'walmart',
|
||||
ETSY = 'etsy',
|
||||
TARGET = 'target',
|
||||
NEWEGG = 'newegg',
|
||||
CDISCOUNT = 'cdiscount',
|
||||
ALLEGRO = 'allegro',
|
||||
OTTO = 'otto',
|
||||
RAKUTEN = 'rakuten',
|
||||
QOO10 = 'qoo10'
|
||||
}
|
||||
6
server/src/types/enums/StoreStatus.ts
Normal file
6
server/src/types/enums/StoreStatus.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum StoreStatus {
|
||||
PENDING = 'pending',
|
||||
ACTIVE = 'active',
|
||||
INACTIVE = 'inactive',
|
||||
SUSPENDED = 'suspended'
|
||||
}
|
||||
33
server/src/types/events/OperationAgentEvent.ts
Normal file
33
server/src/types/events/OperationAgentEvent.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
export enum OperationAgentEvent {
|
||||
// 店铺相关事件
|
||||
STORE_BOUND = 'operation_agent.store.bound',
|
||||
STORE_BIND_FAILED = 'operation_agent.store.bind.failed',
|
||||
STORE_ACTIVATED = 'operation_agent.store.activated',
|
||||
STORE_DEACTIVATED = 'operation_agent.store.deactivated',
|
||||
|
||||
// 商品相关事件
|
||||
PRODUCTS_SYNCED = 'operation_agent.products.synced',
|
||||
PRODUCTS_SYNC_FAILED = 'operation_agent.products.sync.failed',
|
||||
PRODUCT_PRICE_UPDATED = 'operation_agent.product.price.updated',
|
||||
PRODUCT_PRICE_UPDATE_FAILED = 'operation_agent.product.price.update.failed',
|
||||
PRODUCT_STOCK_UPDATED = 'operation_agent.product.stock.updated',
|
||||
PRODUCT_STOCK_UPDATE_FAILED = 'operation_agent.product.stock.update.failed',
|
||||
PRODUCT_LISTED = 'operation_agent.product.listed',
|
||||
PRODUCT_LIST_FAILED = 'operation_agent.product.list.failed',
|
||||
PRODUCT_DELISTED = 'operation_agent.product.delisted',
|
||||
PRODUCT_DELIST_FAILED = 'operation_agent.product.delist.failed',
|
||||
|
||||
// 订单相关事件
|
||||
ORDERS_SYNCED = 'operation_agent.orders.synced',
|
||||
ORDERS_SYNC_FAILED = 'operation_agent.orders.sync.failed',
|
||||
|
||||
// 平台适配器相关事件
|
||||
ADAPTER_AUTHORIZED = 'operation_agent.adapter.authorized',
|
||||
ADAPTER_AUTH_FAILED = 'operation_agent.adapter.auth.failed',
|
||||
ADAPTER_API_ERROR = 'operation_agent.adapter.api.error',
|
||||
|
||||
// 系统相关事件
|
||||
AGENT_STARTED = 'operation_agent.started',
|
||||
AGENT_STOPPED = 'operation_agent.stopped',
|
||||
AGENT_HEARTBEAT = 'operation_agent.heartbeat'
|
||||
}
|
||||
26
server/src/types/models/Order.ts
Normal file
26
server/src/types/models/Order.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface OrderItem {
|
||||
productId: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
}
|
||||
|
||||
export interface ShippingAddress {
|
||||
name: string;
|
||||
address: string;
|
||||
city: string;
|
||||
state: string;
|
||||
zip: string;
|
||||
country: string;
|
||||
}
|
||||
|
||||
export interface Order {
|
||||
id: string;
|
||||
customerId: string;
|
||||
totalAmount: number;
|
||||
status: string;
|
||||
items: OrderItem[];
|
||||
shippingAddress: ShippingAddress;
|
||||
paymentMethod: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
13
server/src/types/models/Product.ts
Normal file
13
server/src/types/models/Product.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface Product {
|
||||
id: string;
|
||||
name: string;
|
||||
sku: string;
|
||||
price: number;
|
||||
stock: number;
|
||||
description: string;
|
||||
images: string[];
|
||||
categories: string[];
|
||||
attributes: Record<string, any>;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
8
server/src/types/models/ShopInfo.ts
Normal file
8
server/src/types/models/ShopInfo.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface ShopInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
status: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user