Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove duplicated model files
Roland Geidere2d7191e3eb8
diff --git a/angular/src/app/exercise/exercise-detail/exercise-detail.component.html b/angular/src/app/exercise/exercise-detail/exercise-detail.component.htmlindex 1a74a2e37..bd8f66b99 100644--- a/angular/src/app/exercise/exercise-detail/exercise-detail.component.html+++ b/angular/src/app/exercise/exercise-detail/exercise-detail.component.html@@ -37,12 +37,12 @@alt=""></div><div class="col-7">- <p>Primary muscles</p>+ <p i18n>Primary muscles</p><ul><li *ngFor="let muscle of exercise.muscles">{{ muscle.name }}</li></ul>- <p>Secondary muscles</p>+ <p i18n>Secondary muscles</p><ul><li *ngFor="let muscle of exercise.musclesSecondary">{{ muscle.name }}</li></ul>diff --git a/angular/src/app/exercise/exercise-detail/exercise-detail.component.ts b/angular/src/app/exercise/exercise-detail/exercise-detail.component.tsindex b3554b7e0..c1d184aa3 100644--- a/angular/src/app/exercise/exercise-detail/exercise-detail.component.ts+++ b/angular/src/app/exercise/exercise-detail/exercise-detail.component.ts@@ -1,7 +1,7 @@import {Component, OnInit} from '@angular/core';import {ActivatedRoute, Params} from '@angular/router';import {ExerciseService} from '../exercise.service';-import {Exercise} from '../models/exercises/exercise.model';+import {Exercise} from '../models/exercise.model';@Component({selector: 'app-exercise-detail',diff --git a/angular/src/app/exercise/exercise-edit/exercise-edit.component.ts b/angular/src/app/exercise/exercise-edit/exercise-edit.component.tsindex c8cf4f104..5f3e55d1f 100644--- a/angular/src/app/exercise/exercise-edit/exercise-edit.component.ts+++ b/angular/src/app/exercise/exercise-edit/exercise-edit.component.ts@@ -19,10 +19,10 @@import {Component, Input, OnInit} from '@angular/core';import {FormArray, FormBuilder, FormControl, FormGroup} from '@angular/forms';import {ExerciseService} from '../exercise.service';-import {Category} from '../models/exercises/category.model';-import {Equipment} from '../models/exercises/equipment.model';-import {Exercise} from '../models/exercises/exercise.model';-import {Muscle} from '../models/exercises/muscle.model';+import {Category} from '../models/category.model';+import {Equipment} from '../models/equipment.model';+import {Exercise} from '../models/exercise.model';+import {Muscle} from '../models/muscle.model';@Component({selector: 'app-exercise-edit',diff --git a/angular/src/app/exercise/exercise-list/exercise-list.component.ts b/angular/src/app/exercise/exercise-list/exercise-list.component.tsindex 307b2b514..7465521d7 100644--- a/angular/src/app/exercise/exercise-list/exercise-list.component.ts+++ b/angular/src/app/exercise/exercise-list/exercise-list.component.ts@@ -1,8 +1,8 @@import { Component, OnInit } from '@angular/core';import {ExerciseService} from '../exercise.service';-import {Category} from '../models/exercises/category.model';-import {Equipment} from '../models/exercises/equipment.model';-import {Exercise} from '../models/exercises/exercise.model';+import {Category} from '../models/category.model';+import {Equipment} from '../models/equipment.model';+import {Exercise} from '../models/exercise.model';@Component({selector: 'app-exercise-list',diff --git a/angular/src/app/exercise/exercise-preview/exercise-preview.component.ts b/angular/src/app/exercise/exercise-preview/exercise-preview.component.tsindex e206a3bb0..7476f9e55 100644--- a/angular/src/app/exercise/exercise-preview/exercise-preview.component.ts+++ b/angular/src/app/exercise/exercise-preview/exercise-preview.component.ts@@ -1,5 +1,5 @@import {Component, Input, OnInit} from '@angular/core';-import {Exercise} from '../models/exercises/exercise.model';+import {Exercise} from '../models/exercise.model';@Component({selector: 'app-exercise-preview',diff --git a/angular/src/app/exercise/exercise.service.ts b/angular/src/app/exercise/exercise.service.tsindex 8ec6d7f40..211ed92ae 100644--- a/angular/src/app/exercise/exercise.service.ts+++ b/angular/src/app/exercise/exercise.service.ts@@ -2,13 +2,12 @@ import {HttpClient} from '@angular/common/http';import {Injectable} from '@angular/core';import {environment} from '../../environments/environment';import {WgerApiResponse} from '../core/wger-response.model';-import {Category, CategoryAdapter} from './models/exercises/category.model';-import {CommentAdapter} from './models/exercises/comment.model';-import {Equipment, EquipmentAdapter} from './models/exercises/equipment.model';-import {Exercise, ExerciseAdapter} from './models/exercises/exercise.model';-import {ExerciseImageAdapter} from './models/exercises/image.model';-import {Muscle, MuscleAdapter} from './models/exercises/muscle.model';-+import {Category, CategoryAdapter} from './models/category.model';+import {CommentAdapter} from './models/comment.model';+import {Equipment, EquipmentAdapter} from './models/equipment.model';+import {Exercise, ExerciseAdapter} from './models/exercise.model';+import {ExerciseImageAdapter} from './models/image.model';+import {Muscle, MuscleAdapter} from './models/muscle.model';@Injectable({providedIn: 'root',diff --git a/angular/src/app/exercise/models/exercises/comment.model.ts b/angular/src/app/exercise/models/comment.model.tssimilarity index 96%rename from angular/src/app/exercise/models/exercises/comment.model.tsrename to angular/src/app/exercise/models/comment.model.tsindex 5b9b707f2..7d804a313 100644--- a/angular/src/app/exercise/models/exercises/comment.model.ts+++ b/angular/src/app/exercise/models/comment.model.ts@@ -17,7 +17,7 @@*/import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';+import {Adapter} from '../../core/adapter';export class Comment {diff --git a/angular/src/app/exercise/models/exercise.model.ts b/angular/src/app/exercise/models/exercise.model.tsindex d57ed8452..bdddb9662 100644--- a/angular/src/app/exercise/models/exercise.model.ts+++ b/angular/src/app/exercise/models/exercise.model.ts@@ -19,6 +19,7 @@import {Injectable} from '@angular/core';import {Adapter} from '../../core/adapter';import {Category} from './category.model';+import {Comment} from './comment.model';import {Equipment} from './equipment.model';import {ExerciseImage} from './image.model';import {Muscle} from './muscle.model';@@ -33,6 +34,7 @@ export class Exercise {equipment: Equipment[] = [];equipmentIds: number[] = [];images: ExerciseImage[] = [];+ comments: Comment[] = [];license: number;licenseAuthor: string;variations: number[];diff --git a/angular/src/app/exercise/models/exercises/category.model.ts b/angular/src/app/exercise/models/exercises/category.model.tsdeleted file mode 100644index ce5462c1b..000000000--- a/angular/src/app/exercise/models/exercises/category.model.ts+++ /dev/null@@ -1,47 +0,0 @@-/*- * This file is part of wger Workout Manager <https://github.com/wger-project>.- * Copyright (C) 2020, 2021 wger Team- *- * wger Workout Manager is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as published by- * the Free Software Foundation, either version 3 of the License, or- * (at your option) any later version.- *- * wger Workout Manager is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */--import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';--export class Category{-- constructor(- public id: number,- public name: string- ) { }-}--@Injectable({- providedIn: 'root',-})-export class CategoryAdapter implements Adapter<Category> {- fromJson(item: any): Category {- return new Category(- item.id,- item.name- );- }-- toJson(item: Category): any {- return {- id: item.id,- name: item.name,- };- }-}diff --git a/angular/src/app/exercise/models/exercises/equipment.model.ts b/angular/src/app/exercise/models/exercises/equipment.model.tsdeleted file mode 100644index f73a97eeb..000000000--- a/angular/src/app/exercise/models/exercises/equipment.model.ts+++ /dev/null@@ -1,46 +0,0 @@-/*- * This file is part of wger Workout Manager <https://github.com/wger-project>.- * Copyright (C) 2020, 2021 wger Team- *- * wger Workout Manager is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as published by- * the Free Software Foundation, either version 3 of the License, or- * (at your option) any later version.- *- * wger Workout Manager is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */--import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';--export class Equipment{-- constructor(- public id: number,- public name: string) { }-}--@Injectable({- providedIn: 'root',-})-export class EquipmentAdapter implements Adapter<Equipment> {- fromJson(item: any): Equipment {- return new Equipment(- item.id,- item.name,- );- }-- toJson(item: Equipment): any {- return {- id: item.id,- name: item.name,- };- }-}diff --git a/angular/src/app/exercise/models/exercises/exercise.model.ts b/angular/src/app/exercise/models/exercises/exercise.model.tsdeleted file mode 100644index f0389109d..000000000--- a/angular/src/app/exercise/models/exercises/exercise.model.ts+++ /dev/null@@ -1,103 +0,0 @@-/*- * This file is part of wger Workout Manager <https://github.com/wger-project>.- * Copyright (C) 2020, 2021 wger Team- *- * wger Workout Manager is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as published by- * the Free Software Foundation, either version 3 of the License, or- * (at your option) any later version.- *- * wger Workout Manager is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */--import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';-import {Category} from './category.model';-import {Comment} from './comment.model';-import {Equipment} from './equipment.model';-import {ExerciseImage} from './image.model';-import {Muscle} from './muscle.model';--export class Exercise {- category!: Category;- categoryId: number;- muscles: Muscle[] = [];- musclesIds: number[] = [];- musclesSecondary: Muscle[] = [];- musclesSecondaryIds: number[] = [];- equipment: Equipment[] = [];- equipmentIds: number[] = [];- images: ExerciseImage[] = [];- comments: Comment[] = [];- license: number;- licenseAuthor: string;- variations: number[];-- constructor(public id: number,- public uuid: string,- public name: string,- public date: Date,- public description: string,- category: number,- muscles: number[],- musclesSecondary: number[],- equipment: number[],- license: number,- licenseAuthor: string,- variations: number[]) {- this.categoryId = category;- this.musclesIds = muscles;- this.musclesSecondaryIds = musclesSecondary;- this.equipmentIds = equipment;- this.license = license;- this.licenseAuthor = licenseAuthor;- this.variations = variations;- }-}---@Injectable({- providedIn: 'root',-})-export class ExerciseAdapter implements Adapter<Exercise> {- fromJson(item: any): Exercise {- return new Exercise(- item.id,- item.uuid,- item.name,- new Date(item.creation_date),- item.description,- item.category,- item.muscles,- item.muscles_secondary,- item.equipment,- item.license,- item.license_author,- item.variations- );- }-- /**- * Don't return all properties, since not all items can be updated (they would- * be ignored by the server, but it's better to not send too much anyway)- */- toJson(item: Exercise): any {-- return {- id: item.id,- name: item.name,- description: item.description,- category: item.categoryId,- muscles: item.musclesIds,- muscles_secondary: item.musclesSecondaryIds,- equipment: item.equipmentIds- };- }-}-diff --git a/angular/src/app/exercise/models/exercises/image.model.ts b/angular/src/app/exercise/models/exercises/image.model.tsdeleted file mode 100644index 3274c0319..000000000--- a/angular/src/app/exercise/models/exercises/image.model.ts+++ /dev/null@@ -1,53 +0,0 @@-/*- * This file is part of wger Workout Manager <https://github.com/wger-project>.- * Copyright (C) 2020, 2021 wger Team- *- * wger Workout Manager is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as published by- * the Free Software Foundation, either version 3 of the License, or- * (at your option) any later version.- *- * wger Workout Manager is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */--import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';--export class ExerciseImage{-- constructor(- public id: number,- public uuid: string,- public url: string,- public isMain: boolean) {- }-}--@Injectable({- providedIn: 'root',-})-export class ExerciseImageAdapter implements Adapter<ExerciseImage> {- fromJson(item: any): ExerciseImage {- return new ExerciseImage(- item.id,- item.uuid,- item.image,- item.is_main- );- }-- // TODO: when uploading an image we have to send the file- toJson(item: ExerciseImage): any {- return {- id: item.id,- image: item.url,- is_front: item.isMain- };- }-}diff --git a/angular/src/app/exercise/models/exercises/muscle.model.ts b/angular/src/app/exercise/models/exercises/muscle.model.tsdeleted file mode 100644index fc8e2c858..000000000--- a/angular/src/app/exercise/models/exercises/muscle.model.ts+++ /dev/null@@ -1,50 +0,0 @@-/*- * This file is part of wger Workout Manager <https://github.com/wger-project>.- * Copyright (C) 2020, 2021 wger Team- *- * wger Workout Manager is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as published by- * the Free Software Foundation, either version 3 of the License, or- * (at your option) any later version.- *- * wger Workout Manager is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */--import {Injectable} from '@angular/core';-import {Adapter} from '../../../core/adapter';--export class Muscle {- constructor(- public id: number,- public name: string,- public isFront: boolean- ) { }--}--@Injectable({- providedIn: 'root',-})-export class MuscleAdapter implements Adapter<Muscle> {- fromJson(item: any): Muscle {- return new Muscle(- item.id,- item.name,- item.is_front- );- }-- toJson(item: Muscle): any {- return {- id: item.id,- name: item.name,- is_front: item.isFront- };- }-}