c9a4404052
- 公开前端 SPA(根路径 /):首页大搜索框、检索结果、只读商品详情、贡献档案表单 - 公开写入端点 POST /api/public/submissions(无需登录,基础频率限流),投稿进入 submission 待审核队列,不直接写 product - 迁移 0006:submission 投稿表 + community 来源(trust=0.50) - 后台审核队列:列表(待审核/已通过/已驳回) → 查看投稿 → 通过(创建/补全商品 + 记 source=community + 字段级溯源 + 审计 + 重算质量分) / 驳回(记原因) - 公开只读 api 服务内嵌公开 SPA;Dockerfile.prod 增加 node 构建阶段 + 内嵌 dist Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
export interface ProductSummary {
|
|
id: string;
|
|
gtin: string | null;
|
|
name: string;
|
|
brand: string | null;
|
|
category_path: string | null;
|
|
}
|
|
|
|
export interface Product {
|
|
id: string;
|
|
gtin: string | null;
|
|
name: string;
|
|
brand: string | null;
|
|
category_path: string | 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;
|
|
}
|
|
|
|
export interface Category {
|
|
id: string;
|
|
name_zh: string;
|
|
name_en: string | null;
|
|
path: string;
|
|
level: number;
|
|
}
|
|
|
|
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;
|
|
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)",
|
|
};
|