Files
ozon-seller-kit/extension-v1/src/schema/product.ts
T

77 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Product JSON - 商品文件夹契约(TS 侧)
* 对应 server/schemas/product.pyPydantic 为真源)
* 详见 docs/contracts/product-json.md
*/
export type Stage = 'collected' | 'edited' | 'published';
export interface ProductJson {
_meta: {
schemaVersion: 1;
stage: Stage;
createdAt: string; // ISO 8601
updatedAt: string;
};
// Ozon 字段(对齐 ImportProductsV3
offer_id: string;
name: string;
description: string;
description_category_id: number | null;
price: string;
old_price?: string;
currency_code: 'RUB' | 'CNY';
vat: string;
depth: number | null;
width: number | null;
height: number | null;
dimension_unit: 'mm' | 'cm';
weight: number | null;
weight_unit: 'g' | 'kg';
images: string[]; // 发布时填公网 URL
primary_image?: string;
color_image?: string;
attributes: any[]; // 工作台映射后才填
complex_attributes?: any[];
// 本地扩展字段(下划线前缀)
_images: {
main: ImageMeta[];
sku: ImageMeta[];
detail: ImageMeta[];
video: ImageMeta[];
};
_raw: {
title: string;
price: string;
params?: Array<{ key: string; value: string }>;
desc?: string;
};
_pricing?: any; // 工作台计价结果
}
export interface ImageMeta {
file: string; // 相对路径:images/main/main-001.jpg
sourceUrl: string; // 源站 URL(可能失效)
variantName?: string; // SKU 规格名
w?: number;
h?: number;
}
export interface SourcesJson {
sources: Array<{
platform: '1688' | 'taobao' | 'ozon';
itemId: string | null;
url: string;
collectedAt: string; // ISO 8601
counts: Record<string, number>;
}>;
dedupeKeys: string[]; // URL 去重指纹
}