90dc-core 1.6.1 → 1.6.3
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/ExerciseModels.d.ts +22 -0
- package/dist/lib/dbmodels/program/ExerciseModels.js +117 -0
- package/dist/lib/dbmodels/program/ExerciseModels.js.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.d.ts +24 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.js +123 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.js.map +1 -0
- package/dist/lib/models/ExerciseInterfaces.d.ts +54 -10
- package/dist/lib/models/ExerciseInterfaces.js.map +1 -1
- package/dist/lib/utils/NotificationsUtil.d.ts +2 -2
- package/dist/lib/utils/NotificationsUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/dbmodels/program/ExerciseModels.ts +63 -0
- package/src/lib/dbmodels/program/TranslatedExerciseModel.ts +66 -0
- package/src/lib/models/ExerciseInterfaces.ts +72 -15
- package/src/lib/utils/NotificationsUtil.ts +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Model } from "sequelize-typescript";
|
|
2
|
+
import type { ExerciseModel, ProgramTypes } from "../../models/ExerciseInterfaces";
|
|
3
|
+
import { TranslatedExerciseModel } from "./TranslatedExerciseModel";
|
|
4
|
+
export declare class ExercisesModels extends Model implements ExerciseModel {
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
restTime: string;
|
|
8
|
+
pointers: string;
|
|
9
|
+
isCustom: boolean;
|
|
10
|
+
url: string;
|
|
11
|
+
level: string[];
|
|
12
|
+
hasPriority: boolean;
|
|
13
|
+
isCompound: boolean;
|
|
14
|
+
hasVariations: boolean;
|
|
15
|
+
needsEquipment: boolean;
|
|
16
|
+
variations: object;
|
|
17
|
+
muscles: string[];
|
|
18
|
+
homeWorkout: boolean;
|
|
19
|
+
programType: ProgramTypes[];
|
|
20
|
+
graphData: "reps" | "weight";
|
|
21
|
+
translatedExercises: TranslatedExerciseModel[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Column, DataType, Default, HasMany, Model, Table } from "sequelize-typescript";
|
|
8
|
+
import { TranslatedExerciseModel } from "./TranslatedExerciseModel";
|
|
9
|
+
export let ExercisesModels = class ExercisesModels extends Model {
|
|
10
|
+
};
|
|
11
|
+
__decorate([
|
|
12
|
+
Default(DataType.UUIDV4),
|
|
13
|
+
Column({
|
|
14
|
+
type: DataType.UUID,
|
|
15
|
+
defaultValue: DataType.UUID,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
primaryKey: true
|
|
18
|
+
})
|
|
19
|
+
], ExercisesModels.prototype, "uuid", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
Column({
|
|
22
|
+
type: DataType.STRING,
|
|
23
|
+
allowNull: false
|
|
24
|
+
})
|
|
25
|
+
], ExercisesModels.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({
|
|
28
|
+
type: DataType.STRING,
|
|
29
|
+
allowNull: true
|
|
30
|
+
})
|
|
31
|
+
], ExercisesModels.prototype, "restTime", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
Column({
|
|
34
|
+
type: DataType.STRING(2048),
|
|
35
|
+
allowNull: false
|
|
36
|
+
})
|
|
37
|
+
], ExercisesModels.prototype, "pointers", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({
|
|
40
|
+
type: DataType.BOOLEAN,
|
|
41
|
+
allowNull: true
|
|
42
|
+
})
|
|
43
|
+
], ExercisesModels.prototype, "isCustom", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Column({
|
|
46
|
+
type: DataType.STRING,
|
|
47
|
+
allowNull: false
|
|
48
|
+
})
|
|
49
|
+
], ExercisesModels.prototype, "url", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({
|
|
52
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
53
|
+
allowNull: false
|
|
54
|
+
})
|
|
55
|
+
], ExercisesModels.prototype, "level", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
Column({
|
|
58
|
+
type: DataType.BOOLEAN,
|
|
59
|
+
allowNull: false
|
|
60
|
+
})
|
|
61
|
+
], ExercisesModels.prototype, "hasPriority", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
Column({
|
|
64
|
+
type: DataType.BOOLEAN,
|
|
65
|
+
allowNull: false
|
|
66
|
+
})
|
|
67
|
+
], ExercisesModels.prototype, "isCompound", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Column({
|
|
70
|
+
type: DataType.BOOLEAN,
|
|
71
|
+
allowNull: false
|
|
72
|
+
})
|
|
73
|
+
], ExercisesModels.prototype, "hasVariations", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Column({
|
|
76
|
+
type: DataType.BOOLEAN,
|
|
77
|
+
allowNull: false
|
|
78
|
+
})
|
|
79
|
+
], ExercisesModels.prototype, "needsEquipment", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Column({
|
|
82
|
+
type: DataType.JSONB,
|
|
83
|
+
allowNull: false
|
|
84
|
+
})
|
|
85
|
+
], ExercisesModels.prototype, "variations", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Column({
|
|
88
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
89
|
+
allowNull: false
|
|
90
|
+
})
|
|
91
|
+
], ExercisesModels.prototype, "muscles", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
Column({
|
|
94
|
+
type: DataType.BOOLEAN,
|
|
95
|
+
allowNull: false
|
|
96
|
+
})
|
|
97
|
+
], ExercisesModels.prototype, "homeWorkout", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
Column({
|
|
100
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
101
|
+
allowNull: false
|
|
102
|
+
})
|
|
103
|
+
], ExercisesModels.prototype, "programType", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
Column({
|
|
106
|
+
type: DataType.STRING,
|
|
107
|
+
allowNull: false
|
|
108
|
+
})
|
|
109
|
+
], ExercisesModels.prototype, "graphData", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
HasMany(()=>TranslatedExerciseModel)
|
|
112
|
+
], ExercisesModels.prototype, "translatedExercises", void 0);
|
|
113
|
+
ExercisesModels = __decorate([
|
|
114
|
+
Table
|
|
115
|
+
], ExercisesModels);
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=ExerciseModels.js.map
|
|
@@ -0,0 +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\";\nimport {TranslatedExerciseModel} from \"./TranslatedExerciseModel\";\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.ARRAY(DataType.STRING), allowNull: false })\n declare programType: ProgramTypes[];\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare graphData: \"reps\" | \"weight\";\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"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAExF,SAAQC,uBAAuB,QAAO,4BAA4B;AAGlE,WAAaC,kBAAN,8BAA8BH;AAyDrC,EAAC;;IAxDIF,QAAQD,SAASO,MAAM;IACvBR,OAAO;QACJS,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IACpB;GAPSN;;IAURP,OAAO;QAAES,MAAMR,SAASa,MAAM;QAAEF,WAAW,KAAK;IAAC;GAVzCL;;IAaRP,OAAO;QAAES,MAA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} from './ExerciseModels';
|
|
3
|
+
import type { ProgramTypes } from "../../models/ExerciseInterfaces";
|
|
4
|
+
export declare class TranslatedExerciseModel extends Model {
|
|
5
|
+
uuid: string;
|
|
6
|
+
exerciseUuid: string;
|
|
7
|
+
name: string;
|
|
8
|
+
language: string;
|
|
9
|
+
restTime: string;
|
|
10
|
+
pointers: string;
|
|
11
|
+
isCustom: boolean;
|
|
12
|
+
url: string;
|
|
13
|
+
level: string[];
|
|
14
|
+
hasPriority: boolean;
|
|
15
|
+
isCompound: boolean;
|
|
16
|
+
hasVariations: boolean;
|
|
17
|
+
needsEquipment: boolean;
|
|
18
|
+
variations: object;
|
|
19
|
+
muscles: string[];
|
|
20
|
+
homeWorkout: boolean;
|
|
21
|
+
programType: ProgramTypes[];
|
|
22
|
+
graphData: 'reps' | 'weight';
|
|
23
|
+
exercise: ExercisesModels;
|
|
24
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __decorate = this && this.__decorate || function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BelongsTo, Column, DataType, Default, ForeignKey, Model, PrimaryKey, Table } from "sequelize-typescript";
|
|
8
|
+
import { ExercisesModels } from "./ExerciseModels";
|
|
9
|
+
export let TranslatedExerciseModel = class TranslatedExerciseModel extends Model {
|
|
10
|
+
};
|
|
11
|
+
__decorate([
|
|
12
|
+
PrimaryKey,
|
|
13
|
+
Default(DataType.UUIDV4),
|
|
14
|
+
Column(DataType.UUID)
|
|
15
|
+
], TranslatedExerciseModel.prototype, "uuid", void 0);
|
|
16
|
+
__decorate([
|
|
17
|
+
ForeignKey(()=>ExercisesModels),
|
|
18
|
+
Column(DataType.UUID)
|
|
19
|
+
], TranslatedExerciseModel.prototype, "exerciseUuid", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
Column({
|
|
22
|
+
type: DataType.STRING,
|
|
23
|
+
allowNull: false
|
|
24
|
+
})
|
|
25
|
+
], TranslatedExerciseModel.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Column({
|
|
28
|
+
type: DataType.TEXT,
|
|
29
|
+
allowNull: false
|
|
30
|
+
})
|
|
31
|
+
], TranslatedExerciseModel.prototype, "language", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
Column({
|
|
34
|
+
type: DataType.STRING,
|
|
35
|
+
allowNull: true
|
|
36
|
+
})
|
|
37
|
+
], TranslatedExerciseModel.prototype, "restTime", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Column({
|
|
40
|
+
type: DataType.STRING(2048),
|
|
41
|
+
allowNull: false
|
|
42
|
+
})
|
|
43
|
+
], TranslatedExerciseModel.prototype, "pointers", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Column({
|
|
46
|
+
type: DataType.BOOLEAN,
|
|
47
|
+
allowNull: true
|
|
48
|
+
})
|
|
49
|
+
], TranslatedExerciseModel.prototype, "isCustom", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Column({
|
|
52
|
+
type: DataType.STRING,
|
|
53
|
+
allowNull: false
|
|
54
|
+
})
|
|
55
|
+
], TranslatedExerciseModel.prototype, "url", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
Column({
|
|
58
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
59
|
+
allowNull: false
|
|
60
|
+
})
|
|
61
|
+
], TranslatedExerciseModel.prototype, "level", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
Column({
|
|
64
|
+
type: DataType.BOOLEAN,
|
|
65
|
+
allowNull: false
|
|
66
|
+
})
|
|
67
|
+
], TranslatedExerciseModel.prototype, "hasPriority", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Column({
|
|
70
|
+
type: DataType.BOOLEAN,
|
|
71
|
+
allowNull: false
|
|
72
|
+
})
|
|
73
|
+
], TranslatedExerciseModel.prototype, "isCompound", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Column({
|
|
76
|
+
type: DataType.BOOLEAN,
|
|
77
|
+
allowNull: false
|
|
78
|
+
})
|
|
79
|
+
], TranslatedExerciseModel.prototype, "hasVariations", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Column({
|
|
82
|
+
type: DataType.BOOLEAN,
|
|
83
|
+
allowNull: false
|
|
84
|
+
})
|
|
85
|
+
], TranslatedExerciseModel.prototype, "needsEquipment", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Column({
|
|
88
|
+
type: DataType.JSONB,
|
|
89
|
+
allowNull: false
|
|
90
|
+
})
|
|
91
|
+
], TranslatedExerciseModel.prototype, "variations", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
Column({
|
|
94
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
95
|
+
allowNull: false
|
|
96
|
+
})
|
|
97
|
+
], TranslatedExerciseModel.prototype, "muscles", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
Column({
|
|
100
|
+
type: DataType.BOOLEAN,
|
|
101
|
+
allowNull: false
|
|
102
|
+
})
|
|
103
|
+
], TranslatedExerciseModel.prototype, "homeWorkout", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
Column({
|
|
106
|
+
type: DataType.ARRAY(DataType.STRING),
|
|
107
|
+
allowNull: false
|
|
108
|
+
})
|
|
109
|
+
], TranslatedExerciseModel.prototype, "programType", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
Column({
|
|
112
|
+
type: DataType.STRING,
|
|
113
|
+
allowNull: false
|
|
114
|
+
})
|
|
115
|
+
], TranslatedExerciseModel.prototype, "graphData", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
BelongsTo(()=>ExercisesModels)
|
|
118
|
+
], TranslatedExerciseModel.prototype, "exercise", void 0);
|
|
119
|
+
TranslatedExerciseModel = __decorate([
|
|
120
|
+
Table
|
|
121
|
+
], TranslatedExerciseModel);
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=TranslatedExerciseModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/program/TranslatedExerciseModel.ts"],"sourcesContent":["import { BelongsTo, Column, DataType, Default, ForeignKey, Model, PrimaryKey, Table } from 'sequelize-typescript';\nimport { ExercisesModels } from './ExerciseModels';\nimport type {ProgramTypes} from \"../../models/ExerciseInterfaces\";\n\n@Table\nexport class TranslatedExerciseModel extends Model {\n\t@PrimaryKey\n\t@Default(DataType.UUIDV4)\n\t@Column(DataType.UUID)\n\tdeclare uuid: string;\n\n\t@ForeignKey(() => ExercisesModels)\n\t@Column(DataType.UUID)\n\tdeclare exerciseUuid: string;\n\n\t@Column({ type: DataType.STRING, allowNull: false })\n\tdeclare name: string;\n\n\t@Column({ type: DataType.TEXT, allowNull: false })\n\tdeclare language: string;\n\n\t@Column({ type: DataType.STRING, allowNull: true })\n\tdeclare restTime: string;\n\n\t@Column({ type: DataType.STRING(2048), allowNull: false })\n\tdeclare pointers: string;\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: true })\n\tdeclare isCustom: boolean;\n\n\t@Column({ type: DataType.STRING, allowNull: false })\n\tdeclare url: string;\n\n\t@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n\tdeclare level: string[];\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare hasPriority: boolean;\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare isCompound: boolean;\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare hasVariations: boolean;\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare needsEquipment: boolean;\n\n\t@Column({ type: DataType.JSONB, allowNull: false })\n\tdeclare variations: object;\n\n\t@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n\tdeclare muscles: string[];\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare homeWorkout: boolean;\n\n\t@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n\tdeclare programType: ProgramTypes[];\n\n\t@Column({ type: DataType.STRING, allowNull: false })\n\tdeclare graphData: 'reps' | 'weight';\n\n\t@BelongsTo(() => ExercisesModels)\n\tdeclare exercise: ExercisesModels;\n}\n"],"names":["BelongsTo","Column","DataType","Default","ForeignKey","Model","PrimaryKey","Table","ExercisesModels","TranslatedExerciseModel","UUIDV4","UUID","type","STRING","allowNull","TEXT","BOOLEAN","ARRAY","JSONB"],"mappings":";;;;;;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,EAAEC,KAAK,QAAQ,uBAAuB;AAClH,SAASC,eAAe,QAAQ,mBAAmB;AAInD,WAAaC,0BAAN,sCAAsCJ;AA4D7C,EAAC;;IA3DCC;IACAH,QAAQD,SAASQ,MAAM;IACvBT,OAAOC,SAASS,IAAI;GAHTF;;IAMXL,WAAW,IAAMI;IACjBP,OAAOC,SAASS,IAAI;GAPTF;;IAUXR,OAAO;QAAEW,MAAMV,SAASW,MAAM;QAAEC,WAAW,KAAK;IAAC;GAVtCL;;IAaXR,OAAO;QAAEW,MAAMV,SAASa,IAAI;QAAED,WAAW,KAAK;IAAC;GAbpCL;;IAgBXR,OAAO;QAAEW,MAAMV,SAASW,MAAM;QAAEC,WAAW,IAAI;IAAC;GAhBrCL;;IAmBXR,OAAO;QAAEW,MAAMV,SAASW,MAAM,CAAC;QAAOC,WAAW,KAAK;IAAC;GAnB5CL;;IAsBXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,IAAI;IAAC;GAtBtCL;;IAyBXR,OAAO;QAAEW,MAAMV,SAASW,MAAM;QAAEC,WAAW,KAAK;IAAC;GAzBtCL;;IA4BXR,OAAO;QAAEW,MAAMV,SAASe,KAAK,CAACf,SAASW,MAAM;QAAGC,WAAW,KAAK;IAAC;GA5BtDL;;IA+BXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GA/BvCL;;IAkCXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GAlCvCL;;IAqCXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GArCvCL;;IAwCXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GAxCvCL;;IA2CXR,OAAO;QAAEW,MAAMV,SAASgB,KAAK;QAAEJ,WAAW,KAAK;IAAC;GA3CrCL;;IA8CXR,OAAO;QAAEW,MAAMV,SAASe,KAAK,CAACf,SAASW,MAAM;QAAGC,WAAW,KAAK;IAAC;GA9CtDL;;IAiDXR,OAAO;QAAEW,MAAMV,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GAjDvCL;;IAoDXR,OAAO;QAAEW,MAAMV,SAASe,KAAK,CAACf,SAASW,MAAM;QAAGC,WAAW,KAAK;IAAC;GApDtDL;;IAuDXR,OAAO;QAAEW,MAAMV,SAASW,MAAM;QAAEC,WAAW,KAAK;IAAC;GAvDtCL;;IA0DXT,UAAU,IAAMQ;GA1DLC;AAAAA;IADZF;GACYE"}
|
|
@@ -1,21 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { UserStrengthTests } from "../dbmodels/program/UserStrengthTests";
|
|
2
|
+
import type { UserChallenge } from "../dbmodels/program/UserChallenge";
|
|
3
|
+
import type { TranslatedStrengthTestExercise } from "../dbmodels/program/TranslatedStrengthTestExercise";
|
|
4
|
+
import type { ExercisesModels } from "../dbmodels/program/ExerciseModels";
|
|
5
|
+
export interface ExerciseModel {
|
|
6
|
+
uuid: string;
|
|
7
|
+
name: string;
|
|
8
|
+
level: string[];
|
|
9
|
+
isCompound: boolean;
|
|
10
|
+
needsEquipment: boolean;
|
|
11
|
+
hasPriority: boolean;
|
|
12
|
+
hasVariations: boolean;
|
|
13
|
+
variations: object;
|
|
14
|
+
muscles: string[];
|
|
15
|
+
homeWorkout: boolean;
|
|
4
16
|
}
|
|
5
|
-
export interface
|
|
6
|
-
|
|
17
|
+
export interface ExerciseProgress {
|
|
18
|
+
exerciseUuid: string;
|
|
19
|
+
progress: Progress[];
|
|
7
20
|
}
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
export interface UpdateSTRequest {
|
|
22
|
+
body: UserStrengthTests;
|
|
23
|
+
}
|
|
24
|
+
export interface UpdateUserChallengeRequest {
|
|
25
|
+
body: UserChallenge;
|
|
26
|
+
}
|
|
27
|
+
export interface STExerciseProgress {
|
|
28
|
+
exerciseUuid: string;
|
|
29
|
+
progress: Progress;
|
|
30
|
+
}
|
|
31
|
+
export interface ExercisePerformance {
|
|
32
|
+
workoutIndex: number;
|
|
33
|
+
progress: Progress[];
|
|
34
|
+
}
|
|
35
|
+
export interface SwapExerciseRequest {
|
|
36
|
+
exerciseUuid: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ChangeExerciseRequest {
|
|
39
|
+
oldExerciseUuid: string;
|
|
40
|
+
newExercise: ExercisesModels;
|
|
12
41
|
}
|
|
13
42
|
export interface ReducedExercise {
|
|
14
43
|
uuid: string;
|
|
15
44
|
name: string;
|
|
16
45
|
order: number;
|
|
17
|
-
progress
|
|
46
|
+
progress?: Progress[];
|
|
18
47
|
sets: string;
|
|
19
48
|
reps: string;
|
|
20
49
|
restTime?: string;
|
|
21
50
|
}
|
|
51
|
+
export interface UpdateTranslatedStrengthTestExercisesRequest {
|
|
52
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
53
|
+
}
|
|
54
|
+
export interface AddTranslatedStrengthTestExercisesRequest {
|
|
55
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
56
|
+
}
|
|
57
|
+
export type ProgramTypes = "BodyweightHomeWorkout" | "BodyweightOnlyBodyweight" | "BodyweightWeightedCali" | "Weights" | "Both";
|
|
58
|
+
export interface Progress {
|
|
59
|
+
[key: string]: number | string | undefined;
|
|
60
|
+
}
|
|
61
|
+
export interface ProgressByExercise {
|
|
62
|
+
name: string;
|
|
63
|
+
totalRepsDone: number;
|
|
64
|
+
weight: number;
|
|
65
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["import type {UserStrengthTests} from \"../dbmodels/program/UserStrengthTests\";\nimport type {UserChallenge} from \"../dbmodels/program/UserChallenge\";\nimport type {TranslatedStrengthTestExercise} from \"../dbmodels/program/TranslatedStrengthTestExercise\";\nimport type {ExercisesModels} from \"../dbmodels/program/ExerciseModels\";\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}\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\nexport interface ProgressByExercise {\n name: string;\n totalRepsDone: number;\n weight: number;\n}\n"],"names":[],"mappings":"AAAA,WAmFC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import apn from "apn";
|
|
2
|
-
import type { AndroidMessage } from "../models/NotificationInterfaces";
|
|
2
|
+
import type { AndroidMessage, NotificationRequest } from "../models/NotificationInterfaces";
|
|
3
3
|
export default class NotificationsUtil {
|
|
4
4
|
private static apnProvider;
|
|
5
5
|
private static getAccessToken;
|
|
@@ -8,7 +8,7 @@ export default class NotificationsUtil {
|
|
|
8
8
|
static sendAndroidNotification(notification: AndroidMessage): Promise<void>;
|
|
9
9
|
private static buildAppleNotification;
|
|
10
10
|
private static buildAndroidNotification;
|
|
11
|
-
|
|
11
|
+
static sendNotification(userUuid: string, notification: NotificationRequest): Promise<void>;
|
|
12
12
|
static calculateDelayUntil10AM(timeZone: string, additionalDelay?: number): number;
|
|
13
13
|
static calculateDelayUntil6PM(timeZone: string): number;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/NotificationsUtil.ts"],"sourcesContent":["import apn, { Provider } from \"apn\";\nimport axios, { isAxiosError } from \"axios\";\nimport * as dotenv from \"dotenv\";\nimport { google } from \"googleapis\";\nimport type { JWT } from \"google-auth-library\";\nimport { cert_key } from \"../enums/cert\";\nimport type {\n AndroidMessage,\n NotificationRequest\n} from \"../models/NotificationInterfaces\";\nimport {DeviceTokens} from \"../dbmodels/DeviceTokens\";\ndotenv.config();\n\nexport default class NotificationsUtil {\n private static apnProvider: Provider = this.getAPNProvider();\n\n private static async getAccessToken(): Promise<string> {\n const key = cert_key;\n\n const jwtClient: JWT = new google.auth.JWT({\n email: key.client_email,\n key: key.private_key,\n scopes: [\"https://www.googleapis.com/auth/firebase.messaging\"],\n });\n\n return new Promise<string>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n jwtClient.authorize((err: any, tokens: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n resolve(tokens.access_token as string);\n });\n });\n }\n\n private static getAPNProvider(): Provider {\n return new apn.Provider({\n token: {\n key: process.env.APN_KEY_PATH as string,\n keyId: process.env.NOTIFICATIONS_KEY_ID as string,\n teamId: process.env.NOTIFICATIONS_TEAM_ID as string,\n },\n production: true,\n });\n }\n\n public static async sendAppleNotification(\n notification: apn.Notification,\n token: string | string[]\n ) {\n try {\n await this.apnProvider.send(notification, token);\n } catch (e) {\n console.error(\n `ERROR: Could not send apple notification: ${(e as Error).message}`\n );\n }\n }\n\n public static async sendAndroidNotification(notification: AndroidMessage) {\n try {\n await axios.post(\n \"https://fcm.googleapis.com/v1/projects/dayschallenge-373510/messages:send\",\n notification,\n {\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${await this.getAccessToken()}`,\n },\n }\n );\n } catch (e) {\n if (isAxiosError(e)) {\n console.error(\n `ERROR: Could not send android notification: ${(e as Error).message}`\n );\n }\n }\n }\n\n private static buildAppleNotification(notificationReq: NotificationRequest) {\n const notification: apn.Notification = new apn.Notification();\n notification.topic = process.env.APPLE_BUNDLE_ID as string;\n notification.priority = 10;\n notification.expiry = Math.floor(Date.now() / 1000) + 3600;\n notification.rawPayload = {\n aps: {\n alert: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n \"content-available\": 1,\n sound: \"default\",\n redirectPath: notificationReq.redirectPath,\n },\n };\n return notification;\n }\n\n private static buildAndroidNotification(\n notificationReq: NotificationRequest,\n token: string | string[]\n ): AndroidMessage {\n if (Array.isArray(token)) {\n return {\n message: {\n token: token,\n notification: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n },\n };\n }\n\n return {\n message: {\n token: token,\n notification: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n },\n };\n }\n\n\n private static async sendNotification(\n userUuid: string,\n notification: NotificationRequest\n ) {\n const deviceToken: DeviceTokens | null = await DeviceTokens.findOne({\n where: { userUuid: userUuid },\n raw: true,\n });\n\n if (!deviceToken) {\n console.error(`ERROR: No token found for user ${userUuid}}`);\n return;\n }\n\n deviceToken.platform === \"ios\"\n ? await this.sendAppleNotification(\n this.buildAppleNotification(notification),\n deviceToken.deviceToken\n )\n : await this.sendAndroidNotification(\n this.buildAndroidNotification(notification, deviceToken.deviceToken)\n );\n }\n\n public static calculateDelayUntil10AM(timeZone: string, additionalDelay = 0) {\n const now = new Date(new Date().toLocaleString(\"en-US\", { timeZone }));\n\n // Create a Date object for 10 AM today in the user's time zone\n const next10AM = new Date(now);\n next10AM.setHours(10, 0, 0, 0);\n\n // If the current time is past 10 AM, set the next 10 AM to tomorrow\n if (now.getTime() > next10AM.getTime()) {\n next10AM.setDate(next10AM.getDate() + 1);\n }\n next10AM.setDate(next10AM.getDate() + additionalDelay);\n // Calculate the delay in milliseconds\n return next10AM.getTime() - now.getTime();\n }\n\n public static calculateDelayUntil6PM(timeZone: string) {\n // Get the current date and time in the user's time zone\n const now = new Date(new Date().toLocaleString(\"en-US\", { timeZone }));\n\n // Create a Date object for 6 PM today in the user's time zone\n const next6PM = new Date(now);\n next6PM.setHours(18, 0, 0, 0);\n\n // If the current time is past 6 PM, set the next 6 PM to tomorrow\n if (now.getTime() > next6PM.getTime()) {\n next6PM.setDate(next6PM.getDate() + 1);\n }\n\n // Calculate the delay in milliseconds\n return next6PM.getTime() - now.getTime();\n }\n}\n"],"names":["apn","axios","isAxiosError","dotenv","google","cert_key","DeviceTokens","config","NotificationsUtil","apnProvider","getAPNProvider","getAccessToken","key","jwtClient","auth","JWT","email","client_email","private_key","scopes","Promise","resolve","reject","authorize","err","tokens","access_token","Provider","token","process","env","APN_KEY_PATH","keyId","NOTIFICATIONS_KEY_ID","teamId","NOTIFICATIONS_TEAM_ID","production","sendAppleNotification","notification","send","e","console","error","message","sendAndroidNotification","post","headers","Authorization","buildAppleNotification","notificationReq","Notification","topic","APPLE_BUNDLE_ID","priority","expiry","Math","floor","Date","now","rawPayload","aps","alert","title","body","sound","redirectPath","buildAndroidNotification","Array","isArray","sendNotification","userUuid","deviceToken","findOne","where","raw","platform","calculateDelayUntil10AM","timeZone","additionalDelay","toLocaleString","next10AM","setHours","getTime","setDate","getDate","calculateDelayUntil6PM","next6PM"],"mappings":"AAAA,OAAOA,SAAuB,MAAM;AACpC,OAAOC,SAASC,YAAY,QAAQ,QAAQ;AAC5C,YAAYC,YAAY,SAAS;AACjC,SAASC,MAAM,QAAQ,aAAa;AAEpC,SAASC,QAAQ,QAAQ,gBAAgB;AAKzC,SAAQC,YAAY,QAAO,2BAA2B;AACtDH,OAAOI,MAAM;AAEb,eAAe,MAAMC;IACnB,OAAeC,cAAwB,IAAI,CAACC,cAAc,GAAG;IAE7D,aAAqBC,iBAAkC;QACrD,MAAMC,MAAMP;QAEZ,MAAMQ,YAAiB,IAAIT,OAAOU,IAAI,CAACC,GAAG,CAAC;YACzCC,OAAOJ,IAAIK,YAAY;YACvBL,KAAKA,IAAIM,WAAW;YACpBC,QAAQ;gBAAC;aAAqD;QAChE;QAEA,OAAO,IAAIC,QAAgB,CAACC,SAASC,SAAW;YAC9C,wGAAwG;YACxGT,UAAUU,SAAS,CAAC,CAACC,KAAUC,SAAgB;gBAC7C,IAAID,KAAK;oBACPF,OAAOE;oBACP;gBACF,CAAC;gBAED,sEAAsE;gBACtEH,QAAQI,OAAOC,YAA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F,SAASE,OAAO,IAAI;YACtCF,SAASG,OAAO,CAACH,SAASI,OAAO,KAAK;QACxC,CAAC;QACDJ,SAASG,OAAO,CAACH,SAASI,OAAO,KAAKN;QACtC,sCAAsC;QACtC,OAAOE,SAASE,OAAO,KAAKxB,IAAIwB,OAAO;IACzC;IAEA,OAAcG,uBAAuBR,QAAgB,EAAE;QACrD,wDAAwD;QACxD,MAAMnB,MAAM,IAAID,KAAK,IAAIA,OAAOsB,cAAc,CAAC,SAAS;YAAEF;QAAS;QAEnE,8DAA8D;QAC9D,MAAMS,UAAU,IAAI7B,KAAKC;QACzB4B,QAAQL,QAAQ,CAAC,IAAI,GAAG,GAAG;QAE3B,kEAAkE;QAClE,IAAIvB,IAAIwB,OAAO,KAAKI,QAAQJ,OAAO,IAAI;YACrCI,QAAQH,OAAO,CAACG,QAAQF,OAAO,KAAK;QACtC,CAAC;QAED,sCAAsC;QACtC,OAAOE,QAAQJ,OAAO,KAAKxB,IAAIwB,OAAO;IACxC;AACF,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/NotificationsUtil.ts"],"sourcesContent":["import apn, { Provider } from \"apn\";\nimport axios, { isAxiosError } from \"axios\";\nimport * as dotenv from \"dotenv\";\nimport { google } from \"googleapis\";\nimport type { JWT } from \"google-auth-library\";\nimport { cert_key } from \"../enums/cert\";\nimport type {\n AndroidMessage,\n NotificationRequest\n} from \"../models/NotificationInterfaces\";\nimport {DeviceTokens} from \"../dbmodels/DeviceTokens\";\ndotenv.config();\n\nexport default class NotificationsUtil {\n private static apnProvider: Provider = this.getAPNProvider();\n\n private static async getAccessToken(): Promise<string> {\n const key = cert_key;\n\n const jwtClient: JWT = new google.auth.JWT({\n email: key.client_email,\n key: key.private_key,\n scopes: [\"https://www.googleapis.com/auth/firebase.messaging\"],\n });\n\n return new Promise<string>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n jwtClient.authorize((err: any, tokens: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n resolve(tokens.access_token as string);\n });\n });\n }\n\n private static getAPNProvider(): Provider {\n return new apn.Provider({\n token: {\n key: process.env.APN_KEY_PATH as string,\n keyId: process.env.NOTIFICATIONS_KEY_ID as string,\n teamId: process.env.NOTIFICATIONS_TEAM_ID as string,\n },\n production: true,\n });\n }\n\n public static async sendAppleNotification(\n notification: apn.Notification,\n token: string | string[]\n ) {\n try {\n await this.apnProvider.send(notification, token);\n } catch (e) {\n console.error(\n `ERROR: Could not send apple notification: ${(e as Error).message}`\n );\n }\n }\n\n public static async sendAndroidNotification(notification: AndroidMessage) {\n try {\n await axios.post(\n \"https://fcm.googleapis.com/v1/projects/dayschallenge-373510/messages:send\",\n notification,\n {\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${await this.getAccessToken()}`,\n },\n }\n );\n } catch (e) {\n if (isAxiosError(e)) {\n console.error(\n `ERROR: Could not send android notification: ${(e as Error).message}`\n );\n }\n }\n }\n\n private static buildAppleNotification(notificationReq: NotificationRequest) {\n const notification: apn.Notification = new apn.Notification();\n notification.topic = process.env.APPLE_BUNDLE_ID as string;\n notification.priority = 10;\n notification.expiry = Math.floor(Date.now() / 1000) + 3600;\n notification.rawPayload = {\n aps: {\n alert: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n \"content-available\": 1,\n sound: \"default\",\n redirectPath: notificationReq.redirectPath,\n },\n };\n return notification;\n }\n\n private static buildAndroidNotification(\n notificationReq: NotificationRequest,\n token: string | string[]\n ): AndroidMessage {\n if (Array.isArray(token)) {\n return {\n message: {\n token: token,\n notification: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n },\n };\n }\n\n return {\n message: {\n token: token,\n notification: {\n title: notificationReq.title,\n body: notificationReq.body,\n },\n },\n };\n }\n\n\n public static async sendNotification(\n userUuid: string,\n notification: NotificationRequest\n ) {\n const deviceToken: DeviceTokens | null = await DeviceTokens.findOne({\n where: { userUuid: userUuid },\n raw: true,\n });\n\n if (!deviceToken) {\n console.error(`ERROR: No token found for user ${userUuid}}`);\n return;\n }\n\n deviceToken.platform === \"ios\"\n ? await this.sendAppleNotification(\n this.buildAppleNotification(notification),\n deviceToken.deviceToken\n )\n : await this.sendAndroidNotification(\n this.buildAndroidNotification(notification, deviceToken.deviceToken)\n );\n }\n\n public static calculateDelayUntil10AM(timeZone: string, additionalDelay = 0) {\n const now = new Date(new Date().toLocaleString(\"en-US\", { timeZone }));\n\n // Create a Date object for 10 AM today in the user's time zone\n const next10AM = new Date(now);\n next10AM.setHours(10, 0, 0, 0);\n\n // If the current time is past 10 AM, set the next 10 AM to tomorrow\n if (now.getTime() > next10AM.getTime()) {\n next10AM.setDate(next10AM.getDate() + 1);\n }\n next10AM.setDate(next10AM.getDate() + additionalDelay);\n // Calculate the delay in milliseconds\n return next10AM.getTime() - now.getTime();\n }\n\n public static calculateDelayUntil6PM(timeZone: string) {\n // Get the current date and time in the user's time zone\n const now = new Date(new Date().toLocaleString(\"en-US\", { timeZone }));\n\n // Create a Date object for 6 PM today in the user's time zone\n const next6PM = new Date(now);\n next6PM.setHours(18, 0, 0, 0);\n\n // If the current time is past 6 PM, set the next 6 PM to tomorrow\n if (now.getTime() > next6PM.getTime()) {\n next6PM.setDate(next6PM.getDate() + 1);\n }\n\n // Calculate the delay in milliseconds\n return next6PM.getTime() - now.getTime();\n }\n}\n"],"names":["apn","axios","isAxiosError","dotenv","google","cert_key","DeviceTokens","config","NotificationsUtil","apnProvider","getAPNProvider","getAccessToken","key","jwtClient","auth","JWT","email","client_email","private_key","scopes","Promise","resolve","reject","authorize","err","tokens","access_token","Provider","token","process","env","APN_KEY_PATH","keyId","NOTIFICATIONS_KEY_ID","teamId","NOTIFICATIONS_TEAM_ID","production","sendAppleNotification","notification","send","e","console","error","message","sendAndroidNotification","post","headers","Authorization","buildAppleNotification","notificationReq","Notification","topic","APPLE_BUNDLE_ID","priority","expiry","Math","floor","Date","now","rawPayload","aps","alert","title","body","sound","redirectPath","buildAndroidNotification","Array","isArray","sendNotification","userUuid","deviceToken","findOne","where","raw","platform","calculateDelayUntil10AM","timeZone","additionalDelay","toLocaleString","next10AM","setHours","getTime","setDate","getDate","calculateDelayUntil6PM","next6PM"],"mappings":"AAAA,OAAOA,SAAuB,MAAM;AACpC,OAAOC,SAASC,YAAY,QAAQ,QAAQ;AAC5C,YAAYC,YAAY,SAAS;AACjC,SAASC,MAAM,QAAQ,aAAa;AAEpC,SAASC,QAAQ,QAAQ,gBAAgB;AAKzC,SAAQC,YAAY,QAAO,2BAA2B;AACtDH,OAAOI,MAAM;AAEb,eAAe,MAAMC;IACnB,OAAeC,cAAwB,IAAI,CAACC,cAAc,GAAG;IAE7D,aAAqBC,iBAAkC;QACrD,MAAMC,MAAMP;QAEZ,MAAMQ,YAAiB,IAAIT,OAAOU,IAAI,CAACC,GAAG,CAAC;YACzCC,OAAOJ,IAAIK,YAAY;YACvBL,KAAKA,IAAIM,WAAW;YACpBC,QAAQ;gBAAC;aAAqD;QAChE;QAEA,OAAO,IAAIC,QAAgB,CAACC,SAASC,SAAW;YAC9C,wGAAwG;YACxGT,UAAUU,SAAS,CAAC,CAACC,KAAUC,SAAgB;gBAC7C,IAAID,KAAK;oBACPF,OAAOE;oBACP;gBACF,CAAC;gBAED,sEAAsE;gBACtEH,QAAQI,OAAOC,YAAY;YAC7B;QACF;IACF;IAEA,OAAehB,iBAA2B;QACxC,OAAO,IAAIV,IAAI2B,QAAQ,CAAC;YACtBC,OAAO;gBACLhB,KAAKiB,QAAQC,GAAG,CAACC,YAAY;gBAC7BC,OAAOH,QAAQC,GAAG,CAACG,oBAAoB;gBACvCC,QAAQL,QAAQC,GAAG,CAACK,qBAAqB;YAC3C;YACAC,YAAY,IAAI;QAClB;IACF;IAEA,aAAoBC,sBAClBC,YAA8B,EAC9BV,KAAwB,EACxB;QACA,IAAI;YACF,MAAM,IAAI,CAACnB,WAAW,CAAC8B,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,KAAKC;QACzB4B,QAAQL,QAAQ,CAAC,IAAI,GAAG,GAAG;QAE3B,kEAAkE;QAClE,IAAIvB,IAAIwB,OAAO,KAAKI,QAAQJ,OAAO,IAAI;YACrCI,QAAQH,OAAO,CAACG,QAAQF,OAAO,KAAK;QACtC,CAAC;QAED,sCAAsC;QACtC,OAAOE,QAAQJ,OAAO,KAAKxB,IAAIwB,OAAO;IACxC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Column, DataType, Default, HasMany, Model, Table } from "sequelize-typescript";
|
|
2
|
+
import type {ExerciseModel, ProgramTypes} from "../../models/ExerciseInterfaces";
|
|
3
|
+
import {TranslatedExerciseModel} from "./TranslatedExerciseModel";
|
|
4
|
+
|
|
5
|
+
@Table
|
|
6
|
+
export class ExercisesModels extends Model implements ExerciseModel {
|
|
7
|
+
@Default(DataType.UUIDV4)
|
|
8
|
+
@Column({
|
|
9
|
+
type: DataType.UUID,
|
|
10
|
+
defaultValue: DataType.UUID,
|
|
11
|
+
allowNull: false,
|
|
12
|
+
primaryKey: true,
|
|
13
|
+
})
|
|
14
|
+
declare uuid: string;
|
|
15
|
+
|
|
16
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
17
|
+
declare name: string;
|
|
18
|
+
|
|
19
|
+
@Column({ type: DataType.STRING, allowNull: true })
|
|
20
|
+
declare restTime: string;
|
|
21
|
+
|
|
22
|
+
@Column({ type: DataType.STRING(2048), allowNull: false })
|
|
23
|
+
declare pointers: string;
|
|
24
|
+
|
|
25
|
+
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
26
|
+
declare isCustom: boolean;
|
|
27
|
+
|
|
28
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
29
|
+
declare url: string;
|
|
30
|
+
|
|
31
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
32
|
+
declare level: string[];
|
|
33
|
+
|
|
34
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
35
|
+
declare hasPriority: boolean;
|
|
36
|
+
|
|
37
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
38
|
+
declare isCompound: boolean;
|
|
39
|
+
|
|
40
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
41
|
+
declare hasVariations: boolean;
|
|
42
|
+
|
|
43
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
44
|
+
declare needsEquipment: boolean;
|
|
45
|
+
|
|
46
|
+
@Column({ type: DataType.JSONB, allowNull: false })
|
|
47
|
+
declare variations: object;
|
|
48
|
+
|
|
49
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
50
|
+
declare muscles: string[];
|
|
51
|
+
|
|
52
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
53
|
+
declare homeWorkout: boolean;
|
|
54
|
+
|
|
55
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
56
|
+
declare programType: ProgramTypes[];
|
|
57
|
+
|
|
58
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
59
|
+
declare graphData: "reps" | "weight";
|
|
60
|
+
|
|
61
|
+
@HasMany(() => TranslatedExerciseModel)
|
|
62
|
+
declare translatedExercises: TranslatedExerciseModel[];
|
|
63
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BelongsTo, Column, DataType, Default, ForeignKey, Model, PrimaryKey, Table } from 'sequelize-typescript';
|
|
2
|
+
import { ExercisesModels } from './ExerciseModels';
|
|
3
|
+
import type {ProgramTypes} from "../../models/ExerciseInterfaces";
|
|
4
|
+
|
|
5
|
+
@Table
|
|
6
|
+
export class TranslatedExerciseModel extends Model {
|
|
7
|
+
@PrimaryKey
|
|
8
|
+
@Default(DataType.UUIDV4)
|
|
9
|
+
@Column(DataType.UUID)
|
|
10
|
+
declare uuid: string;
|
|
11
|
+
|
|
12
|
+
@ForeignKey(() => ExercisesModels)
|
|
13
|
+
@Column(DataType.UUID)
|
|
14
|
+
declare exerciseUuid: string;
|
|
15
|
+
|
|
16
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
17
|
+
declare name: string;
|
|
18
|
+
|
|
19
|
+
@Column({ type: DataType.TEXT, allowNull: false })
|
|
20
|
+
declare language: string;
|
|
21
|
+
|
|
22
|
+
@Column({ type: DataType.STRING, allowNull: true })
|
|
23
|
+
declare restTime: string;
|
|
24
|
+
|
|
25
|
+
@Column({ type: DataType.STRING(2048), allowNull: false })
|
|
26
|
+
declare pointers: string;
|
|
27
|
+
|
|
28
|
+
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
29
|
+
declare isCustom: boolean;
|
|
30
|
+
|
|
31
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
32
|
+
declare url: string;
|
|
33
|
+
|
|
34
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
35
|
+
declare level: string[];
|
|
36
|
+
|
|
37
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
38
|
+
declare hasPriority: boolean;
|
|
39
|
+
|
|
40
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
41
|
+
declare isCompound: boolean;
|
|
42
|
+
|
|
43
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
44
|
+
declare hasVariations: boolean;
|
|
45
|
+
|
|
46
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
47
|
+
declare needsEquipment: boolean;
|
|
48
|
+
|
|
49
|
+
@Column({ type: DataType.JSONB, allowNull: false })
|
|
50
|
+
declare variations: object;
|
|
51
|
+
|
|
52
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
53
|
+
declare muscles: string[];
|
|
54
|
+
|
|
55
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false })
|
|
56
|
+
declare homeWorkout: boolean;
|
|
57
|
+
|
|
58
|
+
@Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
|
|
59
|
+
declare programType: ProgramTypes[];
|
|
60
|
+
|
|
61
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
62
|
+
declare graphData: 'reps' | 'weight';
|
|
63
|
+
|
|
64
|
+
@BelongsTo(() => ExercisesModels)
|
|
65
|
+
declare exercise: ExercisesModels;
|
|
66
|
+
}
|
|
@@ -1,27 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
| "Weights"
|
|
6
|
-
| "Both";
|
|
1
|
+
import type {UserStrengthTests} from "../dbmodels/program/UserStrengthTests";
|
|
2
|
+
import type {UserChallenge} from "../dbmodels/program/UserChallenge";
|
|
3
|
+
import type {TranslatedStrengthTestExercise} from "../dbmodels/program/TranslatedStrengthTestExercise";
|
|
4
|
+
import type {ExercisesModels} from "../dbmodels/program/ExerciseModels";
|
|
7
5
|
|
|
8
|
-
export interface
|
|
9
|
-
|
|
6
|
+
export interface ExerciseModel {
|
|
7
|
+
uuid: string;
|
|
8
|
+
name: string;
|
|
9
|
+
level: string[];
|
|
10
|
+
isCompound: boolean;
|
|
11
|
+
needsEquipment: boolean;
|
|
12
|
+
hasPriority: boolean;
|
|
13
|
+
hasVariations: boolean;
|
|
14
|
+
variations: object;
|
|
15
|
+
muscles: string[];
|
|
16
|
+
homeWorkout: boolean;
|
|
10
17
|
}
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
export interface ExerciseProgress {
|
|
20
|
+
exerciseUuid: string;
|
|
21
|
+
progress: Progress[];
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
|
|
24
|
+
export interface UpdateSTRequest {
|
|
25
|
+
body: UserStrengthTests;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UpdateUserChallengeRequest {
|
|
29
|
+
body: UserChallenge;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface STExerciseProgress {
|
|
33
|
+
exerciseUuid: string;
|
|
34
|
+
progress: Progress;
|
|
18
35
|
}
|
|
36
|
+
|
|
37
|
+
export interface ExercisePerformance {
|
|
38
|
+
workoutIndex: number;
|
|
39
|
+
progress: Progress[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SwapExerciseRequest {
|
|
43
|
+
exerciseUuid: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ChangeExerciseRequest {
|
|
47
|
+
oldExerciseUuid: string;
|
|
48
|
+
newExercise: ExercisesModels;
|
|
49
|
+
}
|
|
50
|
+
|
|
19
51
|
export interface ReducedExercise {
|
|
20
52
|
uuid: string;
|
|
21
53
|
name: string;
|
|
22
54
|
order: number;
|
|
23
|
-
progress
|
|
55
|
+
progress?: Progress[];
|
|
24
56
|
sets: string;
|
|
25
57
|
reps: string;
|
|
26
58
|
restTime?: string;
|
|
27
59
|
}
|
|
60
|
+
|
|
61
|
+
export interface UpdateTranslatedStrengthTestExercisesRequest {
|
|
62
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface AddTranslatedStrengthTestExercisesRequest {
|
|
66
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type ProgramTypes =
|
|
70
|
+
| "BodyweightHomeWorkout"
|
|
71
|
+
| "BodyweightOnlyBodyweight"
|
|
72
|
+
| "BodyweightWeightedCali"
|
|
73
|
+
| "Weights"
|
|
74
|
+
| "Both";
|
|
75
|
+
|
|
76
|
+
export interface Progress {
|
|
77
|
+
[key: string]: number | string | undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ProgressByExercise {
|
|
81
|
+
name: string;
|
|
82
|
+
totalRepsDone: number;
|
|
83
|
+
weight: number;
|
|
84
|
+
}
|