77 lines
2.8 KiB
TypeScript
77 lines
2.8 KiB
TypeScript
/** 商品编辑领域从数据库读取的商品行。 */
|
|
export type ProductRow = {
|
|
id: string;
|
|
collection_item_id: string;
|
|
revision: number;
|
|
source_title: string | null;
|
|
brand: string | null;
|
|
model: string | null;
|
|
barcode: string | null;
|
|
purchase_url: string | null;
|
|
source_url: string | null;
|
|
supply_note: string | null;
|
|
default_physical_length_mm: string | null;
|
|
default_physical_width_mm: string | null;
|
|
default_physical_height_mm: string | null;
|
|
default_net_weight_g: string | null;
|
|
default_package_length_mm: string | null;
|
|
default_package_width_mm: string | null;
|
|
default_package_height_mm: string | null;
|
|
default_shipping_weight_g: string | null;
|
|
package_weight_mode: 'common' | 'variant';
|
|
package_dimensions_mode: 'common' | 'variant';
|
|
physical_spec_status: 'missing' | 'ambiguous' | 'confirmed';
|
|
package_spec_status: 'missing' | 'ambiguous' | 'confirmed';
|
|
ai_source_material_overrides: unknown;
|
|
ai_source_material_base_revision: number | string | null;
|
|
normalized_payload: unknown;
|
|
source_snapshot_revision: number | string;
|
|
};
|
|
|
|
/** 商品在一个发布平台下的编辑配置行。 */
|
|
export type ProfileRow = {
|
|
id: string;
|
|
product_id: string;
|
|
revision: number;
|
|
platform_id: string;
|
|
market_code: string | null;
|
|
fulfillment: string;
|
|
title: string | null;
|
|
title_mode: 'common' | 'variant';
|
|
description: string | null;
|
|
tags: unknown;
|
|
platform_product_category_id: string | null;
|
|
store_product_category_id: string | null;
|
|
platform_type_id: string | null;
|
|
category_source: string | null;
|
|
category_name: string | null;
|
|
category_path: string | null;
|
|
target_store_id: string;
|
|
store_name: string;
|
|
currency_code: string;
|
|
};
|
|
|
|
/** 异步目录任务返回给客户端所需的操作行。 */
|
|
export type OperationRow = {
|
|
id: string;
|
|
kind: string;
|
|
status: string;
|
|
created_at: Date | string;
|
|
completed_at: Date | string | null;
|
|
error_code: string | null;
|
|
error_message: string | null;
|
|
};
|
|
|
|
/** 统一读取发布配置及其目标店铺与类目展示信息的查询片段。 */
|
|
export const profileSelect = `SELECT p.id, p.product_id, p.revision, p.platform_id, p.market_code,
|
|
p.fulfillment, p.title, p.title_mode, p.description, p.tags, p.platform_product_category_id,
|
|
p.store_product_category_id,
|
|
p.platform_type_id, p.category_source, category.name AS category_name,
|
|
category.path AS category_path, p.target_store_id, s.name AS store_name,
|
|
s.currency_code
|
|
FROM atlas.product_platform_profiles p
|
|
JOIN atlas.stores s ON s.id = p.target_store_id
|
|
LEFT JOIN atlas.platform_product_categories category
|
|
ON category.id = p.platform_product_category_id
|
|
AND category.platform_id = p.platform_id`;
|