- 创建普拉提分类和动作数据的SQL导入脚本,支持垫上普拉提和器械普拉提的分类管理 - 实现数据库结构迁移脚本,添加新字段以支持普拉提类型和器械名称 - 更新数据库升级总结文档,详细说明数据库结构变更和数据导入步骤 - 创建训练会话相关表,支持每日训练实例功能 - 引入训练会话管理模块,整合训练计划与实际训练会话的关系
64 lines
2.2 KiB
TypeScript
64 lines
2.2 KiB
TypeScript
import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from 'sequelize-typescript';
|
|
import { ExerciseCategory } from './exercise-category.model';
|
|
|
|
@Table({
|
|
tableName: 't_exercises',
|
|
underscored: true,
|
|
})
|
|
export class Exercise extends Model {
|
|
@Column({
|
|
type: DataType.STRING,
|
|
primaryKey: true,
|
|
comment: '动作唯一键(英文/下划线)',
|
|
})
|
|
declare key: string;
|
|
|
|
@Column({ type: DataType.STRING, allowNull: false, comment: '动作名称' })
|
|
declare name: string;
|
|
|
|
@Column({ type: DataType.STRING, allowNull: false, comment: '中文分类名(冗余,便于展示)' })
|
|
declare categoryName: string;
|
|
|
|
@Column({ type: DataType.TEXT, allowNull: true, comment: '动作描述' })
|
|
declare description: string;
|
|
|
|
@Column({ type: DataType.TEXT, allowNull: false, comment: '主要锻炼肌肉群' })
|
|
declare targetMuscleGroups: string;
|
|
|
|
@Column({ type: DataType.STRING, allowNull: true, comment: '器械名称(器械普拉提专用)' })
|
|
declare equipmentName: string;
|
|
|
|
@Column({ type: DataType.INTEGER, allowNull: true, comment: '入门级别建议练习次数' })
|
|
declare beginnerReps: number;
|
|
|
|
@Column({ type: DataType.INTEGER, allowNull: true, comment: '入门级别建议组数' })
|
|
declare beginnerSets: number;
|
|
|
|
@Column({ type: DataType.INTEGER, allowNull: true, comment: '呼吸循环次数(替代普通次数)' })
|
|
declare breathingCycles: number;
|
|
|
|
@Column({ type: DataType.INTEGER, allowNull: true, comment: '保持时间(秒)' })
|
|
declare holdDuration: number;
|
|
|
|
@Column({ type: DataType.STRING, allowNull: true, comment: '特殊说明(如每侧、前后各等)' })
|
|
declare specialInstructions: string;
|
|
|
|
@ForeignKey(() => ExerciseCategory)
|
|
@Column({ type: DataType.STRING, allowNull: false, comment: '分类键' })
|
|
declare categoryKey: string;
|
|
|
|
@BelongsTo(() => ExerciseCategory, { foreignKey: 'categoryKey', targetKey: 'key' })
|
|
declare category: ExerciseCategory;
|
|
|
|
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0, comment: '排序(分类内)' })
|
|
declare sortOrder: number;
|
|
|
|
@Column({ type: DataType.DATE, defaultValue: DataType.NOW })
|
|
declare createdAt: Date;
|
|
|
|
@Column({ type: DataType.DATE, defaultValue: DataType.NOW })
|
|
declare updatedAt: Date;
|
|
}
|
|
|
|
|