Timer implemented. No working tests.
This commit is contained in:
BIN
server/dev.db
BIN
server/dev.db
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
datasource: {
|
||||
url: process.env.DATABASE_URL,
|
||||
},
|
||||
};
|
||||
5
server/prisma.config.ts
Normal file
5
server/prisma.config.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export default {
|
||||
datasource: {
|
||||
url: process.env.DATABASE_URL || "file:./dev.db",
|
||||
},
|
||||
};
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "PlanExercise" ADD COLUMN "restTime" INTEGER;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserProfile" ADD COLUMN "restTimerDefault" INTEGER DEFAULT 120;
|
||||
@@ -46,6 +46,7 @@ model UserProfile {
|
||||
gender String?
|
||||
birthDate DateTime?
|
||||
language String? @default("en")
|
||||
restTimerDefault Int? @default(120) // Default rest timer in seconds
|
||||
}
|
||||
|
||||
model Exercise {
|
||||
@@ -116,5 +117,6 @@ model PlanExercise {
|
||||
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
||||
order Int
|
||||
isWeighted Boolean @default(false)
|
||||
restTime Int? // Optional rest time target in seconds
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
BIN
server/prod.db
Normal file
BIN
server/prod.db
Normal file
Binary file not shown.
@@ -71,9 +71,9 @@ export class AuthController {
|
||||
const userId = req.user.userId;
|
||||
await AuthService.updateProfile(userId, req.body);
|
||||
return sendSuccess(res, null);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
logger.error('Error in updateProfile', { error });
|
||||
return sendError(res, 'Server error', 500);
|
||||
return sendError(res, error.message || 'Server error', 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ export class PlanController {
|
||||
const userId = req.user.userId;
|
||||
const plan = await PlanService.savePlan(userId, req.body);
|
||||
return sendSuccess(res, plan);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
logger.error('Error in savePlan', { error });
|
||||
return sendError(res, 'Server error', 500);
|
||||
return sendError(res, error.message || 'Server error', 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ export const updateProfileSchema = z.object({
|
||||
height: z.number().optional(),
|
||||
gender: z.string().optional(),
|
||||
birthDate: z.string().optional(),
|
||||
language: z.string().optional()
|
||||
language: z.string().optional(),
|
||||
restTimerDefault: z.number().optional()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// forcing reload
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
export class PlanService {
|
||||
@@ -21,6 +22,7 @@ export class PlanService {
|
||||
exerciseName: pe.exercise.name,
|
||||
exerciseType: pe.exercise.type,
|
||||
isWeighted: pe.isWeighted,
|
||||
restTimeSeconds: pe.restTime
|
||||
}))
|
||||
}));
|
||||
}
|
||||
@@ -54,7 +56,8 @@ export class PlanService {
|
||||
planId: id,
|
||||
exerciseId: step.exerciseId,
|
||||
order: index,
|
||||
isWeighted: step.isWeighted || false
|
||||
isWeighted: step.isWeighted || false,
|
||||
restTime: step.restTimeSeconds
|
||||
}))
|
||||
});
|
||||
}
|
||||
@@ -79,7 +82,8 @@ export class PlanService {
|
||||
exerciseId: pe.exerciseId,
|
||||
exerciseName: pe.exercise.name,
|
||||
exerciseType: pe.exercise.type,
|
||||
isWeighted: pe.isWeighted
|
||||
isWeighted: pe.isWeighted,
|
||||
restTimeSeconds: pe.restTime
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
BIN
server/test.db
BIN
server/test.db
Binary file not shown.
Reference in New Issue
Block a user