All tests fixed. Deployment on NAS prepared

This commit is contained in:
aodulov
2025-12-18 07:29:35 +02:00
parent 9cb0d66455
commit 97b4e5de32
37 changed files with 1303 additions and 2083 deletions

View File

@@ -19,4 +19,4 @@ ADMIN_PASSWORD_PROD="secure-prod-password-change-me"
DATABASE_URL="file:./prisma/dev.db"
GEMINI_API_KEY=AIzaSyC88SeFyFYjvSfTqgvEyr7iqLSvEhuadoE
DEFAULT_EXERCISES_CSV_PATH='default_exercises.csv'
DEFAULT_EXERCISES_CSV_PATH="default_exercises.csv"

Binary file not shown.

View File

@@ -10,7 +10,7 @@ import prisma from './src/lib/prisma';
}
let user;
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 10; i++) {
user = await prisma.user.findUnique({ where: { email } });
if (user) break;
console.log(`User ${email} not found, retrying (${i + 1}/5)...`);

View File

@@ -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) => {

View File

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

Binary file not shown.