Critical Stability & Performance fixes. Excessive Log Set button gone on QIuck Log screen

This commit is contained in:
AG
2025-12-06 08:58:44 +02:00
parent 27afacee3f
commit 1c3e15516c
35 changed files with 48 additions and 26 deletions

View File

@@ -41,6 +41,32 @@ router.get('/', async (req: any, res) => {
}
});
// Get last set for specific exercise
router.get('/:id/last-set', async (req: any, res) => {
try {
const userId = req.user.userId;
const exerciseId = req.params.id;
const lastSet = await prisma.workoutSet.findFirst({
where: {
exerciseId,
session: { userId } // Ensure optimization by filtering sessions of the user
},
include: {
session: true
},
orderBy: {
timestamp: 'desc'
}
});
res.json({ success: true, set: lastSet });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Server error' });
}
});
// Create/Update exercise
router.post('/', async (req: any, res) => {
try {