Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | import type { Additive, Ingredient } from '../lib/supabase';
/**
* 标签
*/
export interface CatFoodTag {
id: number;
name: string;
description?: string;
}
/**
* 百分比数据 - 动态营养成分数据
* 支持任意营养成分字段名
*/
export type PercentData = Record<string, number | null>;
/**
* 猫粮(GET 请求返回的完整数据)
*/
export interface CatFood {
/** 唯一标识 */
id: number;
/** 猫粮名称 */
name: string;
/** 品牌名称 */
brand: string;
/** 商品条形码 */
barcode?: string | null;
/** 用户总分(只读) */
score: number;
/** 打分人数(只读) */
countNum: number;
/** 点赞数量(只读) */
like_count: number;
/** 猫粮图片URL */
imageUrl: string | null;
/** 标签列表 - 字符串数组 */
tags: string[];
/** 营养成分列表 - 完整对象数组 */
ingredient: Ingredient[];
/** 添加剂列表 - 完整对象数组 */
additive: Additive[];
/** 安全性分析 */
safety: string;
/** 营养分析 */
nutrient: string;
/** 能否生成图表作定量分析 */
percentage: boolean;
/** 百分比数据 */
percentData: PercentData;
/** 创建时间(只读) */
created_at: string;
/** 更新时间(只读) */
updated_at: string;
}
/**
* 猫粮创建/更新请求(POST/PUT 请求发送的数据)
*/
export interface CatFoodCreateUpdate {
/** 猫粮名称 */
name: string;
/** 品牌名称 */
brand: string;
/** 商品条形码 */
barcode?: string;
/** 猫粮图片URL */
imageUrl?: string;
/** 标签名称数组(字符串数组,后端会自动创建标签) */
tags?: string[];
/** 营养成分ID数组 */
ingredient?: number[];
/** 添加剂ID数组 */
additive?: number[];
/** 安全性分析 */
safety?: string;
/** 营养分析 */
nutrient?: string;
/** 能否生成图表作定量分析 */
percentage?: boolean;
/** 百分比数据 */
percentData?: PercentData;
}
|