新增训练计划模块,包括控制器、服务、模型及数据传输对象,更新应用模块以引入新模块,同时在AI教练模块中添加体态评估功能,支持体重识别与更新,优化用户体重历史记录管理。
This commit is contained in:
49
src/training-plans/models/training-plan.model.ts
Normal file
49
src/training-plans/models/training-plan.model.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Column, DataType, Index, Model, PrimaryKey, Table } from 'sequelize-typescript';
|
||||
|
||||
export type PlanMode = 'daysOfWeek' | 'sessionsPerWeek';
|
||||
export type PlanGoal = 'postpartum_recovery' | 'fat_loss' | 'posture_correction' | 'core_strength' | 'flexibility' | 'rehab' | 'stress_relief' | '';
|
||||
|
||||
@Table({
|
||||
tableName: 't_training_plans',
|
||||
underscored: true,
|
||||
})
|
||||
export class TrainingPlan extends Model {
|
||||
@PrimaryKey
|
||||
@Column({ type: DataType.STRING })
|
||||
declare id: string;
|
||||
|
||||
@Column({ type: DataType.STRING, allowNull: false })
|
||||
declare userId: string;
|
||||
|
||||
@Column({ type: DataType.DATE, allowNull: false })
|
||||
declare createdAt: Date;
|
||||
|
||||
@Column({ type: DataType.DATE, allowNull: false })
|
||||
declare startDate: Date;
|
||||
|
||||
@Column({ type: DataType.ENUM('daysOfWeek', 'sessionsPerWeek'), allowNull: false })
|
||||
declare mode: PlanMode;
|
||||
|
||||
@Column({ type: DataType.JSON, allowNull: false, comment: '0-6' })
|
||||
declare daysOfWeek: number[];
|
||||
|
||||
@Column({ type: DataType.INTEGER, allowNull: false })
|
||||
declare sessionsPerWeek: number;
|
||||
|
||||
@Column({
|
||||
type: DataType.ENUM('postpartum_recovery', 'fat_loss', 'posture_correction', 'core_strength', 'flexibility', 'rehab', 'stress_relief', ''),
|
||||
allowNull: false,
|
||||
})
|
||||
declare goal: PlanGoal;
|
||||
|
||||
@Column({ type: DataType.FLOAT, allowNull: true })
|
||||
declare startWeightKg: number | null;
|
||||
|
||||
@Column({ type: DataType.ENUM('morning', 'noon', 'evening', ''), allowNull: false, defaultValue: '' })
|
||||
declare preferredTimeOfDay: 'morning' | 'noon' | 'evening' | '';
|
||||
|
||||
@Column({ type: DataType.DATE, defaultValue: DataType.NOW })
|
||||
declare updatedAt: Date;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user