90dc-core 1.5.14 → 1.5.16

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/index.d.ts CHANGED
@@ -7,4 +7,8 @@ export * from "./lib/dbmodels/PersistedUser";
7
7
  export * from "./lib/dbmodels/UserBadges";
8
8
  export * from "./lib/dbmodels/UserStreaks";
9
9
  export * from "./lib/dbmodels/Badge";
10
+ export * from "./lib/dbmodels/Program";
11
+ export * from "./lib/dbmodels/Workout";
12
+ export * from "./lib/dbmodels/Exercise";
13
+ export * from "./lib/dbmodels/Superset";
10
14
  export * from "./lib/utils/Logger";
package/dist/index.js CHANGED
@@ -9,6 +9,10 @@ export * from "./lib/dbmodels/PersistedUser";
9
9
  export * from "./lib/dbmodels/UserBadges";
10
10
  export * from "./lib/dbmodels/UserStreaks";
11
11
  export * from "./lib/dbmodels/Badge";
12
+ export * from "./lib/dbmodels/Program";
13
+ export * from "./lib/dbmodels/Workout";
14
+ export * from "./lib/dbmodels/Exercise";
15
+ export * from "./lib/dbmodels/Superset";
12
16
  //Utils
13
17
  export * from "./lib/utils/Logger";
14
18
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["//Interfaces\nexport * from \"./lib/models/ProgramInterfaces\";\nexport * from \"./lib/models/ExerciseInterfaces\";\nexport * from \"./lib/models/WorkoutInterfaces\";\nexport * from \"./lib/models/UserInterfaces\";\n\n//DB Models\nexport * from \"./lib/dbmodels/UsersFriends\"\nexport * from \"./lib/dbmodels/PersistedUser\"\nexport * from \"./lib/dbmodels/UserBadges\"\nexport * from \"./lib/dbmodels/UserStreaks\"\nexport * from \"./lib/dbmodels/Badge\"\n\n//Utils\nexport * from \"./lib/utils/Logger\"\n"],"names":[],"mappings":"AAAA,YAAY;AACZ,cAAc,iCAAiC;AAC/C,cAAc,kCAAkC;AAChD,cAAc,iCAAiC;AAC/C,cAAc,8BAA8B;AAE5C,WAAW;AACX,cAAc,8BAA6B;AAC3C,cAAc,+BAA8B;AAC5C,cAAc,4BAA2B;AACzC,cAAc,6BAA4B;AAC1C,cAAc,uBAAsB;AAEpC,OAAO;AACP,cAAc,qBAAoB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["//Interfaces\nexport * from \"./lib/models/ProgramInterfaces\";\nexport * from \"./lib/models/ExerciseInterfaces\";\nexport * from \"./lib/models/WorkoutInterfaces\";\nexport * from \"./lib/models/UserInterfaces\";\n\n//DB Models\nexport * from \"./lib/dbmodels/UsersFriends\"\nexport * from \"./lib/dbmodels/PersistedUser\"\nexport * from \"./lib/dbmodels/UserBadges\"\nexport * from \"./lib/dbmodels/UserStreaks\"\nexport * from \"./lib/dbmodels/Badge\"\nexport * from \"./lib/dbmodels/Program\"\nexport * from \"./lib/dbmodels/Workout\"\nexport * from \"./lib/dbmodels/Exercise\"\nexport * from \"./lib/dbmodels/Superset\"\n\n//Utils\nexport * from \"./lib/utils/Logger\"\n"],"names":[],"mappings":"AAAA,YAAY;AACZ,cAAc,iCAAiC;AAC/C,cAAc,kCAAkC;AAChD,cAAc,iCAAiC;AAC/C,cAAc,8BAA8B;AAE5C,WAAW;AACX,cAAc,8BAA6B;AAC3C,cAAc,+BAA8B;AAC5C,cAAc,4BAA2B;AACzC,cAAc,6BAA4B;AAC1C,cAAc,uBAAsB;AACpC,cAAc,yBAAwB;AACtC,cAAc,yBAAwB;AACtC,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AAEvC,OAAO;AACP,cAAc,qBAAoB"}
@@ -26,7 +26,7 @@ __decorate([
26
26
  ], Badge.prototype, "title", void 0);
27
27
  __decorate([
28
28
  Column({
29
- type: DataType.ARRAY(DataType.STRING),
29
+ type: DataType.ARRAY(DataType.TEXT),
30
30
  allowNull: false
31
31
  })
32
32
  ], Badge.prototype, "tags", void 0);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dbmodels/Badge.ts"],"sourcesContent":["import { BelongsToMany, Column, DataType, Default, Model, Table } from \"sequelize-typescript\";\nimport { UserBadges } from \"./UserBadges\";\nimport { PersistedUser } from \"./PersistedUser\";\n\n@Table\nexport class Badge extends Model {\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.TEXT, allowNull: false })\n declare title: string;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare tags: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageURL: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare description: string;\n\n @BelongsToMany(() => PersistedUser, () => UserBadges)\n declare users: PersistedUser[];\n}\n"],"names":["BelongsToMany","Column","DataType","Default","Model","Table","UserBadges","PersistedUser","Badge","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","ARRAY","STRING"],"mappings":";;;;;;AAAA,SAASA,aAAa,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC9F,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,kBAAkB;AAGhD,WAAaC,QAAN,oBAAoBJ;AAwB3B,EAAC;;IAvBID,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,IAAI;QAAEF,WAAW,KAAK;IAAC;GAVvCL;;IAaRP,OAAO;QAAES,MAAMR,SAASc,KAAK,CAACd,SAASe,MAAM;QAAGJ,WAAW,KAAK;IAAC;GAbzDL;;IAgBRP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAhBvCL;;IAmBRP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAnBvCL;;IAsBRR,cAAc,IAAMO,eAAe,IAAMD;GAtBjCE;AAAAA;IADZH;GACYG"}
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Badge.ts"],"sourcesContent":["import { BelongsToMany, Column, DataType, Default, Model, Table } from \"sequelize-typescript\";\nimport { UserBadges } from \"./UserBadges\";\nimport { PersistedUser } from \"./PersistedUser\";\n\n@Table\nexport class Badge extends Model {\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.TEXT, allowNull: false })\n declare title: string;\n\n @Column({ type: DataType.ARRAY(DataType.TEXT), allowNull: false })\n declare tags: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageURL: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare description: string;\n\n @BelongsToMany(() => PersistedUser, () => UserBadges)\n declare users: PersistedUser[];\n}\n"],"names":["BelongsToMany","Column","DataType","Default","Model","Table","UserBadges","PersistedUser","Badge","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","ARRAY"],"mappings":";;;;;;AAAA,SAASA,aAAa,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC9F,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,kBAAkB;AAGhD,WAAaC,QAAN,oBAAoBJ;AAwB3B,EAAC;;IAvBID,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,IAAI;QAAEF,WAAW,KAAK;IAAC;GAVvCL;;IAaRP,OAAO;QAAES,MAAMR,SAASc,KAAK,CAACd,SAASa,IAAI;QAAGF,WAAW,KAAK;IAAC;GAbvDL;;IAgBRP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAhBvCL;;IAmBRP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAnBvCL;;IAsBRR,cAAc,IAAMO,eAAe,IAAMD;GAtBjCE;AAAAA;IADZH;GACYG"}
@@ -0,0 +1,14 @@
1
+ import { Model } from "sequelize-typescript";
2
+ import { Workout } from "./Workout";
3
+ import type { Progress, ReducedExercise } from "../models/ExerciseInterfaces";
4
+ export declare class Exercise extends Model<Exercise> implements ReducedExercise {
5
+ uuid: string;
6
+ name: string;
7
+ order: number;
8
+ progress: Progress[];
9
+ reps: string;
10
+ sets: string;
11
+ restTime: string;
12
+ workoutUuid: string;
13
+ workout: Workout;
14
+ }
@@ -0,0 +1,71 @@
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, Index, Model, Table } from "sequelize-typescript";
8
+ import { Workout } from "./Workout";
9
+ export let Exercise = class Exercise 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
+ ], Exercise.prototype, "uuid", void 0);
20
+ __decorate([
21
+ Column({
22
+ type: DataType.STRING,
23
+ allowNull: false
24
+ })
25
+ ], Exercise.prototype, "name", void 0);
26
+ __decorate([
27
+ Column({
28
+ type: DataType.INTEGER,
29
+ allowNull: false
30
+ })
31
+ ], Exercise.prototype, "order", void 0);
32
+ __decorate([
33
+ Column({
34
+ type: DataType.ARRAY(DataType.JSONB),
35
+ allowNull: true
36
+ })
37
+ ], Exercise.prototype, "progress", void 0);
38
+ __decorate([
39
+ Column({
40
+ type: DataType.TEXT,
41
+ allowNull: false
42
+ })
43
+ ], Exercise.prototype, "reps", void 0);
44
+ __decorate([
45
+ Column({
46
+ type: DataType.TEXT,
47
+ allowNull: false
48
+ })
49
+ ], Exercise.prototype, "sets", void 0);
50
+ __decorate([
51
+ Column({
52
+ type: DataType.TEXT,
53
+ allowNull: true
54
+ })
55
+ ], Exercise.prototype, "restTime", void 0);
56
+ __decorate([
57
+ ForeignKey(()=>Workout),
58
+ Index,
59
+ Column({
60
+ type: DataType.UUID,
61
+ allowNull: true
62
+ })
63
+ ], Exercise.prototype, "workoutUuid", void 0);
64
+ __decorate([
65
+ BelongsTo(()=>Workout)
66
+ ], Exercise.prototype, "workout", void 0);
67
+ Exercise = __decorate([
68
+ Table
69
+ ], Exercise);
70
+
71
+ //# sourceMappingURL=Exercise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Exercise.ts"],"sourcesContent":["import {\n BelongsTo,\n Column,\n DataType,\n Default,\n ForeignKey,\n Index,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport { Workout } from \"./Workout\";\nimport type {Progress, ReducedExercise} from \"../models/ExerciseInterfaces\";\n\n@Table\nexport class Exercise extends Model<Exercise> implements ReducedExercise {\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.INTEGER, allowNull: false })\n declare order: number;\n\n @Column({ type: DataType.ARRAY(DataType.JSONB), allowNull: true })\n declare progress: Progress[];\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare reps: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare sets: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare restTime: string;\n\n @ForeignKey(() => Workout)\n @Index\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare workoutUuid: string;\n\n @BelongsTo(() => Workout)\n declare workout: Workout;\n}\n"],"names":["BelongsTo","Column","DataType","Default","ForeignKey","Index","Model","Table","Workout","Exercise","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","INTEGER","ARRAY","JSONB","TEXT"],"mappings":";;;;;;AAAA,SACEA,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SAASC,OAAO,QAAQ,YAAY;AAIpC,WAAaC,WAAN,uBAAuBH;AAsC9B,EAAC;;IArCEH,QAAQD,SAASQ,MAAM;IACvBT,OAAO;QACNU,MAAMT,SAASU,IAAI;QACnBC,cAAcX,SAASU,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GAPWN;;IAUVR,OAAO;QAAEU,MAAMT,SAASc,MAAM;QAAEF,WAAW,KAAK;IAAC;GAVvCL;;IAaVR,OAAO;QAAEU,MAAMT,SAASe,OAAO;QAAEH,WAAW,KAAK;IAAC;GAbxCL;;IAgBVR,OAAO;QAAEU,MAAMT,SAASgB,KAAK,CAAChB,SAASiB,KAAK;QAAGL,WAAW,IAAI;IAAC;GAhBrDL;;IAmBVR,OAAO;QAAEU,MAAMT,SAASkB,IAAI;QAAEN,WAAW,KAAK;IAAC;GAnBrCL;;IAsBVR,OAAO;QAAEU,MAAMT,SAASkB,IAAI;QAAEN,WAAW,KAAK;IAAC;GAtBrCL;;IAyBVR,OAAO;QAAEU,MAAMT,SAASkB,IAAI;QAAEN,WAAW,IAAI;IAAC;GAzBpCL;;IA4BVL,WAAW,IAAMI;IACjBH;IACAJ,OAAO;QACNU,MAAMT,SAASU,IAAI;QACnBE,WAAW,IAAI;IACjB;GAjCWL;;IAoCVT,UAAU,IAAMQ;GApCNC;AAAAA;IADZF;GACYE"}
@@ -0,0 +1,11 @@
1
+ import { Workout } from "./Workout";
2
+ import { Model } from "sequelize-typescript";
3
+ export declare class Program extends Model<Program> {
4
+ programId: string;
5
+ userUuid: string;
6
+ workout: Workout[];
7
+ startDate: string;
8
+ programType: string;
9
+ createdAt: Date;
10
+ static deleteRelatedWorkouts(instance: Program): Promise<void>;
11
+ }
@@ -0,0 +1,65 @@
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 { Workout } from "./Workout";
8
+ import { BeforeDestroy, Column, DataType, Default, HasMany, Model, Table } from "sequelize-typescript";
9
+ export let Program = class Program extends Model {
10
+ static async deleteRelatedWorkouts(instance) {
11
+ const workouts = await instance.$get("workout", {
12
+ scope: "workout"
13
+ });
14
+ for (const workout of workouts){
15
+ await workout.destroy();
16
+ }
17
+ }
18
+ };
19
+ __decorate([
20
+ Default(DataType.UUIDV4),
21
+ Column({
22
+ type: DataType.UUID,
23
+ defaultValue: DataType.UUID,
24
+ allowNull: false,
25
+ primaryKey: true
26
+ })
27
+ ], Program.prototype, "programId", void 0);
28
+ __decorate([
29
+ Column({
30
+ type: DataType.UUID,
31
+ allowNull: false
32
+ })
33
+ ], Program.prototype, "userUuid", void 0);
34
+ __decorate([
35
+ HasMany(()=>Workout, {
36
+ foreignKey: "programId",
37
+ onDelete: "CASCADE"
38
+ })
39
+ ], Program.prototype, "workout", void 0);
40
+ __decorate([
41
+ Column({
42
+ type: DataType.TEXT,
43
+ allowNull: false
44
+ })
45
+ ], Program.prototype, "startDate", void 0);
46
+ __decorate([
47
+ Column({
48
+ type: DataType.TEXT,
49
+ allowNull: true
50
+ })
51
+ ], Program.prototype, "programType", void 0);
52
+ __decorate([
53
+ Column({
54
+ type: DataType.DATE,
55
+ allowNull: true
56
+ })
57
+ ], Program.prototype, "createdAt", void 0);
58
+ __decorate([
59
+ BeforeDestroy
60
+ ], Program, "deleteRelatedWorkouts", null);
61
+ Program = __decorate([
62
+ Table
63
+ ], Program);
64
+
65
+ //# sourceMappingURL=Program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Program.ts"],"sourcesContent":["import { Workout } from \"./Workout\";\nimport {\n BeforeDestroy,\n Column,\n DataType,\n Default,\n HasMany,\n Model,\n Table,\n} from \"sequelize-typescript\";\n\n@Table\nexport class Program extends Model<Program> {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare programId: string;\n\n @Column({ type: DataType.UUID, allowNull: false })\n declare userUuid: string;\n\n @HasMany(() => Workout, { foreignKey: \"programId\", onDelete: \"CASCADE\" })\n declare workout: Workout[];\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare startDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare programType: string;\n\n @Column({ type: DataType.DATE, allowNull: true })\n declare createdAt: Date;\n\n @BeforeDestroy\n static async deleteRelatedWorkouts(instance: Program) {\n const workouts = await instance.$get(\"workout\", { scope: \"workout\" });\n\n for (const workout of workouts) {\n await workout.destroy();\n }\n }\n}\n"],"names":["Workout","BeforeDestroy","Column","DataType","Default","HasMany","Model","Table","Program","deleteRelatedWorkouts","instance","workouts","$get","scope","workout","destroy","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","foreignKey","onDelete","TEXT","DATE"],"mappings":";;;;;;AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SACEC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAG9B,WAAaC,UAAN,sBAAsBF;IAyB3B,aACaG,sBAAsBC,QAAiB,EAAE;QACpD,MAAMC,WAAW,MAAMD,SAASE,IAAI,CAAC,WAAW;YAAEC,OAAO;QAAU;QAEnE,KAAK,MAAMC,WAAWH,SAAU;YAC9B,MAAMG,QAAQC,OAAO;QACvB;IACF;AACF,EAAC;;IAhCEX,QAAQD,SAASa,MAAM;IACvBd,OAAO;QACNe,MAAMd,SAASe,IAAI;QACnBC,cAAchB,SAASe,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GAPWb;;IAUVN,OAAO;QAAEe,MAAMd,SAASe,IAAI;QAAEE,WAAW,KAAK;IAAC;GAVrCZ;;IAaVH,QAAQ,IAAML,SAAS;QAAEsB,YAAY;QAAaC,UAAU;IAAU;GAb5Df;;IAgBVN,OAAO;QAAEe,MAAMd,SAASqB,IAAI;QAAEJ,WAAW,KAAK;IAAC;GAhBrCZ;;IAmBVN,OAAO;QAAEe,MAAMd,SAASqB,IAAI;QAAEJ,WAAW,IAAI;IAAC;GAnBpCZ;;IAsBVN,OAAO;QAAEe,MAAMd,SAASsB,IAAI;QAAEL,WAAW,IAAI;IAAC;GAtBpCZ;;IAyBVP;GAzBUO;AAAAA;IADZD;GACYC"}
@@ -0,0 +1,8 @@
1
+ import { Model } from "sequelize-typescript";
2
+ import type { ReducedExercise } from "../models/ExerciseInterfaces";
3
+ export declare class Superset extends Model<Superset> {
4
+ uuid: string;
5
+ startPosition: number;
6
+ workoutUuid: string;
7
+ exercises: ReducedExercise[];
8
+ }
@@ -0,0 +1,40 @@
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, ForeignKey, Index, Model, Table } from "sequelize-typescript";
8
+ import { Workout } from "./Workout";
9
+ export let Superset = class Superset 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
+ ], Superset.prototype, "uuid", void 0);
20
+ __decorate([
21
+ Column({
22
+ type: DataType.INTEGER,
23
+ allowNull: false
24
+ })
25
+ ], Superset.prototype, "startPosition", void 0);
26
+ __decorate([
27
+ ForeignKey(()=>Workout),
28
+ Index
29
+ ], Superset.prototype, "workoutUuid", void 0);
30
+ __decorate([
31
+ Column({
32
+ type: DataType.ARRAY(DataType.JSONB),
33
+ allowNull: false
34
+ })
35
+ ], Superset.prototype, "exercises", void 0);
36
+ Superset = __decorate([
37
+ Table
38
+ ], Superset);
39
+
40
+ //# sourceMappingURL=Superset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Superset.ts"],"sourcesContent":["\nimport {Column, DataType, Default, ForeignKey, Index, Model, Table} from \"sequelize-typescript\";\nimport { Workout } from \"./Workout\";\nimport type {ReducedExercise} from \"../models/ExerciseInterfaces\";\n\n@Table\nexport class Superset extends Model<Superset> {\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.INTEGER, allowNull: false })\n declare startPosition: number;\n\n @ForeignKey(() => Workout)\n @Index\n declare workoutUuid: string;\n\n @Column({ type: DataType.ARRAY(DataType.JSONB), allowNull: false })\n declare exercises: ReducedExercise[];\n\n}\n"],"names":["Column","DataType","Default","ForeignKey","Index","Model","Table","Workout","Superset","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","INTEGER","ARRAY","JSONB"],"mappings":";;;;;;AACA,SAAQA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAChG,SAASC,OAAO,QAAQ,YAAY;AAIpC,WAAaC,WAAN,uBAAuBH;AAoB9B,EAAC;;IAnBIH,QAAQD,SAASQ,MAAM;IACvBT,OAAO;QACJU,MAAMT,SAASU,IAAI;QACnBC,cAAcX,SAASU,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IACpB;GAPSN;;IAURR,OAAO;QAAEU,MAAMT,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GAV1CL;;IAaRL,WAAW,IAAMI;IACjBH;GAdQI;;IAiBRR,OAAO;QAAEU,MAAMT,SAASe,KAAK,CAACf,SAASgB,KAAK;QAAGJ,WAAW,KAAK;IAAC;GAjBxDL;AAAAA;IADZF;GACYE"}
@@ -1,11 +1,14 @@
1
1
  import { Model } from "sequelize-typescript";
2
2
  import { Badge } from "./Badge";
3
3
  import { PersistedUser } from "./PersistedUser";
4
+ import { Program } from "./Program";
4
5
  export declare class UserBadges extends Model {
5
6
  userUuid: string;
6
7
  badgeUuid: string;
8
+ programInstanceUuid?: string;
7
9
  timesEarned: number;
8
10
  hasBeenShown: boolean;
9
11
  user: PersistedUser;
10
12
  badge: Badge;
13
+ programInstance?: Program;
11
14
  }
@@ -7,6 +7,7 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
7
7
  import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from "sequelize-typescript";
8
8
  import { Badge } from "./Badge";
9
9
  import { PersistedUser } from "./PersistedUser";
10
+ import { Program } from "./Program";
10
11
  export let UserBadges = class UserBadges extends Model {
11
12
  };
12
13
  __decorate([
@@ -23,6 +24,13 @@ __decorate([
23
24
  allowNull: false
24
25
  })
25
26
  ], UserBadges.prototype, "badgeUuid", void 0);
27
+ __decorate([
28
+ ForeignKey(()=>Program),
29
+ Column({
30
+ type: DataType.UUID,
31
+ allowNull: true
32
+ })
33
+ ], UserBadges.prototype, "programInstanceUuid", void 0);
26
34
  __decorate([
27
35
  Column({
28
36
  type: DataType.INTEGER,
@@ -43,6 +51,9 @@ __decorate([
43
51
  __decorate([
44
52
  BelongsTo(()=>Badge)
45
53
  ], UserBadges.prototype, "badge", void 0);
54
+ __decorate([
55
+ BelongsTo(()=>Program)
56
+ ], UserBadges.prototype, "programInstance", void 0);
46
57
  UserBadges = __decorate([
47
58
  Table({
48
59
  timestamps: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dbmodels/UserBadges.ts"],"sourcesContent":["import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from \"sequelize-typescript\";\nimport { Badge } from \"./Badge\";\nimport { PersistedUser } from \"./PersistedUser\";\n\n@Table({\n timestamps: true,\n})export class UserBadges extends Model {\n @ForeignKey(() => PersistedUser)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userUuid: string;\n\n @ForeignKey(() => Badge)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare badgeUuid: string;\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 1})\n declare timesEarned: number;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false})\n declare hasBeenShown: boolean;\n\n @BelongsTo(() => PersistedUser)\n declare user: PersistedUser;\n\n @BelongsTo(() => Badge)\n declare badge: Badge;\n}\n"],"names":["BelongsTo","Column","DataType","ForeignKey","Model","Table","Badge","PersistedUser","UserBadges","type","UUID","allowNull","INTEGER","defaultValue","BOOLEAN","timestamps"],"mappings":";;;;;;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC7F,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAI9C,WAAaC,aAAN,yBAAyBJ;AA0BlC,EAAC;;IAzBID,WAAW,IAAMI;IACjBN,OAAO;QACJQ,MAAMP,SAASQ,IAAI;QACnBC,WAAW,KAAK;IACpB;GALWH;;IAQVL,WAAW,IAAMG;IACjBL,OAAO;QACJQ,MAAMP,SAASQ,IAAI;QACnBC,WAAW,KAAK;IACpB;GAZWH;;IAeVP,OAAO;QAAEQ,MAAMP,SAASU,OAAO;QAAED,WAAW,KAAK;QAAEE,cAAc;IAAC;GAfxDL;;IAkBVP,OAAO;QAAEQ,MAAMP,SAASY,OAAO;QAAEH,WAAW,KAAK;QAAEE,cAAc,KAAK;IAAA;GAlB5DL;;IAqBVR,UAAU,IAAMO;GArBNC;;IAwBVR,UAAU,IAAMM;GAxBNE;AAAAA;IAFdH,MAAM;QACHU,YAAY,IAAI;IACpB;GAAeP"}
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/UserBadges.ts"],"sourcesContent":["import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from \"sequelize-typescript\";\nimport { Badge } from \"./Badge\";\nimport { PersistedUser } from \"./PersistedUser\";\nimport {Program} from \"./Program\";\n\n@Table({\n timestamps: true,\n})export class UserBadges extends Model {\n @ForeignKey(() => PersistedUser)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userUuid: string;\n\n @ForeignKey(() => Badge)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare badgeUuid: string;\n\n @ForeignKey(() => Program)\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare programInstanceUuid?: string;\n\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 1})\n declare timesEarned: number;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false})\n declare hasBeenShown: boolean;\n\n @BelongsTo(() => PersistedUser)\n declare user: PersistedUser;\n\n @BelongsTo(() => Badge)\n declare badge: Badge;\n\n @BelongsTo(() => Program)\n declare programInstance?: Program;\n}\n"],"names":["BelongsTo","Column","DataType","ForeignKey","Model","Table","Badge","PersistedUser","Program","UserBadges","type","UUID","allowNull","INTEGER","defaultValue","BOOLEAN","timestamps"],"mappings":";;;;;;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC7F,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAAQC,OAAO,QAAO,YAAY;AAIhC,WAAaC,aAAN,yBAAyBL;AAqClC,EAAC;;IApCID,WAAW,IAAMI;IACjBN,OAAO;QACJS,MAAMR,SAASS,IAAI;QACnBC,WAAW,KAAK;IACpB;GALWH;;IAQVN,WAAW,IAAMG;IACjBL,OAAO;QACJS,MAAMR,SAASS,IAAI;QACnBC,WAAW,KAAK;IACpB;GAZWH;;IAeVN,WAAW,IAAMK;IACjBP,OAAO;QACJS,MAAMR,SAASS,IAAI;QACnBC,WAAW,IAAI;IACnB;GAnBWH;;IAuBVR,OAAO;QAAES,MAAMR,SAASW,OAAO;QAAED,WAAW,KAAK;QAAEE,cAAc;IAAC;GAvBxDL;;IA0BVR,OAAO;QAAES,MAAMR,SAASa,OAAO;QAAEH,WAAW,KAAK;QAAEE,cAAc,KAAK;IAAA;GA1B5DL;;IA6BVT,UAAU,IAAMO;GA7BNE;;IAgCVT,UAAU,IAAMM;GAhCNG;;IAmCVT,UAAU,IAAMQ;GAnCNC;AAAAA;IAFdJ,MAAM;QACHW,YAAY,IAAI;IACpB;GAAeP"}
@@ -0,0 +1,13 @@
1
+ import { Superset } from './Superset';
2
+ import { Model } from 'sequelize-typescript';
3
+ import { Exercise } from "./Exercise";
4
+ export declare class Workout extends Model<Workout> {
5
+ uuid: string;
6
+ isFinished: boolean;
7
+ title: string;
8
+ duration: string;
9
+ order: number;
10
+ exercise: Exercise[];
11
+ superset: Superset[];
12
+ programId: string;
13
+ }
@@ -0,0 +1,66 @@
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 { Superset } from "./Superset";
8
+ import { Column, DataType, Default, ForeignKey, HasMany, Index, Model, Table } from "sequelize-typescript";
9
+ import { Program } from "./Program";
10
+ import { Exercise } from "./Exercise";
11
+ export let Workout = class Workout extends Model {
12
+ };
13
+ __decorate([
14
+ Default(DataType.UUIDV4),
15
+ Column({
16
+ type: DataType.UUID,
17
+ defaultValue: DataType.UUID,
18
+ allowNull: false,
19
+ primaryKey: true
20
+ })
21
+ ], Workout.prototype, "uuid", void 0);
22
+ __decorate([
23
+ Column({
24
+ type: DataType.BOOLEAN,
25
+ allowNull: false
26
+ })
27
+ ], Workout.prototype, "isFinished", void 0);
28
+ __decorate([
29
+ Column({
30
+ type: DataType.TEXT,
31
+ allowNull: false
32
+ })
33
+ ], Workout.prototype, "title", void 0);
34
+ __decorate([
35
+ Column({
36
+ type: DataType.TEXT,
37
+ allowNull: false
38
+ })
39
+ ], Workout.prototype, "duration", void 0);
40
+ __decorate([
41
+ Column({
42
+ type: DataType.INTEGER,
43
+ allowNull: true
44
+ })
45
+ ], Workout.prototype, "order", void 0);
46
+ __decorate([
47
+ HasMany(()=>Exercise, {
48
+ foreignKey: 'workoutUuid',
49
+ onDelete: 'CASCADE'
50
+ })
51
+ ], Workout.prototype, "exercise", void 0);
52
+ __decorate([
53
+ HasMany(()=>Superset, {
54
+ foreignKey: 'workoutUuid',
55
+ onDelete: 'CASCADE'
56
+ })
57
+ ], Workout.prototype, "superset", void 0);
58
+ __decorate([
59
+ ForeignKey(()=>Program),
60
+ Index
61
+ ], Workout.prototype, "programId", void 0);
62
+ Workout = __decorate([
63
+ Table
64
+ ], Workout);
65
+
66
+ //# sourceMappingURL=Workout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Workout.ts"],"sourcesContent":["import { Superset } from './Superset';\nimport {\n\tColumn,\n\tDataType,\n\tDefault,\n\tForeignKey,\n\tHasMany, Index,\n\tModel,\n\tTable\n} from 'sequelize-typescript';\nimport { Program } from './Program';\nimport {Exercise} from \"./Exercise\";\n\n@Table\nexport class Workout extends Model<Workout> {\n\t@Default(DataType.UUIDV4)\n\t@Column({\n\t\ttype: DataType.UUID,\n\t\tdefaultValue: DataType.UUID,\n\t\tallowNull: false,\n\t\tprimaryKey: true\n\t})\n\tdeclare uuid: string;\n\n\t@Column({ type: DataType.BOOLEAN, allowNull: false })\n\tdeclare isFinished: boolean;\n\n\t@Column({ type: DataType.TEXT, allowNull: false })\n\tdeclare title: string;\n\n\t@Column({ type: DataType.TEXT, allowNull: false })\n\tdeclare duration: string;\n\n\t@Column({ type: DataType.INTEGER, allowNull: true })\n\tdeclare order: number;\n\n\t@HasMany(() => Exercise, { foreignKey: 'workoutUuid', onDelete: 'CASCADE' })\n\tdeclare exercise: Exercise[];\n\n\t@HasMany(() => Superset, { foreignKey: 'workoutUuid', onDelete: 'CASCADE' })\n\tdeclare superset: Superset[];\n\n\t@ForeignKey(() => Program)\n\t@Index\n\tdeclare programId: string;\n}\n"],"names":["Superset","Column","DataType","Default","ForeignKey","HasMany","Index","Model","Table","Program","Exercise","Workout","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","BOOLEAN","TEXT","INTEGER","foreignKey","onDelete"],"mappings":";;;;;;AAAA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SACCC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,OAAO,EAAEC,KAAK,EACdC,KAAK,EACLC,KAAK,QACC,uBAAuB;AAC9B,SAASC,OAAO,QAAQ,YAAY;AACpC,SAAQC,QAAQ,QAAO,aAAa;AAGpC,WAAaC,UAAN,sBAAsBJ;AA+B7B,EAAC;;IA9BCJ,QAAQD,SAASU,MAAM;IACvBX,OAAO;QACPY,MAAMX,SAASY,IAAI;QACnBC,cAAcb,SAASY,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IACjB;GAPYN;;IAUXV,OAAO;QAAEY,MAAMX,SAASgB,OAAO;QAAEF,WAAW,KAAK;IAAC;GAVvCL;;IAaXV,OAAO;QAAEY,MAAMX,SAASiB,IAAI;QAAEH,WAAW,KAAK;IAAC;GAbpCL;;IAgBXV,OAAO;QAAEY,MAAMX,SAASiB,IAAI;QAAEH,WAAW,KAAK;IAAC;GAhBpCL;;IAmBXV,OAAO;QAAEY,MAAMX,SAASkB,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAnBtCL;;IAsBXN,QAAQ,IAAMK,UAAU;QAAEW,YAAY;QAAeC,UAAU;IAAU;GAtB9DX;;IAyBXN,QAAQ,IAAML,UAAU;QAAEqB,YAAY;QAAeC,UAAU;IAAU;GAzB9DX;;IA4BXP,WAAW,IAAMK;IACjBH;GA7BWK;AAAAA;IADZH;GACYG"}
@@ -1,36 +1,21 @@
1
- import type { ProgramBlueprint } from "./BlueprintInterfaces";
2
- export interface ExerciseModel {
3
- uuid: string;
4
- name: string;
5
- level: string[];
6
- isCompound: boolean;
7
- needsEquipment: boolean;
8
- hasPriority: boolean;
9
- hasVariations: boolean;
10
- variations: object;
11
- muscles: string[];
12
- homeWorkout: boolean;
1
+ export type ProgramTypes = "BodyweightHomeWorkout" | "BodyweightOnlyBodyweight" | "BodyweightWeightedCali" | "Weights" | "Both";
2
+ export interface GraphProgress extends Progress {
3
+ date: string;
13
4
  }
14
- export interface ExerciseProgressRequest {
15
- exerciseUuid: string;
16
- reps: string;
17
- weight: string;
5
+ export interface Progress {
6
+ [key: string]: number | string | undefined;
18
7
  }
19
- export interface ExerciseProgressGetRequest {
20
- exerciseUuid: string;
8
+ export interface ExerciseOptions {
9
+ sets: string;
10
+ reps: string;
11
+ order: number;
21
12
  }
22
- export interface ExerciseBlueprint {
13
+ export interface ReducedExercise {
23
14
  uuid: string;
24
- hasPriority: boolean;
25
- isCompound: boolean;
26
- homeWorkout: boolean;
27
- needsEquipment: boolean;
28
- isSuperset: boolean;
29
- isFixed: boolean;
30
- muscle: string;
31
- rir: number;
15
+ name: string;
32
16
  order: number;
33
- reps: string;
17
+ progress: Progress[];
34
18
  sets: string;
35
- program: ProgramBlueprint;
19
+ reps: string;
20
+ restTime?: string;
36
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["import type { ProgramBlueprint } from \"./BlueprintInterfaces\";\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}\nexport interface ExerciseProgressRequest {\n exerciseUuid: string;\n reps: string;\n weight: string;\n}\nexport interface ExerciseProgressGetRequest {\n exerciseUuid: string;\n}\nexport interface ExerciseBlueprint {\n uuid: string;\n hasPriority: boolean;\n isCompound: boolean;\n homeWorkout: boolean;\n needsEquipment: boolean;\n isSuperset: boolean;\n isFixed: boolean;\n muscle: string;\n rir: number;\n order: number;\n reps: string;\n sets: string;\n program: ProgramBlueprint;\n}\n"],"names":[],"mappings":"AAAA,WAoCC"}
1
+ {"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["export type ProgramTypes =\n | \"BodyweightHomeWorkout\"\n | \"BodyweightOnlyBodyweight\"\n | \"BodyweightWeightedCali\"\n | \"Weights\"\n | \"Both\";\n\nexport interface GraphProgress extends Progress {\n date: string;\n}\nexport interface Progress {\n [key: string]: number | string | undefined;\n}\nexport interface ExerciseOptions {\n sets: string;\n reps: string;\n order: number;\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"],"names":[],"mappings":"AAAA,WA0BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.5.14",
3
+ "version": "1.5.16",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -10,6 +10,10 @@ export * from "./lib/dbmodels/PersistedUser"
10
10
  export * from "./lib/dbmodels/UserBadges"
11
11
  export * from "./lib/dbmodels/UserStreaks"
12
12
  export * from "./lib/dbmodels/Badge"
13
+ export * from "./lib/dbmodels/Program"
14
+ export * from "./lib/dbmodels/Workout"
15
+ export * from "./lib/dbmodels/Exercise"
16
+ export * from "./lib/dbmodels/Superset"
13
17
 
14
18
  //Utils
15
19
  export * from "./lib/utils/Logger"
@@ -16,7 +16,7 @@ export class Badge extends Model {
16
16
  @Column({ type: DataType.TEXT, allowNull: false })
17
17
  declare title: string;
18
18
 
19
- @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })
19
+ @Column({ type: DataType.ARRAY(DataType.TEXT), allowNull: false })
20
20
  declare tags: string;
21
21
 
22
22
  @Column({ type: DataType.TEXT, allowNull: false })
@@ -0,0 +1,53 @@
1
+ import {
2
+ BelongsTo,
3
+ Column,
4
+ DataType,
5
+ Default,
6
+ ForeignKey,
7
+ Index,
8
+ Model,
9
+ Table,
10
+ } from "sequelize-typescript";
11
+ import { Workout } from "./Workout";
12
+ import type {Progress, ReducedExercise} from "../models/ExerciseInterfaces";
13
+
14
+ @Table
15
+ export class Exercise extends Model<Exercise> implements ReducedExercise {
16
+ @Default(DataType.UUIDV4)
17
+ @Column({
18
+ type: DataType.UUID,
19
+ defaultValue: DataType.UUID,
20
+ allowNull: false,
21
+ primaryKey: true,
22
+ })
23
+ declare uuid: string;
24
+
25
+ @Column({ type: DataType.STRING, allowNull: false })
26
+ declare name: string;
27
+
28
+ @Column({ type: DataType.INTEGER, allowNull: false })
29
+ declare order: number;
30
+
31
+ @Column({ type: DataType.ARRAY(DataType.JSONB), allowNull: true })
32
+ declare progress: Progress[];
33
+
34
+ @Column({ type: DataType.TEXT, allowNull: false })
35
+ declare reps: string;
36
+
37
+ @Column({ type: DataType.TEXT, allowNull: false })
38
+ declare sets: string;
39
+
40
+ @Column({ type: DataType.TEXT, allowNull: true })
41
+ declare restTime: string;
42
+
43
+ @ForeignKey(() => Workout)
44
+ @Index
45
+ @Column({
46
+ type: DataType.UUID,
47
+ allowNull: true,
48
+ })
49
+ declare workoutUuid: string;
50
+
51
+ @BelongsTo(() => Workout)
52
+ declare workout: Workout;
53
+ }
@@ -0,0 +1,46 @@
1
+ import { Workout } from "./Workout";
2
+ import {
3
+ BeforeDestroy,
4
+ Column,
5
+ DataType,
6
+ Default,
7
+ HasMany,
8
+ Model,
9
+ Table,
10
+ } from "sequelize-typescript";
11
+
12
+ @Table
13
+ export class Program extends Model<Program> {
14
+ @Default(DataType.UUIDV4)
15
+ @Column({
16
+ type: DataType.UUID,
17
+ defaultValue: DataType.UUID,
18
+ allowNull: false,
19
+ primaryKey: true,
20
+ })
21
+ declare programId: string;
22
+
23
+ @Column({ type: DataType.UUID, allowNull: false })
24
+ declare userUuid: string;
25
+
26
+ @HasMany(() => Workout, { foreignKey: "programId", onDelete: "CASCADE" })
27
+ declare workout: Workout[];
28
+
29
+ @Column({ type: DataType.TEXT, allowNull: false })
30
+ declare startDate: string;
31
+
32
+ @Column({ type: DataType.TEXT, allowNull: true })
33
+ declare programType: string;
34
+
35
+ @Column({ type: DataType.DATE, allowNull: true })
36
+ declare createdAt: Date;
37
+
38
+ @BeforeDestroy
39
+ static async deleteRelatedWorkouts(instance: Program) {
40
+ const workouts = await instance.$get("workout", { scope: "workout" });
41
+
42
+ for (const workout of workouts) {
43
+ await workout.destroy();
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,27 @@
1
+
2
+ import {Column, DataType, Default, ForeignKey, Index, Model, Table} from "sequelize-typescript";
3
+ import { Workout } from "./Workout";
4
+ import type {ReducedExercise} from "../models/ExerciseInterfaces";
5
+
6
+ @Table
7
+ export class Superset extends Model<Superset> {
8
+ @Default(DataType.UUIDV4)
9
+ @Column({
10
+ type: DataType.UUID,
11
+ defaultValue: DataType.UUID,
12
+ allowNull: false,
13
+ primaryKey: true,
14
+ })
15
+ declare uuid: string;
16
+
17
+ @Column({ type: DataType.INTEGER, allowNull: false })
18
+ declare startPosition: number;
19
+
20
+ @ForeignKey(() => Workout)
21
+ @Index
22
+ declare workoutUuid: string;
23
+
24
+ @Column({ type: DataType.ARRAY(DataType.JSONB), allowNull: false })
25
+ declare exercises: ReducedExercise[];
26
+
27
+ }
@@ -1,6 +1,7 @@
1
1
  import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from "sequelize-typescript";
2
2
  import { Badge } from "./Badge";
3
3
  import { PersistedUser } from "./PersistedUser";
4
+ import {Program} from "./Program";
4
5
 
5
6
  @Table({
6
7
  timestamps: true,
@@ -19,6 +20,14 @@ import { PersistedUser } from "./PersistedUser";
19
20
  })
20
21
  declare badgeUuid: string;
21
22
 
23
+ @ForeignKey(() => Program)
24
+ @Column({
25
+ type: DataType.UUID,
26
+ allowNull: true,
27
+ })
28
+ declare programInstanceUuid?: string;
29
+
30
+
22
31
  @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 1})
23
32
  declare timesEarned: number;
24
33
 
@@ -30,4 +39,7 @@ import { PersistedUser } from "./PersistedUser";
30
39
 
31
40
  @BelongsTo(() => Badge)
32
41
  declare badge: Badge;
42
+
43
+ @BelongsTo(() => Program)
44
+ declare programInstance?: Program;
33
45
  }
@@ -0,0 +1,46 @@
1
+ import { Superset } from './Superset';
2
+ import {
3
+ Column,
4
+ DataType,
5
+ Default,
6
+ ForeignKey,
7
+ HasMany, Index,
8
+ Model,
9
+ Table
10
+ } from 'sequelize-typescript';
11
+ import { Program } from './Program';
12
+ import {Exercise} from "./Exercise";
13
+
14
+ @Table
15
+ export class Workout extends Model<Workout> {
16
+ @Default(DataType.UUIDV4)
17
+ @Column({
18
+ type: DataType.UUID,
19
+ defaultValue: DataType.UUID,
20
+ allowNull: false,
21
+ primaryKey: true
22
+ })
23
+ declare uuid: string;
24
+
25
+ @Column({ type: DataType.BOOLEAN, allowNull: false })
26
+ declare isFinished: boolean;
27
+
28
+ @Column({ type: DataType.TEXT, allowNull: false })
29
+ declare title: string;
30
+
31
+ @Column({ type: DataType.TEXT, allowNull: false })
32
+ declare duration: string;
33
+
34
+ @Column({ type: DataType.INTEGER, allowNull: true })
35
+ declare order: number;
36
+
37
+ @HasMany(() => Exercise, { foreignKey: 'workoutUuid', onDelete: 'CASCADE' })
38
+ declare exercise: Exercise[];
39
+
40
+ @HasMany(() => Superset, { foreignKey: 'workoutUuid', onDelete: 'CASCADE' })
41
+ declare superset: Superset[];
42
+
43
+ @ForeignKey(() => Program)
44
+ @Index
45
+ declare programId: string;
46
+ }
@@ -1,37 +1,27 @@
1
- import type { ProgramBlueprint } from "./BlueprintInterfaces";
1
+ export type ProgramTypes =
2
+ | "BodyweightHomeWorkout"
3
+ | "BodyweightOnlyBodyweight"
4
+ | "BodyweightWeightedCali"
5
+ | "Weights"
6
+ | "Both";
2
7
 
3
- export interface ExerciseModel {
4
- uuid: string;
5
- name: string;
6
- level: string[];
7
- isCompound: boolean;
8
- needsEquipment: boolean;
9
- hasPriority: boolean;
10
- hasVariations: boolean;
11
- variations: object;
12
- muscles: string[];
13
- homeWorkout: boolean;
8
+ export interface GraphProgress extends Progress {
9
+ date: string;
14
10
  }
15
- export interface ExerciseProgressRequest {
16
- exerciseUuid: string;
17
- reps: string;
18
- weight: string;
11
+ export interface Progress {
12
+ [key: string]: number | string | undefined;
19
13
  }
20
- export interface ExerciseProgressGetRequest {
21
- exerciseUuid: string;
14
+ export interface ExerciseOptions {
15
+ sets: string;
16
+ reps: string;
17
+ order: number;
22
18
  }
23
- export interface ExerciseBlueprint {
24
- uuid: string;
25
- hasPriority: boolean;
26
- isCompound: boolean;
27
- homeWorkout: boolean;
28
- needsEquipment: boolean;
29
- isSuperset: boolean;
30
- isFixed: boolean;
31
- muscle: string;
32
- rir: number;
33
- order: number;
34
- reps: string;
35
- sets: string;
36
- program: ProgramBlueprint;
19
+ export interface ReducedExercise {
20
+ uuid: string;
21
+ name: string;
22
+ order: number;
23
+ progress: Progress[];
24
+ sets: string;
25
+ reps: string;
26
+ restTime?: string;
37
27
  }