Files
homepage/src/models/WorkoutSchedule.ts
Alexander Bocken 6103bb75a0
All checks were successful
CI / update (push) Successful in 2m2s
fitness: add workout schedule rotation with next-workout suggestion
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
2026-03-21 10:53:44 +01:00

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);