All tests fixed. Deployment on NAS prepared
This commit is contained in:
@@ -92,9 +92,23 @@ app.use('/api/weight', weightRoutes);
|
||||
app.use('/api/bookmarks', bookmarksRoutes);
|
||||
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('GymFlow AI API is running');
|
||||
});
|
||||
// Serve frontend in production
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
const distPath = path.join(__dirname, '../../dist');
|
||||
app.use(express.static(distPath));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
if (!req.path.startsWith('/api')) {
|
||||
res.sendFile(path.join(distPath, 'index.html'));
|
||||
} else {
|
||||
res.status(404).json({ error: 'API route not found' });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
app.get('/', (req, res) => {
|
||||
res.send('GymFlow AI API is running (Dev Mode)');
|
||||
});
|
||||
}
|
||||
|
||||
ensureAdminUser()
|
||||
.catch((e) => {
|
||||
|
||||
@@ -8,14 +8,18 @@ export const sessionSchema = z.object({
|
||||
note: z.string().nullable().optional(),
|
||||
planId: z.string().nullable().optional(),
|
||||
planName: z.string().nullable().optional(),
|
||||
type: z.string().optional(), // Added missing field
|
||||
sets: z.array(z.object({
|
||||
exerciseId: z.string(),
|
||||
timestamp: z.union([z.number(), z.string(), z.date()]).optional(), // Added missing field
|
||||
weight: z.number().nullable().optional(),
|
||||
reps: z.number().nullable().optional(),
|
||||
distanceMeters: z.number().nullable().optional(),
|
||||
durationSeconds: z.number().nullable().optional(),
|
||||
completed: z.boolean().optional().default(true),
|
||||
side: z.string().nullable().optional()
|
||||
side: z.string().nullable().optional(),
|
||||
height: z.number().nullable().optional(), // Added missing field
|
||||
bodyWeightPercentage: z.number().nullable().optional() // Added missing field
|
||||
}))
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user