feat: enhance product entity and mapper to calculate total calories based on nutritional values

This commit is contained in:
ilhamtahir committed 2026-01-15 07:01:05 +08:00
1 parent d856dc1887
commit 2dfc1dafec
3 files changed
+91 -10

No files matched your search

+20 -10
View File
@@ -26,24 +26,34 @@ export class Product extends BaseEntity {
@Column()
totalWeight: number;
//蛋白质
@Column()
//蛋白质(百分比,如0.6表示60%)
@Column({
type: 'double',
})
protein: number;
// 脂肪
@Column()
// 脂肪(百分比)
@Column({
type: 'double',
})
fat: number;
// 粗纤维
@Column()
// 粗纤维(百分比)
@Column({
type: 'double',
})
fiber: number;
// 粗灰分
@Column()
// 粗灰分(百分比)
@Column({
type: 'double',
})
ash: number;
// 水分
@Column()
// 水分(百分比)
@Column({
type: 'double',
})
moisture: number;
@OneToMany(