Archived exercises hidden from selects. Password fields Show Password toggle
This commit is contained in:
Binary file not shown.
@@ -7,7 +7,8 @@ export class ExerciseController {
|
||||
static async getAllExercises(req: any, res: Response) {
|
||||
try {
|
||||
const userId = req.user.userId;
|
||||
const exercises = await ExerciseService.getAllExercises(userId);
|
||||
const includeArchived = req.query.includeArchived === 'true';
|
||||
const exercises = await ExerciseService.getAllExercises(userId, includeArchived);
|
||||
return sendSuccess(res, exercises);
|
||||
} catch (error) {
|
||||
logger.error('Error in getAllExercises', { error });
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
export class ExerciseService {
|
||||
static async getAllExercises(userId: string) {
|
||||
static async getAllExercises(userId: string, includeArchived: boolean = false) {
|
||||
const exercises = await prisma.exercise.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ userId: null }, // System default
|
||||
{ userId } // User custom
|
||||
AND: [
|
||||
{
|
||||
OR: [
|
||||
{ userId: null }, // System default
|
||||
{ userId } // User custom
|
||||
]
|
||||
},
|
||||
includeArchived ? {} : { isArchived: false }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user