1. Session end time saving. 2. Plan Id to the saved session. 3. History page redesigned (attributes moved, sets list hidden. 4. Session duration added. 5. Session start and end time logging fixed.

This commit is contained in:
AG
2025-11-24 23:22:09 +02:00
parent cce1e58c7b
commit 72867668d4
7 changed files with 116 additions and 64 deletions

Binary file not shown.

View File

@@ -57,6 +57,8 @@ model WorkoutSession {
endTime DateTime?
userBodyWeight Float?
note String?
planId String?
planName String?
sets WorkoutSet[]
}

View File

@@ -40,7 +40,7 @@ router.get('/', async (req: any, res) => {
router.post('/', async (req: any, res) => {
try {
const userId = req.user.userId;
const { id, startTime, endTime, userBodyWeight, note, sets } = req.body;
const { id, startTime, endTime, userBodyWeight, note, planId, planName, sets } = req.body;
// Convert timestamps to Date objects if they are numbers
const start = new Date(startTime);
@@ -62,6 +62,8 @@ router.post('/', async (req: any, res) => {
endTime: end,
userBodyWeight: weight,
note,
planId,
planName,
sets: {
create: sets.map((s: any, idx: number) => ({
exerciseId: s.exerciseId,
@@ -87,6 +89,8 @@ router.post('/', async (req: any, res) => {
endTime: end,
userBodyWeight: weight,
note,
planId,
planName,
sets: {
create: sets.map((s: any, idx: number) => ({
exerciseId: s.exerciseId,