fitness: add workout schedule rotation with next-workout suggestion
All checks were successful
CI / update (push) Successful in 2m2s
All checks were successful
CI / update (push) Successful in 2m2s
Users can define a custom order of templates (e.g., Push → Pull → Legs). Based on the last completed session, the next workout in rotation is recommended via a prominent banner and the floating action button. - New WorkoutSchedule MongoDB model (per-user template order) - GET/PUT /api/fitness/schedule API endpoints - Schedule editor modal with reorder and add/remove - Action button starts next scheduled workout when schedule exists
This commit is contained in:
31
src/models/WorkoutSchedule.ts
Normal file
31
src/models/WorkoutSchedule.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
export interface IWorkoutSchedule {
|
||||
_id?: string;
|
||||
userId: string;
|
||||
templateOrder: string[]; // array of WorkoutTemplate _id strings in rotation order
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date;
|
||||
}
|
||||
|
||||
const WorkoutScheduleSchema = new mongoose.Schema(
|
||||
{
|
||||
userId: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
trim: true
|
||||
},
|
||||
templateOrder: {
|
||||
type: [String],
|
||||
default: []
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: { virtuals: true },
|
||||
toObject: { virtuals: true }
|
||||
}
|
||||
);
|
||||
|
||||
export const WorkoutSchedule = mongoose.model<IWorkoutSchedule>('WorkoutSchedule', WorkoutScheduleSchema);
|
||||
Reference in New Issue
Block a user