90dc-core 1.4.1 → 1.5.2

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.js CHANGED
@@ -6,6 +6,9 @@ export * from "./lib/models/UserInterfaces";
6
6
  //DB Models
7
7
  export * from "./lib/dbmodels/UsersFriends";
8
8
  export * from "./lib/dbmodels/PersistedUser";
9
+ export * from "./lib/dbmodels/UserBadges";
10
+ export * from "./lib/dbmodels/UserStreaks";
11
+ export * from "./lib/dbmodels/Badge";
9
12
  //Utils
10
13
  export * from "./lib/utils/Logger";
11
14
 
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\"\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;AAE5C,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\"\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"}
@@ -0,0 +1,52 @@
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 { BelongsToMany, Column, DataType, Default, Model, Table } from "sequelize-typescript";
8
+ import { UserBadges } from "./UserBadges";
9
+ import { PersistedUser } from "./PersistedUser";
10
+ export let Badge = class Badge extends Model {
11
+ };
12
+ __decorate([
13
+ Default(DataType.UUIDV4),
14
+ Column({
15
+ type: DataType.UUID,
16
+ defaultValue: DataType.UUID,
17
+ allowNull: false,
18
+ primaryKey: true
19
+ })
20
+ ], Badge.prototype, "uuid", void 0);
21
+ __decorate([
22
+ Column({
23
+ type: DataType.TEXT,
24
+ allowNull: false
25
+ })
26
+ ], Badge.prototype, "title", void 0);
27
+ __decorate([
28
+ Column({
29
+ type: DataType.TEXT,
30
+ allowNull: false
31
+ })
32
+ ], Badge.prototype, "description", void 0);
33
+ __decorate([
34
+ Column({
35
+ type: DataType.DOUBLE,
36
+ allowNull: false
37
+ })
38
+ ], Badge.prototype, "rarityPercentage", void 0);
39
+ __decorate([
40
+ Column({
41
+ type: DataType.TEXT,
42
+ allowNull: false
43
+ })
44
+ ], Badge.prototype, "rarityType", void 0);
45
+ __decorate([
46
+ BelongsToMany(()=>PersistedUser, ()=>UserBadges)
47
+ ], Badge.prototype, "users", void 0);
48
+ Badge = __decorate([
49
+ Table
50
+ ], Badge);
51
+
52
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +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.TEXT, allowNull: false })\n declare description: string;\n\n @Column({ type: DataType.DOUBLE, allowNull: false })\n declare rarityPercentage: number\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare rarityType: 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","DOUBLE"],"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,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAbvCL;;IAgBRP,OAAO;QAAES,MAAMR,SAASc,MAAM;QAAEH,WAAW,KAAK;IAAC;GAhBzCL;;IAmBRP,OAAO;QAAES,MAAMR,SAASa,IAAI;QAAEF,WAAW,KAAK;IAAC;GAnBvCL;;IAsBRR,cAAc,IAAMO,eAAe,IAAMD;GAtBjCE;AAAAA;IADZH;GACYG"}
@@ -4,7 +4,10 @@ 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 { BelongsToMany, Column, DataType, Default, HasOne, Index, Model, Table } from "sequelize-typescript";
8
+ import { Badge } from "./Badge";
9
+ import { UserBadges } from "./UserBadges";
10
+ import { UserStreak } from "./UserStreaks";
8
11
  export let PersistedUser = class PersistedUser extends Model {
9
12
  };
10
13
  __decorate([
@@ -186,6 +189,12 @@ __decorate([
186
189
  allowNull: true
187
190
  })
188
191
  ], PersistedUser.prototype, "subscription", void 0);
192
+ __decorate([
193
+ BelongsToMany(()=>Badge, ()=>UserBadges)
194
+ ], PersistedUser.prototype, "badges", void 0);
195
+ __decorate([
196
+ HasOne(()=>UserStreak)
197
+ ], PersistedUser.prototype, "userStreak", void 0);
189
198
  PersistedUser = __decorate([
190
199
  Table
191
200
  ], PersistedUser);
@@ -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}\n"],"names":["Column","DataType","Default","Index","Model","Table","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAItF,WAAaC,gBAAN,4BAA4BF;AAgGnC,EAAC;;IA9FEF,QAAQD,SAASM,MAAM;IACvBP,OAAO;QACNQ,MAAMP,SAASQ,IAAI;QACnBC,cAAcT,SAASQ,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GARWN;;IAWVH;IACAH,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,KAAK;QAAEG,QAAQ,KAAK;IAAC;GAZpDR;;IAeVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,KAAK;IAAC;GAfrCL;;IAkBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GAlBpCL;;IAqBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GArBpCL;;IAwBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GAxBpCL;;IA2BVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GA3BpCL;;IA8BVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GA9Bp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W,IAAI;IAAC;GA9EpCL;;IAiFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAjFvCL;;IAoFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GApFvCL;;IAuFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAvFvCL;;IA0FVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GA1FvCL;;IA6FVN,OAAO;QAAEQ,MAAMP,SAASe,KAAK;QAAEL,WAAW,IAAI;IAAC;GA7FrCL;AAAAA;IADZD;GACYC"}
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { BelongsToMany, Column, DataType, Default, HasOne, Index, Model, Table } from \"sequelize-typescript\";\nimport type { Subscription } from \"../models/UserInterfaces\";\nimport { Badge } from \"./Badge\";\nimport { UserBadges } from \"./UserBadges\";\nimport { UserStreak } from \"./UserStreaks\";\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 @BelongsToMany(() => Badge, () => UserBadges)\n declare badges: Badge[];\n\n @HasOne(() => UserStreak)\n declare userStreak: UserStreak;\n}\n"],"names":["BelongsToMany","Column","DataType","Default","HasOne","Index","Model","Table","Badge","UserBadges","UserStreak","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,SAASA,aAAa,EAAEC,MAAM,EAAEC,QAAQ,EAAE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AAO;QAAEJ,WAAW,IAAI;IAAC;GA1FvCL;;IA6FVV,OAAO;QAAEY,MAAMX,SAASmB,KAAK;QAAEL,WAAW,IAAI;IAAC;GA7FrCL;;IAgGVX,cAAc,IAAMQ,OAAO,IAAMC;GAhGvBE;;IAmGVP,OAAO,IAAMM;GAnGHC;AAAAA;IADZJ;GACYI"}
@@ -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, ForeignKey, Model, Table } from "sequelize-typescript";
8
+ import { Badge } from "./Badge";
9
+ import { PersistedUser } from "./PersistedUser";
10
+ export let UserBadges = class UserBadges extends Model {
11
+ };
12
+ __decorate([
13
+ ForeignKey(()=>PersistedUser),
14
+ Column({
15
+ type: DataType.UUID,
16
+ allowNull: false
17
+ })
18
+ ], UserBadges.prototype, "userUuid", void 0);
19
+ __decorate([
20
+ ForeignKey(()=>Badge),
21
+ Column({
22
+ type: DataType.UUID,
23
+ allowNull: false
24
+ }),
25
+ Column({
26
+ type: DataType.TEXT,
27
+ allowNull: false
28
+ })
29
+ ], UserBadges.prototype, "badgeUuid", void 0);
30
+ __decorate([
31
+ BelongsTo(()=>PersistedUser)
32
+ ], UserBadges.prototype, "user", void 0);
33
+ __decorate([
34
+ BelongsTo(()=>Badge)
35
+ ], UserBadges.prototype, "badge", void 0);
36
+ UserBadges = __decorate([
37
+ Table({
38
+ timestamps: true
39
+ })
40
+ ], UserBadges);
41
+
42
+ //# sourceMappingURL=UserBadges.js.map
@@ -0,0 +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 @Column({ type: DataType.TEXT, allowNull: false })\n declare badgeUuid: string;\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","TEXT","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;AAqBlC,EAAC;;IApBID,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;IACCV,OAAO;QAAEQ,MAAMP,SAASU,IAAI;QAAED,WAAW,KAAK;IAAC;GAbrCH;;IAgBVR,UAAU,IAAMO;GAhBNC;;IAmBVR,UAAU,IAAMM;GAnBNE;AAAAA;IAFdH,MAAM;QACHQ,YAAY,IAAI;IACpB;GAAeL"}
@@ -0,0 +1,45 @@
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 { Table, Column, Model, ForeignKey, DataType, BelongsTo } from "sequelize-typescript";
8
+ import { PersistedUser } from "./PersistedUser";
9
+ export let UserStreak = class UserStreak extends Model {
10
+ };
11
+ __decorate([
12
+ ForeignKey(()=>PersistedUser),
13
+ Column({
14
+ type: DataType.UUID,
15
+ allowNull: false
16
+ })
17
+ ], UserStreak.prototype, "userUuid", void 0);
18
+ __decorate([
19
+ Column({
20
+ type: DataType.INTEGER,
21
+ defaultValue: 0
22
+ })
23
+ ], UserStreak.prototype, "currentStreak", void 0);
24
+ __decorate([
25
+ Column({
26
+ type: DataType.INTEGER,
27
+ defaultValue: 0
28
+ })
29
+ ], UserStreak.prototype, "longestStreak", void 0);
30
+ __decorate([
31
+ Column({
32
+ type: DataType.DATE,
33
+ allowNull: true
34
+ })
35
+ ], UserStreak.prototype, "lastOpenedAt", void 0);
36
+ __decorate([
37
+ BelongsTo(()=>PersistedUser)
38
+ ], UserStreak.prototype, "user", void 0);
39
+ UserStreak = __decorate([
40
+ Table({
41
+ timestamps: true
42
+ })
43
+ ], UserStreak);
44
+
45
+ //# sourceMappingURL=UserStreaks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/UserStreaks.ts"],"sourcesContent":["import { Table, Column, Model, ForeignKey, DataType, BelongsTo } from 'sequelize-typescript';\nimport { PersistedUser } from \"./PersistedUser\";\n\n@Table({\n timestamps: true,\n})\nexport class UserStreak extends Model {\n @ForeignKey(() => PersistedUser)\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userUuid: string;\n\n @Column({\n type: DataType.INTEGER,\n defaultValue: 0,\n })\n declare currentStreak: number;\n\n @Column({\n type: DataType.INTEGER,\n defaultValue: 0,\n })\n declare longestStreak: number;\n\n @Column({\n type: DataType.DATE,\n allowNull: true,\n })\n declare lastOpenedAt: Date | null;\n\n @BelongsTo(() => PersistedUser)\n declare user: PersistedUser;\n}\n"],"names":["Table","Column","Model","ForeignKey","DataType","BelongsTo","PersistedUser","UserStreak","type","UUID","allowNull","INTEGER","defaultValue","DATE","timestamps"],"mappings":";;;;;;AAAA,SAASA,KAAK,EAAEC,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AAC7F,SAASC,aAAa,QAAQ,kBAAkB;AAKhD,WAAaC,aAAN,yBAAyBL;AA4BhC,EAAC;;IA3BEC,WAAW,IAAMG;IACjBL,OAAO;QACNO,MAAMJ,SAASK,IAAI;QACnBC,WAAW,KAAK;IAClB;GALWH;;IAQVN,OAAO;QACNO,MAAMJ,SAASO,OAAO;QACtBC,cAAc;IAChB;GAXWL;;IAcVN,OAAO;QACNO,MAAMJ,SAASO,OAAO;QACtBC,cAAc;IAChB;GAjBWL;;IAoBVN,OAAO;QACNO,MAAMJ,SAASS,IAAI;QACnBH,WAAW,IAAI;IACjB;GAvBWH;;IA0BVF,UAAU,IAAMC;GA1BNC;AAAAA;IAHZP,MAAM;QACLc,YAAY,IAAI;IAClB;GACaP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.4.1",
3
+ "version": "1.5.2",
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
@@ -7,6 +7,9 @@ export * from "./lib/models/UserInterfaces";
7
7
  //DB Models
8
8
  export * from "./lib/dbmodels/UsersFriends"
9
9
  export * from "./lib/dbmodels/PersistedUser"
10
+ export * from "./lib/dbmodels/UserBadges"
11
+ export * from "./lib/dbmodels/UserStreaks"
12
+ export * from "./lib/dbmodels/Badge"
10
13
 
11
14
  //Utils
12
15
  export * from "./lib/utils/Logger"
@@ -0,0 +1,30 @@
1
+ import { BelongsToMany, Column, DataType, Default, Model, Table } from "sequelize-typescript";
2
+ import { UserBadges } from "./UserBadges";
3
+ import { PersistedUser } from "./PersistedUser";
4
+
5
+ @Table
6
+ export class Badge extends Model {
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.TEXT, allowNull: false })
17
+ declare title: string;
18
+
19
+ @Column({ type: DataType.TEXT, allowNull: false })
20
+ declare description: string;
21
+
22
+ @Column({ type: DataType.DOUBLE, allowNull: false })
23
+ declare rarityPercentage: number
24
+
25
+ @Column({ type: DataType.TEXT, allowNull: false })
26
+ declare rarityType: string;
27
+
28
+ @BelongsToMany(() => PersistedUser, () => UserBadges)
29
+ declare users: PersistedUser[];
30
+ }
@@ -1,5 +1,8 @@
1
- import { Column, DataType, Default, Index, Model, Table } from "sequelize-typescript";
1
+ import { BelongsToMany, Column, DataType, Default, HasOne, Index, Model, Table } from "sequelize-typescript";
2
2
  import type { Subscription } from "../models/UserInterfaces";
3
+ import { Badge } from "./Badge";
4
+ import { UserBadges } from "./UserBadges";
5
+ import { UserStreak } from "./UserStreaks";
3
6
 
4
7
  @Table
5
8
  export class PersistedUser extends Model {
@@ -98,4 +101,9 @@ export class PersistedUser extends Model {
98
101
  @Column({ type: DataType.JSONB, allowNull: true })
99
102
  declare subscription: Subscription;
100
103
 
104
+ @BelongsToMany(() => Badge, () => UserBadges)
105
+ declare badges: Badge[];
106
+
107
+ @HasOne(() => UserStreak)
108
+ declare userStreak: UserStreak;
101
109
  }
@@ -0,0 +1,28 @@
1
+ import { BelongsTo, Column, DataType, ForeignKey, Model, Table } from "sequelize-typescript";
2
+ import { Badge } from "./Badge";
3
+ import { PersistedUser } from "./PersistedUser";
4
+
5
+ @Table({
6
+ timestamps: true,
7
+ })export class UserBadges extends Model {
8
+ @ForeignKey(() => PersistedUser)
9
+ @Column({
10
+ type: DataType.UUID,
11
+ allowNull: false,
12
+ })
13
+ declare userUuid: string;
14
+
15
+ @ForeignKey(() => Badge)
16
+ @Column({
17
+ type: DataType.UUID,
18
+ allowNull: false,
19
+ })
20
+ @Column({ type: DataType.TEXT, allowNull: false })
21
+ declare badgeUuid: string;
22
+
23
+ @BelongsTo(() => PersistedUser)
24
+ declare user: PersistedUser;
25
+
26
+ @BelongsTo(() => Badge)
27
+ declare badge: Badge;
28
+ }
@@ -0,0 +1,35 @@
1
+ import { Table, Column, Model, ForeignKey, DataType, BelongsTo } from 'sequelize-typescript';
2
+ import { PersistedUser } from "./PersistedUser";
3
+
4
+ @Table({
5
+ timestamps: true,
6
+ })
7
+ export class UserStreak extends Model {
8
+ @ForeignKey(() => PersistedUser)
9
+ @Column({
10
+ type: DataType.UUID,
11
+ allowNull: false,
12
+ })
13
+ declare userUuid: string;
14
+
15
+ @Column({
16
+ type: DataType.INTEGER,
17
+ defaultValue: 0,
18
+ })
19
+ declare currentStreak: number;
20
+
21
+ @Column({
22
+ type: DataType.INTEGER,
23
+ defaultValue: 0,
24
+ })
25
+ declare longestStreak: number;
26
+
27
+ @Column({
28
+ type: DataType.DATE,
29
+ allowNull: true,
30
+ })
31
+ declare lastOpenedAt: Date | null;
32
+
33
+ @BelongsTo(() => PersistedUser)
34
+ declare user: PersistedUser;
35
+ }