90dc-core 1.9.5 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/dbmodels/PersistedUser.d.ts +4 -0
- package/dist/lib/dbmodels/PersistedUser.js +27 -0
- package/dist/lib/dbmodels/PersistedUser.js.map +1 -1
- package/dist/lib/dbmodels/UsersFriends.d.ts +7 -3
- package/dist/lib/dbmodels/UsersFriends.js +19 -5
- package/dist/lib/dbmodels/UsersFriends.js.map +1 -1
- package/dist/lib/dbmodels/program/CustomProgramBlueprint.d.ts +3 -0
- package/dist/lib/dbmodels/program/CustomProgramBlueprint.js +12 -1
- package/dist/lib/dbmodels/program/CustomProgramBlueprint.js.map +1 -1
- package/dist/lib/dbmodels/xpAndLeaderboards/UserRankHistory.d.ts +10 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/UserRankHistory.js +48 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/UserRankHistory.js.map +1 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpEvent.d.ts +9 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpEvent.js +53 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpEvent.js.map +1 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpTransaction.d.ts +14 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpTransaction.js +68 -0
- package/dist/lib/dbmodels/xpAndLeaderboards/XpTransaction.js.map +1 -0
- package/package.json +1 -1
- package/src/lib/dbmodels/PersistedUser.ts +12 -0
- package/src/lib/dbmodels/UsersFriends.ts +18 -13
- package/src/lib/dbmodels/program/CustomProgramBlueprint.ts +13 -1
- package/src/lib/dbmodels/xpAndLeaderboards/UserRankHistory.ts +24 -0
- package/src/lib/dbmodels/xpAndLeaderboards/XpEvent.ts +23 -0
- package/src/lib/dbmodels/xpAndLeaderboards/XpTransaction.ts +36 -0
|
@@ -30,6 +30,10 @@ export declare class PersistedUser extends Model {
|
|
|
30
30
|
utilityEmailConfirmed: boolean;
|
|
31
31
|
changeEmail: boolean;
|
|
32
32
|
changeUtilityEmail: boolean;
|
|
33
|
+
totalXp: number;
|
|
34
|
+
weeklyXp: number;
|
|
35
|
+
monthlyXp: number;
|
|
36
|
+
country?: string;
|
|
33
37
|
subscription: Subscription;
|
|
34
38
|
nonConsumablePrograms: NonConsumableProgram[];
|
|
35
39
|
coachUuid?: string;
|
|
@@ -183,6 +183,33 @@ __decorate([
|
|
|
183
183
|
allowNull: true
|
|
184
184
|
})
|
|
185
185
|
], PersistedUser.prototype, "changeUtilityEmail", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
Column({
|
|
188
|
+
type: DataType.INTEGER,
|
|
189
|
+
allowNull: false,
|
|
190
|
+
defaultValue: 0
|
|
191
|
+
})
|
|
192
|
+
], PersistedUser.prototype, "totalXp", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
Column({
|
|
195
|
+
type: DataType.INTEGER,
|
|
196
|
+
allowNull: false,
|
|
197
|
+
defaultValue: 0
|
|
198
|
+
})
|
|
199
|
+
], PersistedUser.prototype, "weeklyXp", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
Column({
|
|
202
|
+
type: DataType.INTEGER,
|
|
203
|
+
allowNull: false,
|
|
204
|
+
defaultValue: 0
|
|
205
|
+
})
|
|
206
|
+
], PersistedUser.prototype, "monthlyXp", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
Column({
|
|
209
|
+
type: DataType.TEXT,
|
|
210
|
+
allowNull: true
|
|
211
|
+
})
|
|
212
|
+
], PersistedUser.prototype, "country", void 0);
|
|
186
213
|
__decorate([
|
|
187
214
|
HasOne(()=>Subscription)
|
|
188
215
|
], PersistedUser.prototype, "subscription", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import {\n BelongsTo,\n BelongsToMany,\n Column,\n DataType,\n Default,\n HasMany,\n HasOne,\n Index,\n Model,\n Table\n} from \"sequelize-typescript\";\nimport { Subscription } from \"./Subscription\";\nimport {UserPrograms} from \"./nonconsprogram/UserNonConsumableProgram\";\nimport {NonConsumableProgram} from \"./nonconsprogram/NonConsumableProgram\";\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(() => Subscription)\n declare subscription: Subscription;\n\n @BelongsToMany(() => NonConsumableProgram, { through: () => UserPrograms })\n declare nonConsumablePrograms: NonConsumableProgram[];\n\n @Column({ type: DataType.UUID, allowNull: true })\n declare coachUuid?: string;\n\n @BelongsTo(() => PersistedUser, 'coachUuid')\n declare coach?: PersistedUser;\n\n @HasMany(() => PersistedUser, 'coachUuid')\n declare clients?: PersistedUser[];\n}\n"],"names":["BelongsTo","BelongsToMany","Column","DataType","Default","HasMany","HasOne","Index","Model","Table","Subscription","UserPrograms","NonConsumableProgram","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","through"],"mappings":";;;;;;AAAA,SACEA,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAC9B,SAAUC,YAAY,QAAQ,iBAAiB;AAC/C,SAAQC,YAAY,QAAO,4CAA4C;AACvE,SAAQC,oBAAoB,QAAO,wCAAwC;AAG3E,WAAaC,gBAAN,4BAA4BL;
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import {\n BelongsTo,\n BelongsToMany,\n Column,\n DataType,\n Default,\n HasMany,\n HasOne,\n Index,\n Model,\n Table\n} from \"sequelize-typescript\";\nimport { Subscription } from \"./Subscription\";\nimport {UserPrograms} from \"./nonconsprogram/UserNonConsumableProgram\";\nimport {NonConsumableProgram} from \"./nonconsprogram/NonConsumableProgram\";\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.INTEGER, allowNull: false, defaultValue: 0 })\n declare totalXp: number;\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })\n declare weeklyXp: number;\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })\n declare monthlyXp: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare country?: string;\n\n @HasOne(() => Subscription)\n declare subscription: Subscription;\n\n @BelongsToMany(() => NonConsumableProgram, { through: () => UserPrograms })\n declare nonConsumablePrograms: NonConsumableProgram[];\n\n @Column({ type: DataType.UUID, allowNull: true })\n declare coachUuid?: string;\n\n @BelongsTo(() => PersistedUser, 'coachUuid')\n declare coach?: PersistedUser;\n\n @HasMany(() => PersistedUser, 'coachUuid')\n declare clients?: PersistedUser[];\n}\n"],"names":["BelongsTo","BelongsToMany","Column","DataType","Default","HasMany","HasOne","Index","Model","Table","Subscription","UserPrograms","NonConsumableProgram","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","INTEGER","through"],"mappings":"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"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Model } from "sequelize-typescript";
|
|
2
|
+
import { PersistedUser } from "./PersistedUser.js";
|
|
2
3
|
export declare class UsersFriends extends Model {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
userUuid: string;
|
|
5
|
+
friendUuid: string;
|
|
6
|
+
status: 'pending' | 'accepted' | 'rejected';
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
user: PersistedUser;
|
|
9
|
+
friend: PersistedUser;
|
|
6
10
|
}
|
|
@@ -4,7 +4,8 @@ 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, Model, Table } from "sequelize-typescript";
|
|
7
|
+
import { BelongsTo, Column, DataType, Model, Table } from "sequelize-typescript";
|
|
8
|
+
import { PersistedUser } from "./PersistedUser.js";
|
|
8
9
|
export let UsersFriends = class UsersFriends extends Model {
|
|
9
10
|
};
|
|
10
11
|
__decorate([
|
|
@@ -12,19 +13,32 @@ __decorate([
|
|
|
12
13
|
type: DataType.UUID,
|
|
13
14
|
allowNull: false
|
|
14
15
|
})
|
|
15
|
-
], UsersFriends.prototype, "
|
|
16
|
+
], UsersFriends.prototype, "userUuid", void 0);
|
|
16
17
|
__decorate([
|
|
17
18
|
Column({
|
|
18
19
|
type: DataType.UUID,
|
|
19
20
|
allowNull: false
|
|
20
21
|
})
|
|
21
|
-
], UsersFriends.prototype, "
|
|
22
|
+
], UsersFriends.prototype, "friendUuid", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
Column({
|
|
25
|
+
type: DataType.ENUM('pending', 'accepted', 'rejected'),
|
|
26
|
+
defaultValue: 'pending'
|
|
27
|
+
})
|
|
28
|
+
], UsersFriends.prototype, "status", void 0);
|
|
22
29
|
__decorate([
|
|
23
30
|
Column({
|
|
24
31
|
type: DataType.DATE,
|
|
25
|
-
allowNull: false
|
|
32
|
+
allowNull: false,
|
|
33
|
+
defaultValue: DataType.NOW
|
|
26
34
|
})
|
|
27
|
-
], UsersFriends.prototype, "
|
|
35
|
+
], UsersFriends.prototype, "createdAt", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
BelongsTo(()=>PersistedUser, 'userUuid')
|
|
38
|
+
], UsersFriends.prototype, "user", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
BelongsTo(()=>PersistedUser, 'friendUuid')
|
|
41
|
+
], UsersFriends.prototype, "friend", void 0);
|
|
28
42
|
UsersFriends = __decorate([
|
|
29
43
|
Table
|
|
30
44
|
], UsersFriends);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/dbmodels/UsersFriends.ts"],"sourcesContent":["import { Column, DataType, Model, Table
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/dbmodels/UsersFriends.ts"],"sourcesContent":["import {BelongsTo, Column, DataType, Model, Table} from \"sequelize-typescript\";\nimport {PersistedUser} from \"./PersistedUser.js\";\n\n@Table\nexport class UsersFriends extends Model {\n @Column({ type: DataType.UUID, allowNull: false })\n declare userUuid: string;\n\n @Column({ type: DataType.UUID, allowNull: false })\n declare friendUuid: string;\n\n @Column({ type: DataType.ENUM('pending', 'accepted', 'rejected'), defaultValue: 'pending' })\n declare status: 'pending' | 'accepted' | 'rejected';\n\n @Column({ type: DataType.DATE, allowNull: false, defaultValue: DataType.NOW })\n declare createdAt: Date;\n\n @BelongsTo(() => PersistedUser, 'userUuid')\n declare user: PersistedUser;\n\n @BelongsTo(() => PersistedUser, 'friendUuid')\n declare friend: PersistedUser;\n\n}\n"],"names":["BelongsTo","Column","DataType","Model","Table","PersistedUser","UsersFriends","type","UUID","allowNull","ENUM","defaultValue","DATE","NOW"],"mappings":";;;;;;AAAA,SAAQA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAC/E,SAAQC,aAAa,QAAO,qBAAqB;AAGjD,WAAaC,eAAN,2BAA2BH;AAmBlC,EAAC;;IAlBEF,OAAO;QAAEM,MAAML,SAASM,IAAI;QAAEC,WAAW,KAAK;IAAC;GADrCH;;IAIVL,OAAO;QAAEM,MAAML,SAASM,IAAI;QAAEC,WAAW,KAAK;IAAC;GAJrCH;;IAOVL,OAAO;QAAEM,MAAML,SAASQ,IAAI,CAAC,WAAW,YAAY;QAAaC,cAAc;IAAU;GAP/EL;;IAUVL,OAAO;QAAEM,MAAML,SAASU,IAAI;QAAEH,WAAW,KAAK;QAAEE,cAAcT,SAASW,GAAG;IAAC;GAVjEP;;IAaVN,UAAU,IAAMK,eAAe;GAbrBC;;IAgBVN,UAAU,IAAMK,eAAe;GAhBrBC;AAAAA;IADZF;GACYE"}
|
|
@@ -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,
|
|
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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Model } from "sequelize-typescript";
|
|
2
|
+
import { PersistedUser } from "../PersistedUser.js";
|
|
3
|
+
export declare class UserRankHistory extends Model {
|
|
4
|
+
userUuid: string;
|
|
5
|
+
period: 'weekly' | 'monthly' | 'alltime';
|
|
6
|
+
rank: number;
|
|
7
|
+
xp: number;
|
|
8
|
+
recordedAt: Date;
|
|
9
|
+
user: PersistedUser;
|
|
10
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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, Model, Table } from "sequelize-typescript";
|
|
8
|
+
import { PersistedUser } from "../PersistedUser.js";
|
|
9
|
+
export let UserRankHistory = class UserRankHistory extends Model {
|
|
10
|
+
};
|
|
11
|
+
__decorate([
|
|
12
|
+
Column({
|
|
13
|
+
type: DataType.UUID,
|
|
14
|
+
allowNull: false
|
|
15
|
+
})
|
|
16
|
+
], UserRankHistory.prototype, "userUuid", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
Column({
|
|
19
|
+
type: DataType.ENUM('weekly', 'monthly', 'alltime'),
|
|
20
|
+
allowNull: false
|
|
21
|
+
})
|
|
22
|
+
], UserRankHistory.prototype, "period", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
Column({
|
|
25
|
+
type: DataType.INTEGER,
|
|
26
|
+
allowNull: false
|
|
27
|
+
})
|
|
28
|
+
], UserRankHistory.prototype, "rank", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
Column({
|
|
31
|
+
type: DataType.INTEGER,
|
|
32
|
+
allowNull: false
|
|
33
|
+
})
|
|
34
|
+
], UserRankHistory.prototype, "xp", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
Column({
|
|
37
|
+
type: DataType.DATE,
|
|
38
|
+
allowNull: false
|
|
39
|
+
})
|
|
40
|
+
], UserRankHistory.prototype, "recordedAt", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
BelongsTo(()=>PersistedUser, 'userUuid')
|
|
43
|
+
], UserRankHistory.prototype, "user", void 0);
|
|
44
|
+
UserRankHistory = __decorate([
|
|
45
|
+
Table
|
|
46
|
+
], UserRankHistory);
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=UserRankHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/xpAndLeaderboards/UserRankHistory.ts"],"sourcesContent":["import {BelongsTo, Column, DataType, Model, Table} from \"sequelize-typescript\";\nimport {PersistedUser} from \"../PersistedUser.js\";\n\n\n@Table\nexport class UserRankHistory extends Model {\n @Column({ type: DataType.UUID, allowNull: false })\n declare userUuid: string;\n\n @Column({ type: DataType.ENUM('weekly', 'monthly', 'alltime'), allowNull: false })\n declare period: 'weekly' | 'monthly' | 'alltime';\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare rank: number;\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare xp: number;\n\n @Column({ type: DataType.DATE, allowNull: false })\n declare recordedAt: Date;\n\n @BelongsTo(() => PersistedUser, 'userUuid')\n declare user: PersistedUser;\n}"],"names":["BelongsTo","Column","DataType","Model","Table","PersistedUser","UserRankHistory","type","UUID","allowNull","ENUM","INTEGER","DATE"],"mappings":";;;;;;AAAA,SAAQA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAC/E,SAAQC,aAAa,QAAO,sBAAsB;AAIlD,WAAaC,kBAAN,8BAA8BH;AAkBrC,EAAC;;IAjBIF,OAAO;QAAEM,MAAML,SAASM,IAAI;QAAEC,WAAW,KAAK;IAAC;GADvCH;;IAIRL,OAAO;QAAEM,MAAML,SAASQ,IAAI,CAAC,UAAU,WAAW;QAAYD,WAAW,KAAK;IAAC;GAJvEH;;IAORL,OAAO;QAAEM,MAAML,SAASS,OAAO;QAAEF,WAAW,KAAK;IAAC;GAP1CH;;IAURL,OAAO;QAAEM,MAAML,SAASS,OAAO;QAAEF,WAAW,KAAK;IAAC;GAV1CH;;IAaRL,OAAO;QAAEM,MAAML,SAASU,IAAI;QAAEH,WAAW,KAAK;IAAC;GAbvCH;;IAgBRN,UAAU,IAAMK,eAAe;GAhBvBC;AAAAA;IADZF;GACYE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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, Model, Table } from "sequelize-typescript";
|
|
8
|
+
export let XpEvent = class XpEvent extends Model {
|
|
9
|
+
};
|
|
10
|
+
__decorate([
|
|
11
|
+
Default(DataType.UUIDV4),
|
|
12
|
+
Column({
|
|
13
|
+
type: DataType.UUID,
|
|
14
|
+
primaryKey: true
|
|
15
|
+
})
|
|
16
|
+
], XpEvent.prototype, "uuid", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
Column({
|
|
19
|
+
type: DataType.STRING,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
primaryKey: true
|
|
22
|
+
})
|
|
23
|
+
], XpEvent.prototype, "eventName", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
Column({
|
|
26
|
+
type: DataType.INTEGER,
|
|
27
|
+
allowNull: false
|
|
28
|
+
})
|
|
29
|
+
], XpEvent.prototype, "xpReward", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
Column({
|
|
32
|
+
type: DataType.INTEGER,
|
|
33
|
+
allowNull: true
|
|
34
|
+
})
|
|
35
|
+
], XpEvent.prototype, "dailyLimit", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
Column({
|
|
38
|
+
type: DataType.BOOLEAN,
|
|
39
|
+
allowNull: false,
|
|
40
|
+
defaultValue: true
|
|
41
|
+
})
|
|
42
|
+
], XpEvent.prototype, "isActive", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Column({
|
|
45
|
+
type: DataType.TEXT,
|
|
46
|
+
allowNull: true
|
|
47
|
+
})
|
|
48
|
+
], XpEvent.prototype, "description", void 0);
|
|
49
|
+
XpEvent = __decorate([
|
|
50
|
+
Table
|
|
51
|
+
], XpEvent);
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=XpEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/xpAndLeaderboards/XpEvent.ts"],"sourcesContent":["import {Column, DataType, Default, Model, Table} from \"sequelize-typescript\";\n\n@Table\nexport class XpEvent extends Model {\n @Default(DataType.UUIDV4)\n @Column({ type: DataType.UUID, primaryKey: true })\n declare uuid: string;\n\n @Column({ type: DataType.STRING, allowNull: false, primaryKey: true })\n declare eventName: string;\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare xpReward: number;\n\n @Column({ type: DataType.INTEGER, allowNull: true })\n declare dailyLimit?: number;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: true })\n declare isActive: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare description?: string;\n}"],"names":["Column","DataType","Default","Model","Table","XpEvent","UUIDV4","type","UUID","primaryKey","STRING","allowNull","INTEGER","BOOLEAN","defaultValue","TEXT"],"mappings":";;;;;;AAAA,SAAQA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAG7E,WAAaC,UAAN,sBAAsBF;AAmB7B,EAAC;;IAlBID,QAAQD,SAASK,MAAM;IACvBN,OAAO;QAAEO,MAAMN,SAASO,IAAI;QAAEC,YAAY,IAAI;IAAC;GAFvCJ;;IAKRL,OAAO;QAAEO,MAAMN,SAASS,MAAM;QAAEC,WAAW,KAAK;QAAEF,YAAY,IAAI;IAAC;GAL3DJ;;IAQRL,OAAO;QAAEO,MAAMN,SAASW,OAAO;QAAED,WAAW,KAAK;IAAC;GAR1CN;;IAWRL,OAAO;QAAEO,MAAMN,SAASW,OAAO;QAAED,WAAW,IAAI;IAAC;GAXzCN;;IAcRL,OAAO;QAAEO,MAAMN,SAASY,OAAO;QAAEF,WAAW,KAAK;QAAEG,cAAc,IAAI;IAAC;GAd9DT;;IAiBRL,OAAO;QAAEO,MAAMN,SAASc,IAAI;QAAEJ,WAAW,IAAI;IAAC;GAjBtCN;AAAAA;IADZD;GACYC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Model } from "sequelize-typescript";
|
|
2
|
+
import { PersistedUser } from "../PersistedUser.js";
|
|
3
|
+
import { XpEvent } from "./XpEvent.js";
|
|
4
|
+
export declare class XpTransaction extends Model {
|
|
5
|
+
uuid: string;
|
|
6
|
+
userUuid: string;
|
|
7
|
+
eventName: string;
|
|
8
|
+
xpAwarded: number;
|
|
9
|
+
awardedAt: Date;
|
|
10
|
+
metadata?: Record<string, any>;
|
|
11
|
+
status: 'pending' | 'completed' | 'reverted';
|
|
12
|
+
user: PersistedUser;
|
|
13
|
+
event: XpEvent;
|
|
14
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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, Index, Model, Table } from "sequelize-typescript";
|
|
8
|
+
import { PersistedUser } from "../PersistedUser.js";
|
|
9
|
+
import { XpEvent } from "./XpEvent.js";
|
|
10
|
+
export let XpTransaction = class XpTransaction extends Model {
|
|
11
|
+
};
|
|
12
|
+
__decorate([
|
|
13
|
+
Default(DataType.UUIDV4),
|
|
14
|
+
Column({
|
|
15
|
+
type: DataType.UUID,
|
|
16
|
+
primaryKey: true
|
|
17
|
+
})
|
|
18
|
+
], XpTransaction.prototype, "uuid", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
Index,
|
|
21
|
+
Column({
|
|
22
|
+
type: DataType.UUID,
|
|
23
|
+
allowNull: false
|
|
24
|
+
})
|
|
25
|
+
], XpTransaction.prototype, "userUuid", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Index,
|
|
28
|
+
Column({
|
|
29
|
+
type: DataType.STRING,
|
|
30
|
+
allowNull: false
|
|
31
|
+
})
|
|
32
|
+
], XpTransaction.prototype, "eventName", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
Column({
|
|
35
|
+
type: DataType.INTEGER,
|
|
36
|
+
allowNull: false
|
|
37
|
+
})
|
|
38
|
+
], XpTransaction.prototype, "xpAwarded", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Column({
|
|
41
|
+
type: DataType.DATE,
|
|
42
|
+
allowNull: false,
|
|
43
|
+
defaultValue: DataType.NOW
|
|
44
|
+
})
|
|
45
|
+
], XpTransaction.prototype, "awardedAt", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
Column({
|
|
48
|
+
type: DataType.JSON,
|
|
49
|
+
allowNull: true
|
|
50
|
+
})
|
|
51
|
+
], XpTransaction.prototype, "metadata", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Column({
|
|
54
|
+
type: DataType.ENUM('pending', 'completed', 'reverted'),
|
|
55
|
+
defaultValue: 'completed'
|
|
56
|
+
})
|
|
57
|
+
], XpTransaction.prototype, "status", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
BelongsTo(()=>PersistedUser, 'userUuid')
|
|
60
|
+
], XpTransaction.prototype, "user", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
BelongsTo(()=>XpEvent, 'eventName')
|
|
63
|
+
], XpTransaction.prototype, "event", void 0);
|
|
64
|
+
XpTransaction = __decorate([
|
|
65
|
+
Table
|
|
66
|
+
], XpTransaction);
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=XpTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/dbmodels/xpAndLeaderboards/XpTransaction.ts"],"sourcesContent":["import {BelongsTo, Column, DataType, Default, Index, Model, Table} from \"sequelize-typescript\";\nimport {PersistedUser} from \"../PersistedUser.js\";\nimport {XpEvent} from \"./XpEvent.js\";\n\n@Table\nexport class XpTransaction extends Model {\n @Default(DataType.UUIDV4)\n @Column({ type: DataType.UUID, primaryKey: true })\n declare uuid: string;\n\n @Index\n @Column({ type: DataType.UUID, allowNull: false })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.STRING, allowNull: false })\n declare eventName: string;\n\n @Column({ type: DataType.INTEGER, allowNull: false })\n declare xpAwarded: number;\n\n @Column({ type: DataType.DATE, allowNull: false, defaultValue: DataType.NOW })\n declare awardedAt: Date;\n\n @Column({ type: DataType.JSON, allowNull: true })\n declare metadata?: Record<string, any>; // Additional context (workout_id, etc.)\n\n @Column({ type: DataType.ENUM('pending', 'completed', 'reverted'), defaultValue: 'completed' })\n declare status: 'pending' | 'completed' | 'reverted';\n\n @BelongsTo(() => PersistedUser, 'userUuid')\n declare user: PersistedUser;\n\n @BelongsTo(() => XpEvent, 'eventName')\n declare event: XpEvent;\n}"],"names":["BelongsTo","Column","DataType","Default","Index","Model","Table","PersistedUser","XpEvent","XpTransaction","UUIDV4","type","UUID","primaryKey","allowNull","STRING","INTEGER","DATE","defaultValue","NOW","JSON","ENUM"],"mappings":";;;;;;AAAA,SAAQA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAO,uBAAuB;AAC/F,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,OAAO,QAAO,eAAe;AAGrC,WAAaC,gBAAN,4BAA4BJ;AA8BnC,EAAC;;IA7BIF,QAAQD,SAASQ,MAAM;IACvBT,OAAO;QAAEU,MAAMT,SAASU,IAAI;QAAEC,YAAY,IAAI;IAAC;GAFvCJ;;IAKRL;IACAH,OAAO;QAAEU,MAAMT,SAASU,IAAI;QAAEE,WAAW,KAAK;IAAC;GANvCL;;IASRL;IACAH,OAAO;QAAEU,MAAMT,SAASa,MAAM;QAAED,WAAW,KAAK;IAAC;GAVzCL;;IAaRR,OAAO;QAAEU,MAAMT,SAASc,OAAO;QAAEF,WAAW,KAAK;IAAC;GAb1CL;;IAgBRR,OAAO;QAAEU,MAAMT,SAASe,IAAI;QAAEH,WAAW,KAAK;QAAEI,cAAchB,SAASiB,GAAG;IAAC;GAhBnEV;;IAmBRR,OAAO;QAAEU,MAAMT,SAASkB,IAAI;QAAEN,WAAW,IAAI;IAAC;GAnBtCL;;IAsBRR,OAAO;QAAEU,MAAMT,SAASmB,IAAI,CAAC,WAAW,aAAa;QAAaH,cAAc;IAAY;GAtBpFT;;IAyBRT,UAAU,IAAMO,eAAe;GAzBvBE;;IA4BRT,UAAU,IAAMQ,SAAS;GA5BjBC;AAAAA;IADZH;GACYG"}
|
package/package.json
CHANGED
|
@@ -108,6 +108,18 @@ export class PersistedUser extends Model {
|
|
|
108
108
|
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
109
109
|
declare changeUtilityEmail: boolean;
|
|
110
110
|
|
|
111
|
+
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
|
|
112
|
+
declare totalXp: number;
|
|
113
|
+
|
|
114
|
+
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
|
|
115
|
+
declare weeklyXp: number;
|
|
116
|
+
|
|
117
|
+
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
|
|
118
|
+
declare monthlyXp: number;
|
|
119
|
+
|
|
120
|
+
@Column({ type: DataType.TEXT, allowNull: true })
|
|
121
|
+
declare country?: string;
|
|
122
|
+
|
|
111
123
|
@HasOne(() => Subscription)
|
|
112
124
|
declare subscription: Subscription;
|
|
113
125
|
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { Column, DataType, Model, Table
|
|
1
|
+
import {BelongsTo, Column, DataType, Model, Table} from "sequelize-typescript";
|
|
2
|
+
import {PersistedUser} from "./PersistedUser.js";
|
|
2
3
|
|
|
3
4
|
@Table
|
|
4
5
|
export class UsersFriends extends Model {
|
|
5
|
-
@Column({
|
|
6
|
-
|
|
7
|
-
allowNull: false,
|
|
8
|
-
})
|
|
9
|
-
declare userId: string;
|
|
6
|
+
@Column({ type: DataType.UUID, allowNull: false })
|
|
7
|
+
declare userUuid: string;
|
|
10
8
|
|
|
11
|
-
@Column({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
declare
|
|
9
|
+
@Column({ type: DataType.UUID, allowNull: false })
|
|
10
|
+
declare friendUuid: string;
|
|
11
|
+
|
|
12
|
+
@Column({ type: DataType.ENUM('pending', 'accepted', 'rejected'), defaultValue: 'pending' })
|
|
13
|
+
declare status: 'pending' | 'accepted' | 'rejected';
|
|
14
|
+
|
|
15
|
+
@Column({ type: DataType.DATE, allowNull: false, defaultValue: DataType.NOW })
|
|
16
|
+
declare createdAt: Date;
|
|
17
|
+
|
|
18
|
+
@BelongsTo(() => PersistedUser, 'userUuid')
|
|
19
|
+
declare user: PersistedUser;
|
|
20
|
+
|
|
21
|
+
@BelongsTo(() => PersistedUser, 'friendUuid')
|
|
22
|
+
declare friend: PersistedUser;
|
|
16
23
|
|
|
17
|
-
@Column({ type: DataType.DATE, allowNull: false })
|
|
18
|
-
declare createDate: Date;
|
|
19
24
|
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {BelongsTo, Column, DataType, Model, Table} from "sequelize-typescript";
|
|
2
|
+
import {PersistedUser} from "../PersistedUser.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@Table
|
|
6
|
+
export class UserRankHistory extends Model {
|
|
7
|
+
@Column({ type: DataType.UUID, allowNull: false })
|
|
8
|
+
declare userUuid: string;
|
|
9
|
+
|
|
10
|
+
@Column({ type: DataType.ENUM('weekly', 'monthly', 'alltime'), allowNull: false })
|
|
11
|
+
declare period: 'weekly' | 'monthly' | 'alltime';
|
|
12
|
+
|
|
13
|
+
@Column({ type: DataType.INTEGER, allowNull: false })
|
|
14
|
+
declare rank: number;
|
|
15
|
+
|
|
16
|
+
@Column({ type: DataType.INTEGER, allowNull: false })
|
|
17
|
+
declare xp: number;
|
|
18
|
+
|
|
19
|
+
@Column({ type: DataType.DATE, allowNull: false })
|
|
20
|
+
declare recordedAt: Date;
|
|
21
|
+
|
|
22
|
+
@BelongsTo(() => PersistedUser, 'userUuid')
|
|
23
|
+
declare user: PersistedUser;
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {Column, DataType, Default, Model, Table} from "sequelize-typescript";
|
|
2
|
+
|
|
3
|
+
@Table
|
|
4
|
+
export class XpEvent extends Model {
|
|
5
|
+
@Default(DataType.UUIDV4)
|
|
6
|
+
@Column({ type: DataType.UUID, primaryKey: true })
|
|
7
|
+
declare uuid: string;
|
|
8
|
+
|
|
9
|
+
@Column({ type: DataType.STRING, allowNull: false, primaryKey: true })
|
|
10
|
+
declare eventName: string;
|
|
11
|
+
|
|
12
|
+
@Column({ type: DataType.INTEGER, allowNull: false })
|
|
13
|
+
declare xpReward: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: DataType.INTEGER, allowNull: true })
|
|
16
|
+
declare dailyLimit?: number;
|
|
17
|
+
|
|
18
|
+
@Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: true })
|
|
19
|
+
declare isActive: boolean;
|
|
20
|
+
|
|
21
|
+
@Column({ type: DataType.TEXT, allowNull: true })
|
|
22
|
+
declare description?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {BelongsTo, Column, DataType, Default, Index, Model, Table} from "sequelize-typescript";
|
|
2
|
+
import {PersistedUser} from "../PersistedUser.js";
|
|
3
|
+
import {XpEvent} from "./XpEvent.js";
|
|
4
|
+
|
|
5
|
+
@Table
|
|
6
|
+
export class XpTransaction extends Model {
|
|
7
|
+
@Default(DataType.UUIDV4)
|
|
8
|
+
@Column({ type: DataType.UUID, primaryKey: true })
|
|
9
|
+
declare uuid: string;
|
|
10
|
+
|
|
11
|
+
@Index
|
|
12
|
+
@Column({ type: DataType.UUID, allowNull: false })
|
|
13
|
+
declare userUuid: string;
|
|
14
|
+
|
|
15
|
+
@Index
|
|
16
|
+
@Column({ type: DataType.STRING, allowNull: false })
|
|
17
|
+
declare eventName: string;
|
|
18
|
+
|
|
19
|
+
@Column({ type: DataType.INTEGER, allowNull: false })
|
|
20
|
+
declare xpAwarded: number;
|
|
21
|
+
|
|
22
|
+
@Column({ type: DataType.DATE, allowNull: false, defaultValue: DataType.NOW })
|
|
23
|
+
declare awardedAt: Date;
|
|
24
|
+
|
|
25
|
+
@Column({ type: DataType.JSON, allowNull: true })
|
|
26
|
+
declare metadata?: Record<string, any>; // Additional context (workout_id, etc.)
|
|
27
|
+
|
|
28
|
+
@Column({ type: DataType.ENUM('pending', 'completed', 'reverted'), defaultValue: 'completed' })
|
|
29
|
+
declare status: 'pending' | 'completed' | 'reverted';
|
|
30
|
+
|
|
31
|
+
@BelongsTo(() => PersistedUser, 'userUuid')
|
|
32
|
+
declare user: PersistedUser;
|
|
33
|
+
|
|
34
|
+
@BelongsTo(() => XpEvent, 'eventName')
|
|
35
|
+
declare event: XpEvent;
|
|
36
|
+
}
|