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
32 lines
665 B
TypeScript
32 lines
665 B
TypeScript
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);
|