90dc-core 1.15.4 → 1.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/dbmodels/program/CircularProgramDraft.d.ts +1 -0
- package/dist/lib/dbmodels/program/CircularProgramDraft.d.ts.map +1 -1
- package/dist/lib/dbmodels/program/CircularProgramDraft.js.map +1 -1
- package/dist/lib/dbmodels/program/ExerciseModels.d.ts +2 -0
- package/dist/lib/dbmodels/program/ExerciseModels.d.ts.map +1 -1
- package/dist/lib/dbmodels/program/ExerciseModels.js +13 -0
- package/dist/lib/dbmodels/program/ExerciseModels.js.map +1 -1
- package/dist/lib/models/ExerciseInterfaces.d.ts +1 -0
- package/dist/lib/models/ExerciseInterfaces.d.ts.map +1 -1
- package/dist/lib/models/ExerciseInterfaces.js.map +1 -1
- package/dist/lib/scripts/populate-exercise-thumbnails.d.ts +2 -0
- package/dist/lib/scripts/populate-exercise-thumbnails.d.ts.map +1 -0
- package/dist/lib/scripts/populate-exercise-thumbnails.js +64 -0
- package/dist/lib/scripts/populate-exercise-thumbnails.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularProgramDraft.d.ts","sourceRoot":"","sources":["../../../../src/lib/dbmodels/program/CircularProgramDraft.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAMN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd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AClB,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB;AAED,qBACa,oBAAqB,SAAQ,KAAK;IAOrC,IAAI,EAAE,MAAM,CAAC;IAOb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ7B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAOlC,QAAQ,EAAE,MAAM,CAAC;IAOjB,kBAAkB,EAAE,MAAM,CAAC;IAM3B,SAAS,EAAE,wBAAwB,CAAC;IAQpC,MAAM,EAAE,WAAW,CAAC;IAMpB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAGzB,SAAS,EAAE,sBAAsB,CAAC;IAGlC,gBAAgB,EAAE,OAAO,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/dbmodels/program/CircularProgramDraft.ts"],"sourcesContent":["import {\n Table,\n Column,\n Model,\n DataType,\n Default,\n ForeignKey,\n Index,\n BelongsTo,\n} from \"sequelize-typescript\";\nimport { Program } from \"./Program.js\";\nimport { CustomProgramBlueprint } from \"./CustomProgramBlueprint.js\";\n\nexport type DraftStatus = \"draft\" | \"published\" | \"archived\";\n\nexport interface DraftExercise {\n uuid: string;\n name: string;\n sets: number;\n reps: string;\n order: number;\n restTime?: string | number | null;\n supersetUuid?: string | null;\n thumbnailUrl?: string | null;\n}\n\nexport interface DraftSuperset {\n uuid: string;\n startPosition: number;\n exercises: Omit<DraftExercise, \"supersetUuid\">[];\n}\n\nexport interface DraftWorkout {\n uuid: string;\n title: string;\n duration: string;\n order: number;\n exercises: DraftExercise[];\n supersets: DraftSuperset[];\n}\n\nexport interface DraftRestDay {\n uuid: string;\n order: number;\n}\n\nexport interface DraftStrengthTestExercise {\n uuid: string;\n title: string;\n url: string;\n pointer: string;\n timerTime: string;\n order: number;\n}\n\nexport interface DraftStrengthTest {\n uuid: string;\n type: string;\n order: number;\n exercises: DraftStrengthTestExercise[];\n}\n\nexport interface DraftChallenge {\n uuid: string;\n title: string;\n order: number;\n progress: any[];\n}\n\n// Individual day types for internal use\nexport interface DraftDay {\n uuid: string;\n type: \"Workout\" | \"ActiveRestDay\" | \"StrengthTest\" | \"Challenge\";\n templateIndex: number; // order in the program sequence\n isFinished?: boolean;\n\n // Workout-specific fields\n title?: string;\n duration?: string;\n order?: number; // workout order (same as templateIndex)\n programId?: string; // reference to program\n exercise?: DraftExercise[];\n superset?: DraftSuperset[];\n\n // StrengthTest-specific fields\n strengthTestExercise?: DraftStrengthTestExercise[];\n\n // Challenge-specific fields\n progress?: any[];\n restDayUuid?: string;\n}\n\n// Main draft data structure - matches getUniqueProgram format\nexport interface CircularProgramDraftData {\n startDate: string;\n days: DraftDay[]; // Flat array of all days, sorted by templateIndex\n}\n\n@Table({ tableName: \"CircularProgramDrafts\", timestamps: true })\nexport class CircularProgramDraft extends Model {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n primaryKey: true,\n allowNull: false,\n })\n declare uuid: string;\n\n @ForeignKey(() => CustomProgramBlueprint)\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare blueprintUuid: string | null;\n\n @ForeignKey(() => Program)\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare publishedProgramId: string | null;\n\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userUuid: string;\n\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare createdByCoachUuid: string;\n\n @Column({\n type: DataType.JSONB,\n allowNull: false,\n })\n declare draftData: CircularProgramDraftData;\n\n @Index\n @Column({\n type: DataType.ENUM(\"draft\", \"published\", \"archived\"),\n allowNull: false,\n defaultValue: \"draft\",\n })\n declare status: DraftStatus;\n\n @Column({\n type: DataType.DATE,\n allowNull: true,\n })\n declare publishedAt: Date | null;\n\n @BelongsTo(() => CustomProgramBlueprint)\n declare blueprint: CustomProgramBlueprint;\n\n @BelongsTo(() => Program)\n declare publishedProgram: Program;\n}\n"],"names":["Table","Column","Model","DataType","Default","ForeignKey","Index","BelongsTo","Program","CustomProgramBlueprint","CircularProgramDraft","UUIDV4","type","UUID","primaryKey","allowNull","JSONB","ENUM","defaultValue","DATE","tableName","timestamps"],"mappings":";;;;;;AAAA,SACEA,KAAK,EACLC,MAAM,EACNC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,SAAS,QACJ,uBAAuB;AAC9B,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,sBAAsB,QAAQ,8BAA8B;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/program/CircularProgramDraft.ts"],"sourcesContent":["import {\n Table,\n Column,\n Model,\n DataType,\n Default,\n ForeignKey,\n Index,\n BelongsTo,\n} from \"sequelize-typescript\";\nimport { Program } from \"./Program.js\";\nimport { CustomProgramBlueprint } from \"./CustomProgramBlueprint.js\";\n\nexport type DraftStatus = \"draft\" | \"published\" | \"archived\";\n\nexport interface DraftExercise {\n uuid: string;\n name: string;\n sets: number;\n reps: string;\n order: number;\n restTime?: string | number | null;\n supersetUuid?: string | null;\n thumbnailUrl?: string | null;\n coachNote?: string | null;\n}\n\nexport interface DraftSuperset {\n uuid: string;\n startPosition: number;\n exercises: Omit<DraftExercise, \"supersetUuid\">[];\n}\n\nexport interface DraftWorkout {\n uuid: string;\n title: string;\n duration: string;\n order: number;\n exercises: DraftExercise[];\n supersets: DraftSuperset[];\n}\n\nexport interface DraftRestDay {\n uuid: string;\n order: number;\n}\n\nexport interface DraftStrengthTestExercise {\n uuid: string;\n title: string;\n url: string;\n pointer: string;\n timerTime: string;\n order: number;\n}\n\nexport interface DraftStrengthTest {\n uuid: string;\n type: string;\n order: number;\n exercises: DraftStrengthTestExercise[];\n}\n\nexport interface DraftChallenge {\n uuid: string;\n title: string;\n order: number;\n progress: any[];\n}\n\n// Individual day types for internal use\nexport interface DraftDay {\n uuid: string;\n type: \"Workout\" | \"ActiveRestDay\" | \"StrengthTest\" | \"Challenge\";\n templateIndex: number; // order in the program sequence\n isFinished?: boolean;\n\n // Workout-specific fields\n title?: string;\n duration?: string;\n order?: number; // workout order (same as templateIndex)\n programId?: string; // reference to program\n exercise?: DraftExercise[];\n superset?: DraftSuperset[];\n\n // StrengthTest-specific fields\n strengthTestExercise?: DraftStrengthTestExercise[];\n\n // Challenge-specific fields\n progress?: any[];\n restDayUuid?: string;\n}\n\n// Main draft data structure - matches getUniqueProgram format\nexport interface CircularProgramDraftData {\n startDate: string;\n days: DraftDay[]; // Flat array of all days, sorted by templateIndex\n}\n\n@Table({ tableName: \"CircularProgramDrafts\", timestamps: true })\nexport class CircularProgramDraft extends Model {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n primaryKey: true,\n allowNull: false,\n })\n declare uuid: string;\n\n @ForeignKey(() => CustomProgramBlueprint)\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare blueprintUuid: string | null;\n\n @ForeignKey(() => Program)\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare publishedProgramId: string | null;\n\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userUuid: string;\n\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare createdByCoachUuid: string;\n\n @Column({\n type: DataType.JSONB,\n allowNull: false,\n })\n declare draftData: CircularProgramDraftData;\n\n @Index\n @Column({\n type: DataType.ENUM(\"draft\", \"published\", \"archived\"),\n allowNull: false,\n defaultValue: \"draft\",\n })\n declare status: DraftStatus;\n\n @Column({\n type: DataType.DATE,\n allowNull: true,\n })\n declare publishedAt: Date | null;\n\n @BelongsTo(() => CustomProgramBlueprint)\n declare blueprint: CustomProgramBlueprint;\n\n @BelongsTo(() => Program)\n declare publishedProgram: Program;\n}\n"],"names":["Table","Column","Model","DataType","Default","ForeignKey","Index","BelongsTo","Program","CustomProgramBlueprint","CircularProgramDraft","UUIDV4","type","UUID","primaryKey","allowNull","JSONB","ENUM","defaultValue","DATE","tableName","timestamps"],"mappings":";;;;;;AAAA,SACEA,KAAK,EACLC,MAAM,EACNC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,SAAS,QACJ,uBAAuB;AAC9B,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,sBAAsB,QAAQ,8BAA8B;AAyFrE,OAAO,MAAMC,6BAA6BR;AA+D1C;;qBA9DoBS;;QAEhBC,MAAMT,SAASU,IAAI;QACnBC,YAAY;QACZC,WAAW;;;;mBAIKN;;QAEhBG,MAAMT,SAASU,IAAI;QACnBE,WAAW;;;;mBAIKP;;;QAGhBI,MAAMT,SAASU,IAAI;QACnBE,WAAW;;;;;;QAMXH,MAAMT,SAASU,IAAI;QACnBE,WAAW;;;;;;QAMXH,MAAMT,SAASU,IAAI;QACnBE,WAAW;;;;;QAKXH,MAAMT,SAASa,KAAK;QACpBD,WAAW;;;;;;QAMXH,MAAMT,SAASc,IAAI,CAAC,SAAS,aAAa;QAC1CF,WAAW;QACXG,cAAc;;;;;QAKdN,MAAMT,SAASgB,IAAI;QACnBJ,WAAW;;;;kBAIIN;;;kBAGAD;;;;QA9DVY,WAAW;QAAyBC,YAAY"}
|
|
@@ -21,6 +21,8 @@ export declare class ExercisesModels extends Model implements ExerciseModel {
|
|
|
21
21
|
graphData: "reps" | "weight";
|
|
22
22
|
imageUrl: string;
|
|
23
23
|
createdBy: string | null;
|
|
24
|
+
isPublic: boolean;
|
|
25
|
+
thumbnailUrl: string | null;
|
|
24
26
|
translatedExercises: TranslatedExerciseModel[];
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=ExerciseModels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExerciseModels.d.ts","sourceRoot":"","sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,EAAS,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAAC,aAAa,EAAE,YAAY,EA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B,QAAQ,EAAE,MAAM,CAAC;IAGjB,QAAQ,EAAE,OAAO,CAAC;IAGlB,GAAG,EAAE,MAAM,CAAC;IAGZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAGhB,WAAW,EAAE,OAAO,CAAC;IAGrB,UAAU,EAAE,OAAO,CAAC;IAGpB,aAAa,EAAE,OAAO,CAAC;IAGvB,cAAc,EAAE,OAAO,CAAC;IAGxB,UAAU,EAAE,MAAM,CAAC;IAGnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,WAAW,EAAE,OAAO,CAAC;IAGrB,cAAc,EAAE,OAAO,CAAC;IAGxB,WAAW,EAAE,YAAY,EAAE,CAAC;IAG5B,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAG7B,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,QAAQ,EAAE,OAAO,CAAC;IAGlB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAC1D"}
|
|
@@ -126,6 +126,19 @@ _ts_decorate([
|
|
|
126
126
|
allowNull: true
|
|
127
127
|
})
|
|
128
128
|
], ExercisesModels.prototype, "createdBy", void 0);
|
|
129
|
+
_ts_decorate([
|
|
130
|
+
Column({
|
|
131
|
+
type: DataType.BOOLEAN,
|
|
132
|
+
allowNull: false,
|
|
133
|
+
defaultValue: false
|
|
134
|
+
})
|
|
135
|
+
], ExercisesModels.prototype, "isPublic", void 0);
|
|
136
|
+
_ts_decorate([
|
|
137
|
+
Column({
|
|
138
|
+
type: DataType.STRING(500),
|
|
139
|
+
allowNull: true
|
|
140
|
+
})
|
|
141
|
+
], ExercisesModels.prototype, "thumbnailUrl", void 0);
|
|
129
142
|
_ts_decorate([
|
|
130
143
|
HasMany(()=>TranslatedExerciseModel)
|
|
131
144
|
], ExercisesModels.prototype, "translatedExercises", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"sourcesContent":["import { Column, DataType, Default, HasMany, Model, Table } from \"sequelize-typescript\";\nimport type {ExerciseModel, ProgramTypes} from '../../models/ExerciseInterfaces.js';\nimport {TranslatedExerciseModel} from './TranslatedExerciseModel.js';\n\n@Table\nexport class ExercisesModels extends Model implements ExerciseModel {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare name: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare restTime: string;\n\n @Column({ type: DataType.STRING(2048), allowNull: false })\n declare pointers: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isCustom: boolean;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare url: string;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare level: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasPriority: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare isCompound: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasVariations: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare needsEquipment: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: false })\n declare variations: object;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare muscles: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare homeWorkout: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isBandAssisted: boolean;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare programType: ProgramTypes[];\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare graphData: \"reps\" | \"weight\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageUrl: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare createdBy: string | null;\n\n @HasMany(() => TranslatedExerciseModel)\n declare translatedExercises: TranslatedExerciseModel[];\n}\n"],"names":["Column","DataType","Default","HasMany","Model","Table","TranslatedExerciseModel","ExercisesModels","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","BOOLEAN","ARRAY","JSONB","TEXT"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAExF,SAAQC,uBAAuB,QAAO,+BAA+B;AAGrE,OAAO,MAAMC,wBAAwBH;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"sourcesContent":["import { Column, DataType, Default, HasMany, Model, Table } from \"sequelize-typescript\";\nimport type {ExerciseModel, ProgramTypes} from '../../models/ExerciseInterfaces.js';\nimport {TranslatedExerciseModel} from './TranslatedExerciseModel.js';\n\n@Table\nexport class ExercisesModels extends Model implements ExerciseModel {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare name: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare restTime: string;\n\n @Column({ type: DataType.STRING(2048), allowNull: false })\n declare pointers: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isCustom: boolean;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare url: string;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare level: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasPriority: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare isCompound: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasVariations: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare needsEquipment: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: false })\n declare variations: object;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare muscles: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare homeWorkout: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isBandAssisted: boolean;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare programType: ProgramTypes[];\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare graphData: \"reps\" | \"weight\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageUrl: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare createdBy: string | null;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isPublic: boolean;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare thumbnailUrl: string | null;\n\n @HasMany(() => TranslatedExerciseModel)\n declare translatedExercises: TranslatedExerciseModel[];\n}\n"],"names":["Column","DataType","Default","HasMany","Model","Table","TranslatedExerciseModel","ExercisesModels","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","BOOLEAN","ARRAY","JSONB","TEXT"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAExF,SAAQC,uBAAuB,QAAO,+BAA+B;AAGrE,OAAO,MAAMC,wBAAwBH;AAwErC;;qBAvEsBI;;QAEdC,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW;QACXC,YAAY;;;;;QAINJ,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM,CAAC;QAAOF,WAAW;;;;;QAGxCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASa,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{UserStrengthTests} from '../dbmodels/program/UserStrengthTests.js';\nimport type {UserChallenge} from '../dbmodels/program/UserChallenge.js';\nimport type {TranslatedStrengthTestExercise} from '../dbmodels/program/TranslatedStrengthTestExercise.js';\nimport type {ExercisesModels} from '../dbmodels/program/ExerciseModels.js';\n\nexport interface ExerciseModel {\n uuid: string;\n name: string;\n level: string[];\n isCompound: boolean;\n needsEquipment: boolean;\n hasPriority: boolean;\n hasVariations: boolean;\n variations: object;\n muscles: string[];\n homeWorkout: boolean;\n createdBy?: string | null;\n}\n\nexport interface ExerciseProgress {\n exerciseUuid: string;\n progress: Progress[];\n}\n\nexport interface UpdateSTRequest {\n body: UserStrengthTests;\n}\n\nexport interface UpdateUserChallengeRequest {\n body: UserChallenge;\n}\n\nexport interface STExerciseProgress {\n exerciseUuid: string;\n progress: Progress;\n}\n\nexport interface ExercisePerformance {\n workoutIndex: number;\n progress: Progress[];\n}\n\nexport interface SwapExerciseRequest {\n exerciseUuid: string;\n}\n\nexport interface ChangeExerciseRequest {\n oldExerciseUuid: string;\n newExercise: ExercisesModels;\n}\n\nexport interface ReducedExercise {\n uuid: string;\n name: string;\n order: number;\n progress?: Progress[];\n sets: string;\n reps: string;\n restTime?: string;\n}\n\nexport interface UpdateTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport interface AddTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport type ProgramTypes =\n | \"BodyweightHomeWorkout\"\n | \"BodyweightOnlyBodyweight\"\n | \"BodyweightWeightedCali\"\n | \"Weights\"\n | \"Both\";\n\nexport interface Progress {\n [key: string]: number | string | undefined;\n}\n\n\n\nexport interface ProgressByExercise {\n name: string;\n totalRepsDone: number;\n weight: number;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["import type {UserStrengthTests} from '../dbmodels/program/UserStrengthTests.js';\nimport type {UserChallenge} from '../dbmodels/program/UserChallenge.js';\nimport type {TranslatedStrengthTestExercise} from '../dbmodels/program/TranslatedStrengthTestExercise.js';\nimport type {ExercisesModels} from '../dbmodels/program/ExerciseModels.js';\n\nexport interface ExerciseModel {\n uuid: string;\n name: string;\n level: string[];\n isCompound: boolean;\n needsEquipment: boolean;\n hasPriority: boolean;\n hasVariations: boolean;\n variations: object;\n muscles: string[];\n homeWorkout: boolean;\n createdBy?: string | null;\n isPublic: boolean;\n}\n\nexport interface ExerciseProgress {\n exerciseUuid: string;\n progress: Progress[];\n}\n\nexport interface UpdateSTRequest {\n body: UserStrengthTests;\n}\n\nexport interface UpdateUserChallengeRequest {\n body: UserChallenge;\n}\n\nexport interface STExerciseProgress {\n exerciseUuid: string;\n progress: Progress;\n}\n\nexport interface ExercisePerformance {\n workoutIndex: number;\n progress: Progress[];\n}\n\nexport interface SwapExerciseRequest {\n exerciseUuid: string;\n}\n\nexport interface ChangeExerciseRequest {\n oldExerciseUuid: string;\n newExercise: ExercisesModels;\n}\n\nexport interface ReducedExercise {\n uuid: string;\n name: string;\n order: number;\n progress?: Progress[];\n sets: string;\n reps: string;\n restTime?: string;\n}\n\nexport interface UpdateTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport interface AddTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport type ProgramTypes =\n | \"BodyweightHomeWorkout\"\n | \"BodyweightOnlyBodyweight\"\n | \"BodyweightWeightedCali\"\n | \"Weights\"\n | \"Both\";\n\nexport interface Progress {\n [key: string]: number | string | undefined;\n}\n\n\n\nexport interface ProgressByExercise {\n name: string;\n totalRepsDone: number;\n weight: number;\n}\n"],"names":[],"mappings":"AAmFA,WAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate-exercise-thumbnails.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/populate-exercise-thumbnails.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ExercisesModels } from "../dbmodels/program/ExerciseModels.js";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { DatabaseClient } from "../classes/Database.js";
|
|
4
|
+
/**
|
|
5
|
+
* Script to populate thumbnailUrl for all exercises that have a Vimeo URL
|
|
6
|
+
* Run with: npx ts-node src/lib/scripts/populate-exercise-thumbnails.ts
|
|
7
|
+
*/ async function populateThumbnails() {
|
|
8
|
+
console.log("Starting thumbnail population...");
|
|
9
|
+
// Initialize database connection
|
|
10
|
+
console.log("Database connected");
|
|
11
|
+
// Fetch all exercises that have a URL but no thumbnail
|
|
12
|
+
const exercises = await ExercisesModels.findAll({
|
|
13
|
+
where: {
|
|
14
|
+
thumbnailUrl: null
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
console.log(`Found ${exercises.length} exercises without thumbnails`);
|
|
18
|
+
let successCount = 0;
|
|
19
|
+
let failCount = 0;
|
|
20
|
+
for (const exercise of exercises){
|
|
21
|
+
if (!exercise.url) {
|
|
22
|
+
console.log(`Skipping ${exercise.name} - no URL`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
console.log(`Fetching thumbnail for: ${exercise.name}`);
|
|
27
|
+
const response = await axios.get(`https://vimeo.com/api/oembed.json?url=${exercise.url}`, {
|
|
28
|
+
timeout: 5000
|
|
29
|
+
});
|
|
30
|
+
const thumbnailUrl = response.data.thumbnail_url;
|
|
31
|
+
if (thumbnailUrl) {
|
|
32
|
+
await exercise.update({
|
|
33
|
+
thumbnailUrl
|
|
34
|
+
});
|
|
35
|
+
console.log(`✓ Updated ${exercise.name}`);
|
|
36
|
+
successCount++;
|
|
37
|
+
} else {
|
|
38
|
+
console.log(`✗ No thumbnail found for ${exercise.name}`);
|
|
39
|
+
failCount++;
|
|
40
|
+
}
|
|
41
|
+
// Rate limiting - wait 100ms between requests
|
|
42
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
43
|
+
} catch (error) {
|
|
44
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
45
|
+
console.error(`✗ Error fetching thumbnail for ${exercise.name}:`, errorMessage);
|
|
46
|
+
failCount++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
console.log("\n=== Summary ===");
|
|
50
|
+
console.log(`Total exercises: ${exercises.length}`);
|
|
51
|
+
console.log(`✓ Success: ${successCount}`);
|
|
52
|
+
console.log(`✗ Failed: ${failCount}`);
|
|
53
|
+
await DatabaseClient.close();
|
|
54
|
+
console.log("Database connection closed");
|
|
55
|
+
}
|
|
56
|
+
populateThumbnails().then(()=>{
|
|
57
|
+
console.log("Script completed successfully");
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}).catch((error)=>{
|
|
60
|
+
console.error("Script failed:", error);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=populate-exercise-thumbnails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/scripts/populate-exercise-thumbnails.ts"],"sourcesContent":["import { ExercisesModels } from \"../dbmodels/program/ExerciseModels.js\";\nimport axios from \"axios\";\nimport {DatabaseClient} from \"../classes/Database.js\";\n\n/**\n * Script to populate thumbnailUrl for all exercises that have a Vimeo URL\n * Run with: npx ts-node src/lib/scripts/populate-exercise-thumbnails.ts\n */\n\nasync function populateThumbnails() {\n console.log(\"Starting thumbnail population...\");\n\n // Initialize database connection\n console.log(\"Database connected\");\n\n // Fetch all exercises that have a URL but no thumbnail\n const exercises = await ExercisesModels.findAll({\n where: {\n thumbnailUrl: null,\n },\n });\n\n console.log(`Found ${exercises.length} exercises without thumbnails`);\n\n let successCount = 0;\n let failCount = 0;\n\n for (const exercise of exercises) {\n if (!exercise.url) {\n console.log(`Skipping ${exercise.name} - no URL`);\n continue;\n }\n\n try {\n console.log(`Fetching thumbnail for: ${exercise.name}`);\n const response = await axios.get(\n `https://vimeo.com/api/oembed.json?url=${exercise.url}`,\n { timeout: 5000 }\n );\n\n const thumbnailUrl = response.data.thumbnail_url;\n\n if (thumbnailUrl) {\n await exercise.update({ thumbnailUrl });\n console.log(`✓ Updated ${exercise.name}`);\n successCount++;\n } else {\n console.log(`✗ No thumbnail found for ${exercise.name}`);\n failCount++;\n }\n\n // Rate limiting - wait 100ms between requests\n await new Promise((resolve) => setTimeout(resolve, 100));\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(`✗ Error fetching thumbnail for ${exercise.name}:`, errorMessage);\n failCount++;\n }\n }\n\n console.log(\"\\n=== Summary ===\");\n console.log(`Total exercises: ${exercises.length}`);\n console.log(`✓ Success: ${successCount}`);\n console.log(`✗ Failed: ${failCount}`);\n\n await DatabaseClient.close();\n console.log(\"Database connection closed\");\n}\n\npopulateThumbnails()\n .then(() => {\n console.log(\"Script completed successfully\");\n process.exit(0);\n })\n .catch((error) => {\n console.error(\"Script failed:\", error);\n process.exit(1);\n });\n"],"names":["ExercisesModels","axios","DatabaseClient","populateThumbnails","console","log","exercises","findAll","where","thumbnailUrl","length","successCount","failCount","exercise","url","name","response","get","timeout","data","thumbnail_url","update","Promise","resolve","setTimeout","error","errorMessage","Error","message","String","close","then","process","exit","catch"],"mappings":"AAAA,SAASA,eAAe,QAAQ,wCAAwC;AACxE,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,cAAc,QAAO,yBAAyB;AAEtD;;;CAGC,GAED,eAAeC;IACbC,QAAQC,GAAG,CAAC;IAEZ,iCAAiC;IACjCD,QAAQC,GAAG,CAAC;IAEZ,uDAAuD;IACvD,MAAMC,YAAY,MAAMN,gBAAgBO,OAAO,CAAC;QAC9CC,OAAO;YACLC,cAAc;QAChB;IACF;IAEAL,QAAQC,GAAG,CAAC,CAAC,MAAM,EAAEC,UAAUI,MAAM,CAAC,6BAA6B,CAAC;IAEpE,IAAIC,eAAe;IACnB,IAAIC,YAAY;IAEhB,KAAK,MA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