CI / Go (api) (pull_request) Successful in 1m59s
CI / Python (ingestion) (pull_request) Successful in 1m13s
CI / Migrations (postgres) (pull_request) Successful in 27s
后端 ProductByID/ProductByGTIN 在商品详情 JSON 中内嵌 msrp 字段(按 effective_date 倒序,过滤 amount=0 的无效快照);公开前台详情页新增「建议零售价」展示。 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
117 lines
2.6 KiB
TypeScript
117 lines
2.6 KiB
TypeScript
export interface ProductSummary {
|
|
id: string;
|
|
gtin: string | null;
|
|
name: string;
|
|
brand: string | null;
|
|
category_path: string | null;
|
|
country_of_origin?: string | null;
|
|
quality_score?: number;
|
|
score?: number | null;
|
|
}
|
|
|
|
export interface Barcode {
|
|
gtin: string;
|
|
gtin_type: string;
|
|
pack_level: string;
|
|
region: string | null;
|
|
is_primary: boolean;
|
|
}
|
|
|
|
export interface ProductSpec {
|
|
key: string;
|
|
label: string;
|
|
value: string;
|
|
unit?: string;
|
|
}
|
|
|
|
export interface Msrp {
|
|
amount: number;
|
|
currency: string;
|
|
region: string;
|
|
effective_date?: string | null;
|
|
source_url?: string | null;
|
|
note?: string | null;
|
|
}
|
|
|
|
export interface Product {
|
|
id: string;
|
|
gtin: string | null;
|
|
barcodes?: Barcode[] | null;
|
|
name: string;
|
|
brand: string | null;
|
|
category_path: string | null;
|
|
archive_kind?: string;
|
|
specs?: ProductSpec[] | null;
|
|
net_content_value: number | null;
|
|
net_content_unit: string | null;
|
|
country_of_origin: string | null;
|
|
quality_score: number;
|
|
nutriments?: Record<string, unknown> | null;
|
|
nutrition_basis?: string | null;
|
|
nutri_score?: string | null;
|
|
ingredients_text?: string | null;
|
|
allergens?: string[] | null;
|
|
additives?: string[] | null;
|
|
msrp?: Msrp[] | null;
|
|
}
|
|
|
|
export interface Category {
|
|
id: string;
|
|
name_zh: string;
|
|
name_en: string | null;
|
|
path: string;
|
|
level: number;
|
|
archive_kind: string;
|
|
}
|
|
|
|
export interface KindField {
|
|
kind: string;
|
|
field_key: string;
|
|
group_label: string;
|
|
label_zh: string;
|
|
field_type: "text" | "number" | "textarea" | "select" | "list";
|
|
unit: string | null;
|
|
options: string[] | null;
|
|
placeholder: string | null;
|
|
sort_order: number;
|
|
qualified: boolean;
|
|
}
|
|
|
|
export interface SubmissionImage {
|
|
url: string;
|
|
kind: string;
|
|
}
|
|
|
|
export interface SubmissionInput {
|
|
gtin?: string | null;
|
|
name: string;
|
|
brand_name?: string | null;
|
|
category_id?: string | null;
|
|
net_content_value?: number | null;
|
|
net_content_unit?: string | null;
|
|
country_of_origin?: string | null;
|
|
ingredients_text?: string | null;
|
|
nutriments?: Record<string, number> | null;
|
|
attributes?: Record<string, unknown> | null;
|
|
nutrition_basis?: string | null;
|
|
serving_size?: string | null;
|
|
nutri_score?: string | null;
|
|
images?: SubmissionImage[];
|
|
submitter_name?: string | null;
|
|
submitter_contact?: string | null;
|
|
note?: string | null;
|
|
}
|
|
|
|
export const NUTRIMENT_LABELS: Record<string, string> = {
|
|
energy_kcal: "能量 (kcal)",
|
|
energy_kj: "能量 (kJ)",
|
|
fat: "脂肪 (g)",
|
|
saturated_fat: "饱和脂肪 (g)",
|
|
carbohydrates: "碳水 (g)",
|
|
sugars: "糖 (g)",
|
|
proteins: "蛋白质 (g)",
|
|
salt: "盐 (g)",
|
|
sodium: "钠 (g)",
|
|
fiber: "膳食纤维 (g)",
|
|
};
|