90dc-core 1.6.3 → 1.6.4

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
@@ -11,4 +11,6 @@ export * from "./lib/dbmodels/program/Program";
11
11
  export * from "./lib/dbmodels/program/Workout";
12
12
  export * from "./lib/dbmodels/program/Exercise";
13
13
  export * from "./lib/dbmodels/program/Superset";
14
+ export * from "./lib/dbmodels/Subscription";
15
+ export * from "./lib/dbmodels/SubscriptionLog";
14
16
  export * from "./lib/utils/Logger";
package/dist/index.js CHANGED
@@ -13,6 +13,8 @@ export * from "./lib/dbmodels/program/Program";
13
13
  export * from "./lib/dbmodels/program/Workout";
14
14
  export * from "./lib/dbmodels/program/Exercise";
15
15
  export * from "./lib/dbmodels/program/Superset";
16
+ export * from "./lib/dbmodels/Subscription";
17
+ export * from "./lib/dbmodels/SubscriptionLog";
16
18
  //Utils
17
19
  export * from "./lib/utils/Logger";
18
20
 
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\"\nexport * from \"./lib/dbmodels/program/Program\"\nexport * from \"./lib/dbmodels/program/Workout\"\nexport * from \"./lib/dbmodels/program/Exercise\"\nexport * from \"./lib/dbmodels/program/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,iCAAgC;AAC9C,cAAc,iCAAgC;AAC9C,cAAc,kCAAiC;AAC/C,cAAc,kCAAiC;AAE/C,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/Program\"\nexport * from \"./lib/dbmodels/program/Workout\"\nexport * from \"./lib/dbmodels/program/Exercise\"\nexport * from \"./lib/dbmodels/program/Superset\"\nexport * from \"./lib/dbmodels/Subscription\"\nexport * from \"./lib/dbmodels/SubscriptionLog\"\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,iCAAgC;AAC9C,cAAc,iCAAgC;AAC9C,cAAc,kCAAiC;AAC/C,cAAc,kCAAiC;AAC/C,cAAc,8BAA6B;AAC3C,cAAc,iCAAgC;AAE9C,OAAO;AACP,cAAc,qBAAoB"}
@@ -1,5 +1,5 @@
1
1
  import { Model } from "sequelize-typescript";
2
- import type { Subscription } from "../models/UserInterfaces";
2
+ import type { Subscription } from "./Subscription";
3
3
  export declare class PersistedUser extends Model {
4
4
  userUuid: string;
5
5
  email: string;
@@ -4,7 +4,7 @@ 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, Index, Model, Table } from "sequelize-typescript";
7
+ import { Column, DataType, Default, HasOne, Index, Model, Table } from "sequelize-typescript";
8
8
  export let PersistedUser = class PersistedUser extends Model {
9
9
  };
10
10
  __decorate([
@@ -181,10 +181,7 @@ __decorate([
181
181
  })
182
182
  ], PersistedUser.prototype, "changeUtilityEmail", void 0);
183
183
  __decorate([
184
- Column({
185
- type: DataType.JSONB,
186
- allowNull: true
187
- })
184
+ HasOne(()=>PersistedUser)
188
185
  ], PersistedUser.prototype, "subscription", void 0);
189
186
  PersistedUser = __decorate([
190
187
  Table
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Index, Model, Table } from \"sequelize-typescript\";\nimport type { Subscription } from \"../models/UserInterfaces\";\n\n@Table\nexport class PersistedUser extends Model {\n\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare gotParentalConsent: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: true })\n declare subscription: Subscription;\n}\n"],"names":["Column","DataType","Default","Index","Model","Table","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,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AAK;QAAEL,WAAW,IAAI;IAAC;GA7FrCL;AAAAA;IADZD;GACYC"}
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import {BelongsTo, Column, DataType, Default, HasOne, Index, Model, Table} from \"sequelize-typescript\";\nimport type { Subscription } from \"./Subscription\";\n\n@Table\nexport class PersistedUser extends Model {\n\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare gotParentalConsent: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @HasOne(() => PersistedUser)\n declare subscription: Subscription;\n}\n"],"names":["Column","DataType","Default","HasOne","Index","Model","Table","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN"],"mappings":";;;;;;AAAA,SAAmBA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAIvG,WAAaC,gBAAN,4BAA4BF;AA+FnC,EAAC;;IA7FEH,QAAQD,SAASO,MAAM;IACvBR,OAAO;QACNS,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GARWN;;IAWVH;IACAJ,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;QAAEG,QAAQ,KAAK;IAAC;GAZpDR;;IAeVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAfrCL;;IAkBVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,IAAI;IAAC;GAlBpCL;;IAqBVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,IAAI;IAAC;GArBpCL;;IAwBVP,OA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AASa,IAAI;QAAEF,WAAW,IAAI;IAAC;GAxEpCL;;IA2EVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,IAAI;IAAC;GA3EpCL;;IA8EVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,IAAI;IAAC;GA9EpCL;;IAiFVP,OAAO;QAAES,MAAMR,SAASe,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAjFvCL;;IAoFVP,OAAO;QAAES,MAAMR,SAASe,OAAO;QAAEJ,WAAW,IAAI;IAAC;GApFvCL;;IAuFVP,OAAO;QAAES,MAAMR,SAASe,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAvFvCL;;IA0FVP,OAAO;QAAES,MAAMR,SAASe,OAAO;QAAEJ,WAAW,IAAI;IAAC;GA1FvCL;;IA6FVJ,OAAO,IAAMI;GA7FHA;AAAAA;IADZD;GACYC"}
@@ -0,0 +1,14 @@
1
+ import { Model } from "sequelize-typescript";
2
+ import { SubscriptionLog } from "./SubscriptionLog";
3
+ import { PersistedUser } from "./PersistedUser";
4
+ export declare class Subscription extends Model {
5
+ userUuid: string;
6
+ identifier: string;
7
+ platform: "google" | "apple" | "mollie";
8
+ status: "active" | "canceled" | "expired";
9
+ type: string;
10
+ expiresOn: Date;
11
+ startDate: Date;
12
+ user: PersistedUser;
13
+ subscriptionLogs: SubscriptionLog[];
14
+ }
@@ -0,0 +1,67 @@
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, ForeignKey, HasMany, Model, PrimaryKey, Table } from "sequelize-typescript";
8
+ import { SubscriptionLog } from "./SubscriptionLog";
9
+ import { PersistedUser } from "./PersistedUser";
10
+ export let Subscription = class Subscription extends Model {
11
+ };
12
+ __decorate([
13
+ ForeignKey(()=>PersistedUser),
14
+ PrimaryKey,
15
+ Column({
16
+ type: DataType.UUID,
17
+ allowNull: false,
18
+ primaryKey: true
19
+ })
20
+ ], Subscription.prototype, "userUuid", void 0);
21
+ __decorate([
22
+ Column({
23
+ type: DataType.TEXT,
24
+ allowNull: false
25
+ })
26
+ ], Subscription.prototype, "identifier", void 0);
27
+ __decorate([
28
+ Column({
29
+ type: DataType.TEXT,
30
+ allowNull: false
31
+ })
32
+ ], Subscription.prototype, "platform", void 0);
33
+ __decorate([
34
+ Column({
35
+ type: DataType.TEXT,
36
+ allowNull: false
37
+ })
38
+ ], Subscription.prototype, "status", void 0);
39
+ __decorate([
40
+ Column({
41
+ type: DataType.TEXT,
42
+ allowNull: false
43
+ })
44
+ ], Subscription.prototype, "type", void 0);
45
+ __decorate([
46
+ Column({
47
+ type: DataType.DATE,
48
+ allowNull: false
49
+ })
50
+ ], Subscription.prototype, "expiresOn", void 0);
51
+ __decorate([
52
+ Column({
53
+ type: DataType.DATE,
54
+ allowNull: false
55
+ })
56
+ ], Subscription.prototype, "startDate", void 0);
57
+ __decorate([
58
+ BelongsTo(()=>PersistedUser)
59
+ ], Subscription.prototype, "user", void 0);
60
+ __decorate([
61
+ HasMany(()=>SubscriptionLog)
62
+ ], Subscription.prototype, "subscriptionLogs", void 0);
63
+ Subscription = __decorate([
64
+ Table
65
+ ], Subscription);
66
+
67
+ //# sourceMappingURL=Subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/Subscription.ts"],"sourcesContent":["import {\n BelongsTo,\n Column,\n DataType,\n ForeignKey,\n HasMany,\n Model,\n PrimaryKey,\n Table,\n} from \"sequelize-typescript\";\nimport { SubscriptionLog } from \"./SubscriptionLog\";\nimport {PersistedUser} from \"./PersistedUser\";\n\n@Table\nexport class Subscription extends Model {\n @ForeignKey(() => PersistedUser)\n @PrimaryKey\n @Column({\n type: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare userUuid: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare identifier: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare platform: \"google\" | \"apple\" | \"mollie\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare status: \"active\" | \"canceled\" | \"expired\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare type: string;\n\n @Column({ type: DataType.DATE, allowNull: false })\n declare expiresOn: Date;\n\n @Column({ type: DataType.DATE, allowNull: false })\n declare startDate: Date;\n\n @BelongsTo(() => PersistedUser)\n declare user: PersistedUser;\n\n @HasMany(() => SubscriptionLog)\n declare subscriptionLogs: SubscriptionLog[];\n}\n"],"names":["BelongsTo","Column","DataType","ForeignKey","HasMany","Model","PrimaryKey","Table","SubscriptionLog","PersistedUser","Subscription","type","UUID","allowNull","primaryKey","TEXT","DATE"],"mappings":";;;;;;AAAA,SACEA,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,KAAK,EACLC,UAAU,EACVC,KAAK,QACA,uBAAuB;AAC9B,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAAQC,aAAa,QAAO,kBAAkB;AAG9C,WAAaC,eAAN,2BAA2BL;AAiClC,EAAC;;IAhCEF,WAAW,IAAMM;IACjBH;IACAL,OAAO;QACNU,MAAMT,SAASU,IAAI;QACnBC,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GAPWJ;;IAUVT,OAAO;QAAEU,MAAMT,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAVrCH;;IAaVT,OAAO;QAAEU,MAAMT,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAbrCH;;IAgBVT,OAAO;QAAEU,MAAMT,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAhBrCH;;IAmBVT,OAAO;QAAEU,MAAMT,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAnBrCH;;IAsBVT,OAAO;QAAEU,MAAMT,SAASc,IAAI;QAAEH,WAAW,KAAK;IAAC;GAtBrCH;;IAyBVT,OAAO;QAAEU,MAAMT,SAASc,IAAI;QAAEH,WAAW,KAAK;IAAC;GAzBrCH;;IA4BVV,UAAU,IAAMS;GA5BNC;;IA+BVN,QAAQ,IAAMI;GA/BJE;AAAAA;IADZH;GACYG"}
@@ -0,0 +1,8 @@
1
+ import { Model } from "sequelize-typescript";
2
+ import { Subscription } from "./Subscription";
3
+ export declare class SubscriptionLog extends Model {
4
+ uuid: string;
5
+ subscriptionUuid: string;
6
+ action: string;
7
+ subscription: Subscription;
8
+ }
@@ -0,0 +1,42 @@
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, Table } from "sequelize-typescript";
8
+ import { Subscription } from "./Subscription";
9
+ export let SubscriptionLog = class SubscriptionLog 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
+ ], SubscriptionLog.prototype, "uuid", void 0);
20
+ __decorate([
21
+ ForeignKey(()=>Subscription),
22
+ Column({
23
+ type: DataType.UUID,
24
+ allowNull: false
25
+ })
26
+ ], SubscriptionLog.prototype, "subscriptionUuid", void 0);
27
+ __decorate([
28
+ Column({
29
+ type: DataType.TEXT,
30
+ allowNull: false
31
+ })
32
+ ], SubscriptionLog.prototype, "action", void 0);
33
+ __decorate([
34
+ BelongsTo(()=>Subscription)
35
+ ], SubscriptionLog.prototype, "subscription", void 0);
36
+ SubscriptionLog = __decorate([
37
+ Table({
38
+ timestamps: true
39
+ })
40
+ ], SubscriptionLog);
41
+
42
+ //# sourceMappingURL=SubscriptionLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/SubscriptionLog.ts"],"sourcesContent":["import {\n BelongsTo,\n Column,\n DataType,\n Default,\n ForeignKey,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport { Subscription } from \"./Subscription\";\n\n@Table({ timestamps: true })\nexport class SubscriptionLog 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(() => Subscription)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare subscriptionUuid: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare action: string;\n\n @BelongsTo(() => Subscription)\n declare subscription: Subscription;\n}\n"],"names":["BelongsTo","Column","DataType","Default","ForeignKey","Model","Table","Subscription","SubscriptionLog","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","timestamps"],"mappings":";;;;;;AAAA,SACEA,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,iBAAiB;AAG9C,WAAaC,kBAAN,8BAA8BH;AAsBrC,EAAC;;IArBEF,QAAQD,SAASO,MAAM;IACvBR,OAAO;QACNS,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GAPWN;;IAUVJ,WAAW,IAAMG;IACjBN,OAAO;QACNS,MAAMR,SAASS,IAAI;QACnBE,WAAW,KAAK;IAClB;GAdWL;;IAiBVP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAjBrCL;;IAoBVR,UAAU,IAAMO;GApBNC;AAAAA;IADZF,MAAM;QAAEU,YAAY,IAAI;IAAC;GACbR"}
@@ -23,10 +23,6 @@ export interface UserInfoModel {
23
23
  height: string;
24
24
  weight: string;
25
25
  }
26
- export interface Subscription {
27
- type: "android" | "ios";
28
- [key: string]: string;
29
- }
30
26
  export interface SingleTransactionResponse {
31
27
  revision: string;
32
28
  bundleId: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["import type jwt from \"jsonwebtoken\";\n\nexport interface UserTypes {\n userUuid: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: string;\n role: string;\n}\n\nexport interface VerificationStatus {\n status: string;\n}\n\nexport interface TransactionsResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactions: string[];\n errorCode?: number;\n}\n\nexport interface UserInfoModel {\n userUuid: string;\n height: string;\n weight: string;\n}\n\nexport interface Subscription {\n type: \"android\" | \"ios\",\n [key: string]: string;\n}\n\nexport interface SingleTransactionResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactionInfo: string;\n errorCode?: number;\n}\n\nexport interface SubscriptionStatus {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string;\n signedRenewalInfo: string;\n}\n\nexport interface SubscriptionStatusResponse {\n environment: string;\n bundleId: string;\n data: [\n {\n subscriptionGroupIdentifier: string;\n lastTransactions: SubscriptionStatus[];\n }\n ];\n errorCode?: number;\n}\n\nexport interface SubscriptionStatusResponseError {\n errorCode: number;\n errorMessage: string;\n}\n\nexport interface SubscriptionStatusResult {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string | jwt.JwtPayload | null;\n signedRenewalInfo: string | jwt.JwtPayload | null;\n}\n\nexport interface SignedTransactions {\n transactionId: string;\n originalTransactionId: string;\n webOrderLineItemId: string;\n bundleId: string;\n productId: string;\n subscriptionGroupIdentifier: string;\n purchaseDate: number;\n originalPurchaseDate: number;\n expiresDate: number;\n quantity: number;\n type: string;\n inAppOwnershipType: string;\n signedDate: number;\n environment: string;\n transactionReason: string;\n storefront: string;\n storefrontId: string;\n}\n\nexport interface Credentials {\n refresh_token?: string | null,\n expiry_date?: number | null,\n access_token?: string | null,\n token_type?: string | null ,\n id_token?: string | null,\n scope?: string\n}\n\n\nexport interface LoginRequest {\n email: string;\n password: string;\n}\n\nexport interface UserPhotoRequest {\n base64: string;\n}\n\nexport interface ProgressPhoto {\n date: Date;\n progressPhoto: string;\n userUuid: string;\n}\n\nexport interface ForgotPassword {\n uuid: string;\n userUuid: string;\n token: string;\n date: Date;\n}\n\nexport interface RefreshPayload {\n userUuid: string;\n}\n\nexport interface TokenRequest {\n token: string;\n}\n\nexport interface RefreshRequest {\n refreshToken: string;\n}\n\nexport interface UuidRequest {\n userUuid: string;\n}\n\nexport interface EmailRequest {\n email: string;\n}\n\nexport interface TitleRequest {\n title: string;\n}\n\nexport interface UserPhoto {\n base64: string;\n title: string;\n}\n\nexport default interface AuthenticationToken {\n type: string;\n contents: string;\n}\n\nexport interface RestorePasswordRequest {\n email: string;\n}\n\nexport interface BeforeSubscriptionOptions {\n firstName: string;\n lastName: string;\n sex: string;\n goal: string;\n weightGoal: string;\n level: string;\n type: string;\n days: number;\n}\n\nexport interface AfterSubscriptionOptions {\n dateOfBirth: string;\n metricSystem: string;\n height: string;\n weight: string;\n}\n"],"names":[],"mappings":"AAAA,WAqLC"}
1
+ {"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["import type jwt from \"jsonwebtoken\";\n\nexport interface UserTypes {\n userUuid: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: string;\n role: string;\n}\n\nexport interface VerificationStatus {\n status: string;\n}\n\nexport interface TransactionsResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactions: string[];\n errorCode?: number;\n}\n\nexport interface UserInfoModel {\n userUuid: string;\n height: string;\n weight: string;\n}\n\nexport interface SingleTransactionResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactionInfo: string;\n errorCode?: number;\n}\n\nexport interface SubscriptionStatus {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string;\n signedRenewalInfo: string;\n}\n\nexport interface SubscriptionStatusResponse {\n environment: string;\n bundleId: string;\n data: [\n {\n subscriptionGroupIdentifier: string;\n lastTransactions: SubscriptionStatus[];\n }\n ];\n errorCode?: number;\n}\n\nexport interface SubscriptionStatusResponseError {\n errorCode: number;\n errorMessage: string;\n}\n\nexport interface SubscriptionStatusResult {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string | jwt.JwtPayload | null;\n signedRenewalInfo: string | jwt.JwtPayload | null;\n}\n\nexport interface SignedTransactions {\n transactionId: string;\n originalTransactionId: string;\n webOrderLineItemId: string;\n bundleId: string;\n productId: string;\n subscriptionGroupIdentifier: string;\n purchaseDate: number;\n originalPurchaseDate: number;\n expiresDate: number;\n quantity: number;\n type: string;\n inAppOwnershipType: string;\n signedDate: number;\n environment: string;\n transactionReason: string;\n storefront: string;\n storefrontId: string;\n}\n\nexport interface Credentials {\n refresh_token?: string | null,\n expiry_date?: number | null,\n access_token?: string | null,\n token_type?: string | null ,\n id_token?: string | null,\n scope?: string\n}\n\n\nexport interface LoginRequest {\n email: string;\n password: string;\n}\n\nexport interface UserPhotoRequest {\n base64: string;\n}\n\nexport interface ProgressPhoto {\n date: Date;\n progressPhoto: string;\n userUuid: string;\n}\n\nexport interface ForgotPassword {\n uuid: string;\n userUuid: string;\n token: string;\n date: Date;\n}\n\nexport interface RefreshPayload {\n userUuid: string;\n}\n\nexport interface TokenRequest {\n token: string;\n}\n\nexport interface RefreshRequest {\n refreshToken: string;\n}\n\nexport interface UuidRequest {\n userUuid: string;\n}\n\nexport interface EmailRequest {\n email: string;\n}\n\nexport interface TitleRequest {\n title: string;\n}\n\nexport interface UserPhoto {\n base64: string;\n title: string;\n}\n\nexport default interface AuthenticationToken {\n type: string;\n contents: string;\n}\n\nexport interface RestorePasswordRequest {\n email: string;\n}\n\nexport interface BeforeSubscriptionOptions {\n firstName: string;\n lastName: string;\n sex: string;\n goal: string;\n weightGoal: string;\n level: string;\n type: string;\n days: number;\n}\n\nexport interface AfterSubscriptionOptions {\n dateOfBirth: string;\n metricSystem: string;\n height: string;\n weight: string;\n}\n"],"names":[],"mappings":"AAAA,WAgLC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
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
@@ -14,6 +14,8 @@ export * from "./lib/dbmodels/program/Program"
14
14
  export * from "./lib/dbmodels/program/Workout"
15
15
  export * from "./lib/dbmodels/program/Exercise"
16
16
  export * from "./lib/dbmodels/program/Superset"
17
+ export * from "./lib/dbmodels/Subscription"
18
+ export * from "./lib/dbmodels/SubscriptionLog"
17
19
 
18
20
  //Utils
19
21
  export * from "./lib/utils/Logger"
@@ -1,5 +1,5 @@
1
- import { Column, DataType, Default, Index, Model, Table } from "sequelize-typescript";
2
- import type { Subscription } from "../models/UserInterfaces";
1
+ import {BelongsTo, Column, DataType, Default, HasOne, Index, Model, Table} from "sequelize-typescript";
2
+ import type { Subscription } from "./Subscription";
3
3
 
4
4
  @Table
5
5
  export class PersistedUser extends Model {
@@ -95,6 +95,6 @@ export class PersistedUser extends Model {
95
95
  @Column({ type: DataType.BOOLEAN, allowNull: true })
96
96
  declare changeUtilityEmail: boolean;
97
97
 
98
- @Column({ type: DataType.JSONB, allowNull: true })
98
+ @HasOne(() => PersistedUser)
99
99
  declare subscription: Subscription;
100
100
  }
@@ -0,0 +1,48 @@
1
+ import {
2
+ BelongsTo,
3
+ Column,
4
+ DataType,
5
+ ForeignKey,
6
+ HasMany,
7
+ Model,
8
+ PrimaryKey,
9
+ Table,
10
+ } from "sequelize-typescript";
11
+ import { SubscriptionLog } from "./SubscriptionLog";
12
+ import {PersistedUser} from "./PersistedUser";
13
+
14
+ @Table
15
+ export class Subscription extends Model {
16
+ @ForeignKey(() => PersistedUser)
17
+ @PrimaryKey
18
+ @Column({
19
+ type: DataType.UUID,
20
+ allowNull: false,
21
+ primaryKey: true,
22
+ })
23
+ declare userUuid: string;
24
+
25
+ @Column({ type: DataType.TEXT, allowNull: false })
26
+ declare identifier: string;
27
+
28
+ @Column({ type: DataType.TEXT, allowNull: false })
29
+ declare platform: "google" | "apple" | "mollie";
30
+
31
+ @Column({ type: DataType.TEXT, allowNull: false })
32
+ declare status: "active" | "canceled" | "expired";
33
+
34
+ @Column({ type: DataType.TEXT, allowNull: false })
35
+ declare type: string;
36
+
37
+ @Column({ type: DataType.DATE, allowNull: false })
38
+ declare expiresOn: Date;
39
+
40
+ @Column({ type: DataType.DATE, allowNull: false })
41
+ declare startDate: Date;
42
+
43
+ @BelongsTo(() => PersistedUser)
44
+ declare user: PersistedUser;
45
+
46
+ @HasMany(() => SubscriptionLog)
47
+ declare subscriptionLogs: SubscriptionLog[];
48
+ }
@@ -0,0 +1,35 @@
1
+ import {
2
+ BelongsTo,
3
+ Column,
4
+ DataType,
5
+ Default,
6
+ ForeignKey,
7
+ Model,
8
+ Table,
9
+ } from "sequelize-typescript";
10
+ import { Subscription } from "./Subscription";
11
+
12
+ @Table({ timestamps: true })
13
+ export class SubscriptionLog extends Model {
14
+ @Default(DataType.UUIDV4)
15
+ @Column({
16
+ type: DataType.UUID,
17
+ defaultValue: DataType.UUID,
18
+ allowNull: false,
19
+ primaryKey: true,
20
+ })
21
+ declare uuid: string;
22
+
23
+ @ForeignKey(() => Subscription)
24
+ @Column({
25
+ type: DataType.UUID,
26
+ allowNull: false,
27
+ })
28
+ declare subscriptionUuid: string;
29
+
30
+ @Column({ type: DataType.TEXT, allowNull: false })
31
+ declare action: string;
32
+
33
+ @BelongsTo(() => Subscription)
34
+ declare subscription: Subscription;
35
+ }
@@ -28,11 +28,6 @@ export interface UserInfoModel {
28
28
  weight: string;
29
29
  }
30
30
 
31
- export interface Subscription {
32
- type: "android" | "ios",
33
- [key: string]: string;
34
- }
35
-
36
31
  export interface SingleTransactionResponse {
37
32
  revision: string;
38
33
  bundleId: string;