- 创建普拉提分类和动作数据的SQL导入脚本,支持垫上普拉提和器械普拉提的分类管理 - 实现数据库结构迁移脚本,添加新字段以支持普拉提类型和器械名称 - 更新数据库升级总结文档,详细说明数据库结构变更和数据导入步骤 - 创建训练会话相关表,支持每日训练实例功能 - 引入训练会话管理模块,整合训练计划与实际训练会话的关系
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import { ApiProperty, PartialType } from '@nestjs/swagger';
|
||
import { IsArray, IsBoolean, IsDateString, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Min } from 'class-validator';
|
||
import { WorkoutStatus } from '../models/workout-session.model';
|
||
|
||
// 注意:训练会话由系统自动创建,不需要手动创建DTO
|
||
|
||
export class StartWorkoutDto {
|
||
@ApiProperty({ description: '实际开始时间', required: false })
|
||
@IsDateString()
|
||
@IsOptional()
|
||
startedAt?: string;
|
||
}
|
||
|
||
// 注意:训练会话自动完成,不需要手动完成DTO
|
||
|
||
export class UpdateWorkoutSessionDto {
|
||
@ApiProperty({ description: '训练总结', required: false })
|
||
@IsString()
|
||
@IsOptional()
|
||
summary?: string;
|
||
|
||
@ApiProperty({ description: '消耗卡路里', required: false })
|
||
@IsInt()
|
||
@Min(0)
|
||
@IsOptional()
|
||
caloriesBurned?: number;
|
||
}
|
||
|
||
export class WorkoutSessionResponseDto {
|
||
@ApiProperty() id: string;
|
||
@ApiProperty() userId: string;
|
||
@ApiProperty() trainingPlanId: string;
|
||
@ApiProperty() name: string;
|
||
@ApiProperty() scheduledDate: Date;
|
||
@ApiProperty({ required: false }) startedAt?: Date;
|
||
@ApiProperty({ required: false }) completedAt?: Date;
|
||
@ApiProperty({ enum: ['planned', 'in_progress', 'completed', 'skipped'] }) status: WorkoutStatus;
|
||
@ApiProperty({ required: false }) totalDurationSec?: number;
|
||
@ApiProperty({ required: false }) summary?: string;
|
||
@ApiProperty({ required: false }) caloriesBurned?: number;
|
||
@ApiProperty({ required: false }) stats?: {
|
||
totalExercises?: number;
|
||
completedExercises?: number;
|
||
totalSets?: number;
|
||
completedSets?: number;
|
||
totalReps?: number;
|
||
completedReps?: number;
|
||
};
|
||
@ApiProperty() createdAt: Date;
|
||
@ApiProperty() updatedAt: Date;
|
||
|
||
// 关联的训练计划信息
|
||
@ApiProperty({ required: false })
|
||
trainingPlan?: {
|
||
id: string;
|
||
name: string;
|
||
goal: string;
|
||
};
|
||
|
||
// 训练动作列表
|
||
@ApiProperty({ required: false, type: 'array' })
|
||
exercises?: any[];
|
||
}
|