Cwiczenia: usuniecie martwego pola trudnosc z katalogu (trudnosc pozostaje tylko jako ocena cwiczacego per seria 1-5; migracja DROP kolumny Exercise.difficulty)

This commit is contained in:
tisachi
2026-10-17 08:51:12 +02:00
parent 03e0ace10a
commit 4001aab977
16 changed files with 15 additions and 455 deletions

View File

@@ -0,0 +1,2 @@
-- Usuniecie katalogowego pola difficulty cwiczenia (trudnosc jest ustawiana indywidualnie per seria)
ALTER TABLE "Exercise" DROP COLUMN "difficulty";

View File

@@ -563,7 +563,6 @@ model Exercise {
description String?
howTo String?
commonMistakes String?
difficulty Int @default(3)
source ExerciseSource @default(BUILTIN)
gymId String?
trainerId String?

File diff suppressed because it is too large Load Diff

View File

@@ -34,7 +34,6 @@ const exerciseSchema = z.object({
description: z.string().max(2000).nullable().optional(),
howTo: z.string().max(2000).nullable().optional(),
commonMistakes: z.string().max(2000).nullable().optional(),
difficulty: z.number().int().min(1).max(10).optional(),
equipmentIds: z.array(z.string().min(1)).max(50).optional(),
...hasFlagsSchema,
});
@@ -46,7 +45,6 @@ const exerciseUpdateSchema = z.object({
description: z.string().max(2000).nullable().optional(),
howTo: z.string().max(2000).nullable().optional(),
commonMistakes: z.string().max(2000).nullable().optional(),
difficulty: z.number().int().min(1).max(10).optional(),
equipmentIds: z.array(z.string().min(1)).max(50).optional(),
...hasFlagsSchema,
});

View File

@@ -142,7 +142,6 @@ async function seedExercises() {
description: ex.description,
howTo: ex.howTo,
commonMistakes: ex.commonMistakes,
difficulty: ex.difficulty,
source: 'BUILTIN',
seedVersion: SEED_VERSION,
},
@@ -164,7 +163,6 @@ async function seedExercises() {
description: ex.description,
howTo: ex.howTo,
commonMistakes: ex.commonMistakes,
difficulty: ex.difficulty,
source: 'BUILTIN',
seedVersion: SEED_VERSION,
},

View File

@@ -9,7 +9,6 @@ export interface ExerciseInput {
description?: string | null;
howTo?: string | null;
commonMistakes?: string | null;
difficulty?: number;
/** Equipment ids to link (replaces the current set when provided). */
equipmentIds?: string[];
hasReps?: boolean;
@@ -86,7 +85,6 @@ export async function createExercise(prisma: PrismaClient, data: ExerciseInput)
description: data.description ?? null,
howTo: data.howTo ?? null,
commonMistakes: data.commonMistakes ?? null,
difficulty: data.difficulty ?? 3,
source: 'BUILTIN',
// undefined → Prisma default (has* pozostają przy domyślnych kombinacjach)
hasReps: data.hasReps,
@@ -125,7 +123,6 @@ export async function updateExercise(
description: data.description,
howTo: data.howTo,
commonMistakes: data.commonMistakes,
difficulty: data.difficulty,
hasReps: data.hasReps,
hasLoad: data.hasLoad,
hasRest: data.hasRest,

View File

@@ -622,7 +622,6 @@ export const openapi: Record<string, unknown> = {
description: { type: 'string', nullable: true },
howTo: { type: 'string', nullable: true },
commonMistakes: { type: 'string', nullable: true },
difficulty: { type: 'integer', minimum: 1, maximum: 10 },
equipmentIds: { type: 'array', items: { type: 'string' } },
hasReps: { type: 'boolean' },
hasLoad: { type: 'boolean' },

View File

@@ -66,7 +66,6 @@ export async function createExercise(overrides: { slug?: string; name?: string }
description: 'Test exercise',
howTo: 'Test how-to',
commonMistakes: 'Test mistakes',
difficulty: 3,
source: 'BUILTIN',
},
});

View File

@@ -646,7 +646,6 @@ describe('admin routes', () => {
hasCardio: true,
hasTime: true,
description: 'Bieganie.',
difficulty: 4,
});
expect(res.status).toBe(201);
expect(res.body.exercise).toMatchObject({
@@ -657,7 +656,6 @@ describe('admin routes', () => {
hasTime: true,
hasSpeed: false,
description: 'Bieganie.',
difficulty: 4,
planExercisesCount: 0,
});

View File

@@ -26,7 +26,6 @@ describe('exercises routes', () => {
secondaryMuscles: ['triceps'],
equipment: [],
source: 'BUILTIN',
difficulty: 3,
});
});