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.UUID, defaultValue: DataType.UUIDV4, }) declare id: string; @Column({ type: DataType.BOOLEAN, defaultValue: false, comment: '是否激活' }) declare isActive: boolean; @Column({ type: DataType.STRING, allowNull: false }) declare userId: string; // 计划名称 @Column({ type: DataType.STRING, allowNull: true }) declare name: 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; @Column({ type: DataType.BOOLEAN, defaultValue: false }) declare deleted: boolean; }