90dc-core 1.9.5 → 1.9.6

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.
@@ -3,8 +3,10 @@ import { RestDay } from "./RestDay.js";
3
3
  import { ChallengeBlueprint } from "./ChallengeBlueprint.js";
4
4
  import { CustomStrengthTest } from "./CustomStrengthTest.js";
5
5
  import { CustomWorkoutBlueprint } from "./CustomWorkoutBlueprint.js";
6
+ import { PersistedUser } from "../PersistedUser.js";
6
7
  export declare class CustomProgramBlueprint extends Model {
7
8
  uuid: string;
9
+ createdBy: string;
8
10
  title: string;
9
11
  level: string;
10
12
  numberOfDays: number;
@@ -12,4 +14,5 @@ export declare class CustomProgramBlueprint extends Model {
12
14
  restDays: RestDay[];
13
15
  challenges: ChallengeBlueprint[];
14
16
  strengthTests: CustomStrengthTest[];
17
+ user: PersistedUser;
15
18
  }
@@ -4,11 +4,12 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { Column, DataType, Default, HasMany, Model, Table } from "sequelize-typescript";
7
+ import { BelongsTo, Column, DataType, Default, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
8
8
  import { RestDay } from "./RestDay.js";
9
9
  import { ChallengeBlueprint } from "./ChallengeBlueprint.js";
10
10
  import { CustomStrengthTest } from "./CustomStrengthTest.js";
11
11
  import { CustomWorkoutBlueprint } from "./CustomWorkoutBlueprint.js";
12
+ import { PersistedUser } from "../PersistedUser.js";
12
13
  export let CustomProgramBlueprint = class CustomProgramBlueprint extends Model {
13
14
  };
14
15
  __decorate([
@@ -20,6 +21,13 @@ __decorate([
20
21
  primaryKey: true
21
22
  })
22
23
  ], CustomProgramBlueprint.prototype, "uuid", void 0);
24
+ __decorate([
25
+ ForeignKey(()=>PersistedUser),
26
+ Column({
27
+ type: DataType.UUID,
28
+ allowNull: true
29
+ })
30
+ ], CustomProgramBlueprint.prototype, "createdBy", void 0);
23
31
  __decorate([
24
32
  Column({
25
33
  type: DataType.STRING,
@@ -59,6 +67,9 @@ __decorate([
59
67
  foreignKey: "blueprintUuid"
60
68
  })
61
69
  ], CustomProgramBlueprint.prototype, "strengthTests", void 0);
70
+ __decorate([
71
+ BelongsTo(()=>PersistedUser)
72
+ ], CustomProgramBlueprint.prototype, "user", void 0);
62
73
  CustomProgramBlueprint = __decorate([
63
74
  Table
64
75
  ], CustomProgramBlueprint);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/dbmodels/program/CustomProgramBlueprint.ts"],"sourcesContent":["import {\n Column,\n DataType,\n Default,\n HasMany, Index,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport {RestDay} from \"./RestDay.js\";\nimport {ChallengeBlueprint} from \"./ChallengeBlueprint.js\";\nimport {CustomStrengthTest} from \"./CustomStrengthTest.js\";\nimport {CustomWorkoutBlueprint} from \"./CustomWorkoutBlueprint.js\";\n\n@Table\nexport class CustomProgramBlueprint 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.STRING, allowNull: false, unique: true })\n declare title: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare level: string;\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare numberOfDays: number;\n\n @HasMany(() => CustomWorkoutBlueprint, { foreignKey: \"blueprintUuid\" })\n declare workouts: CustomWorkoutBlueprint[];\n\n @HasMany(() => RestDay, { foreignKey: \"blueprintUuid\" })\n declare restDays: RestDay[];\n\n @HasMany(() => ChallengeBlueprint, { foreignKey: \"blueprintUuid\" })\n declare challenges: ChallengeBlueprint[];\n\n @HasMany(() => CustomStrengthTest, { foreignKey: \"blueprintUuid\" })\n declare strengthTests: CustomStrengthTest[];\n}\n"],"names":["Column","DataType","Default","HasMany","Model","Table","RestDay","ChallengeBlueprint","CustomStrengthTest","CustomWorkoutBlueprint","CustomProgramBlueprint","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","unique","INTEGER","foreignKey"],"mappings":";;;;;;AAAA,SACIA,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,KAAK,QACF,uBAAuB;AAC9B,SAAQC,OAAO,QAAO,eAAe;AACrC,SAAQC,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,sBAAsB,QAAO,8BAA8B;AAGnE,WAAaC,yBAAN,qCAAqCN;AA8B5C,EAAC;;IA7BIF,QAAQD,SAASU,MAAM;IACvBX,OAAO;QACJY,MAAMX,SAASY,IAAI;QACnBC,cAAcb,SAASY,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IACpB;GAPSN;;IAURV,OAAO;QAAEY,MAAMX,SAASgB,MAAM;QAAEF,WAAW,KAAK;QAAEG,QAAQ,IAAI;IAAC;GAVvDR;;IAaRV,OAAO;QAAEY,MAAMX,SAASgB,MAAM;QAAEF,WAAW,KAAK;IAAC;GAbzCL;;IAgBRV,OAAO;QAAEY,MAAMX,SAASkB,OAAO;QAAEJ,WAAW,KAAK;IAAC;GAhB1CL;;IAmBRP,QAAQ,IAAMM,wBAAwB;QAAEW,YAAY;IAAgB;GAnB5DV;;IAsBRP,QAAQ,IAAMG,SAAS;QAAEc,YAAY;IAAgB;GAtB7CV;;IAyBRP,QAAQ,IAAMI,oBAAoB;QAAEa,YAAY;IAAgB;GAzBxDV;;IA4BRP,QAAQ,IAAMK,oBAAoB;QAAEY,YAAY;IAAgB;GA5BxDV;AAAAA;IADZL;GACYK"}
1
+ {"version":3,"sources":["../../../../src/lib/dbmodels/program/CustomProgramBlueprint.ts"],"sourcesContent":["import {\n BelongsTo,\n Column,\n DataType,\n Default, ForeignKey,\n HasMany, Index,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport {RestDay} from \"./RestDay.js\";\nimport {ChallengeBlueprint} from \"./ChallengeBlueprint.js\";\nimport {CustomStrengthTest} from \"./CustomStrengthTest.js\";\nimport {CustomWorkoutBlueprint} from \"./CustomWorkoutBlueprint.js\";\nimport {PersistedUser} from \"../PersistedUser.js\";\n\n@Table\nexport class CustomProgramBlueprint 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 @ForeignKey(() => PersistedUser)\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare createdBy: string;\n\n @Column({ type: DataType.STRING, allowNull: false, unique: true })\n declare title: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare level: string;\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare numberOfDays: number;\n\n @HasMany(() => CustomWorkoutBlueprint, { foreignKey: \"blueprintUuid\" })\n declare workouts: CustomWorkoutBlueprint[];\n\n @HasMany(() => RestDay, { foreignKey: \"blueprintUuid\" })\n declare restDays: RestDay[];\n\n @HasMany(() => ChallengeBlueprint, { foreignKey: \"blueprintUuid\" })\n declare challenges: ChallengeBlueprint[];\n\n @HasMany(() => CustomStrengthTest, { foreignKey: \"blueprintUuid\" })\n declare strengthTests: CustomStrengthTest[];\n\n @BelongsTo(() => PersistedUser)\n declare user: PersistedUser;\n}\n"],"names":["BelongsTo","Column","DataType","Default","ForeignKey","HasMany","Model","Table","RestDay","ChallengeBlueprint","CustomStrengthTest","CustomWorkoutBlueprint","PersistedUser","CustomProgramBlueprint","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","unique","INTEGER","foreignKey"],"mappings":";;;;;;AAAA,SACIA,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,OAAO,EAAEC,UAAU,EACnBC,OAAO,EACPC,KAAK,EACLC,KAAK,QACF,uBAAuB;AAC9B,SAAQC,OAAO,QAAO,eAAe;AACrC,SAAQC,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,sBAAsB,QAAO,8BAA8B;AACnE,SAAQC,aAAa,QAAO,sBAAsB;AAGlD,WAAaC,yBAAN,qCAAqCP;AAwC5C,EAAC;;IAvCIH,QAAQD,SAASY,MAAM;IACvBb,OAAO;QACJc,MAAMb,SAASc,IAAI;QACnBC,cAAcf,SAASc,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IACpB;GAPSN;;IAURT,WAAW,IAAMQ;IACjBX,OAAO;QACJc,MAAMb,SAASc,IAAI;QACnBE,WAAW,IAAI;IACnB;GAdSL;;IAiBRZ,OAAO;QAAEc,MAAMb,SAASkB,MAAM;QAAEF,WAAW,KAAK;QAAEG,QAAQ,IAAI;IAAC;GAjBvDR;;IAoBRZ,OAAO;QAAEc,MAAMb,SAASkB,MAAM;QAAEF,WAAW,KAAK;IAAC;GApBzCL;;IAuBRZ,OAAO;QAAEc,MAAMb,SAASoB,OAAO;QAAEJ,WAAW,KAAK;IAAC;GAvB1CL;;IA0BRR,QAAQ,IAAMM,wBAAwB;QAAEY,YAAY;IAAgB;GA1B5DV;;IA6BRR,QAAQ,IAAMG,SAAS;QAAEe,YAAY;IAAgB;GA7B7CV;;IAgCRR,QAAQ,IAAMI,oBAAoB;QAAEc,YAAY;IAAgB;GAhCxDV;;IAmCRR,QAAQ,IAAMK,oBAAoB;QAAEa,YAAY;IAAgB;GAnCxDV;;IAsCRb,UAAU,IAAMY;GAtCRC;AAAAA;IADZN;GACYM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,7 +1,8 @@
1
1
  import {
2
+ BelongsTo,
2
3
  Column,
3
4
  DataType,
4
- Default,
5
+ Default, ForeignKey,
5
6
  HasMany, Index,
6
7
  Model,
7
8
  Table,
@@ -10,6 +11,7 @@ import {RestDay} from "./RestDay.js";
10
11
  import {ChallengeBlueprint} from "./ChallengeBlueprint.js";
11
12
  import {CustomStrengthTest} from "./CustomStrengthTest.js";
12
13
  import {CustomWorkoutBlueprint} from "./CustomWorkoutBlueprint.js";
14
+ import {PersistedUser} from "../PersistedUser.js";
13
15
 
14
16
  @Table
15
17
  export class CustomProgramBlueprint extends Model {
@@ -22,6 +24,13 @@ export class CustomProgramBlueprint extends Model {
22
24
  })
23
25
  declare uuid: string;
24
26
 
27
+ @ForeignKey(() => PersistedUser)
28
+ @Column({
29
+ type: DataType.UUID,
30
+ allowNull: true,
31
+ })
32
+ declare createdBy: string;
33
+
25
34
  @Column({ type: DataType.STRING, allowNull: false, unique: true })
26
35
  declare title: string;
27
36
 
@@ -42,4 +51,7 @@ export class CustomProgramBlueprint extends Model {
42
51
 
43
52
  @HasMany(() => CustomStrengthTest, { foreignKey: "blueprintUuid" })
44
53
  declare strengthTests: CustomStrengthTest[];
54
+
55
+ @BelongsTo(() => PersistedUser)
56
+ declare user: PersistedUser;
45
57
  }