90dc-core 1.2.15 → 1.2.17
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.
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Model } from
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
2
|
export declare class PersistedUser extends Model {
|
|
3
3
|
userUuid: string;
|
|
4
4
|
email: string;
|
|
5
5
|
password: string;
|
|
6
|
-
firstName
|
|
7
|
-
lastName
|
|
6
|
+
firstName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
8
|
avatar: string;
|
|
9
9
|
sex: string;
|
|
10
10
|
goal: string;
|
|
11
|
+
isFreeVersion: boolean;
|
|
12
|
+
allowsEmail: boolean;
|
|
11
13
|
weightGoal: string;
|
|
12
|
-
role:
|
|
14
|
+
role: 'default' | 'admin';
|
|
13
15
|
level: string;
|
|
14
16
|
type: string;
|
|
15
17
|
days: number;
|
|
@@ -19,12 +21,11 @@ export declare class PersistedUser extends Model {
|
|
|
19
21
|
weight: string;
|
|
20
22
|
activeProgramId: string;
|
|
21
23
|
registrationDate: string;
|
|
22
|
-
registrationService:
|
|
24
|
+
registrationService: 'apple' | 'google' | 'facebook' | 'native';
|
|
23
25
|
utilityEmail: string;
|
|
24
26
|
emailConfirmed: boolean;
|
|
25
27
|
utilityEmailConfirmed: boolean;
|
|
26
28
|
changeEmail: boolean;
|
|
27
|
-
allowsEmail: boolean;
|
|
28
29
|
changeUtilityEmail: boolean;
|
|
29
30
|
subscription: object;
|
|
30
31
|
$addFriend(friendUuid: string): Promise<void>;
|
|
@@ -7,19 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { Column, DataType, Default, Model, Table } from
|
|
11
|
-
import { UsersFriends } from
|
|
10
|
+
import { Column, DataType, Default, Model, Table } from 'sequelize-typescript';
|
|
11
|
+
import { UsersFriends } from './UsersFriends';
|
|
12
12
|
let PersistedUser = class PersistedUser extends Model {
|
|
13
13
|
async $addFriend(friendUuid) {
|
|
14
14
|
await UsersFriends.create({
|
|
15
15
|
userId: this.userUuid,
|
|
16
16
|
friendId: friendUuid,
|
|
17
|
-
createDate: new Date()
|
|
17
|
+
createDate: new Date()
|
|
18
18
|
});
|
|
19
19
|
await UsersFriends.create({
|
|
20
20
|
userId: friendUuid,
|
|
21
21
|
friendId: this.userUuid,
|
|
22
|
-
createDate: new Date()
|
|
22
|
+
createDate: new Date()
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
};
|
|
@@ -29,7 +29,7 @@ __decorate([
|
|
|
29
29
|
type: DataType.UUID,
|
|
30
30
|
defaultValue: DataType.UUID,
|
|
31
31
|
allowNull: false,
|
|
32
|
-
primaryKey: true
|
|
32
|
+
primaryKey: true
|
|
33
33
|
}),
|
|
34
34
|
__metadata("design:type", String)
|
|
35
35
|
], PersistedUser.prototype, "userUuid", void 0);
|
|
@@ -61,6 +61,14 @@ __decorate([
|
|
|
61
61
|
Column({ type: DataType.TEXT, allowNull: true }),
|
|
62
62
|
__metadata("design:type", String)
|
|
63
63
|
], PersistedUser.prototype, "goal", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
Column({ type: DataType.BOOLEAN, allowNull: true }),
|
|
66
|
+
__metadata("design:type", Boolean)
|
|
67
|
+
], PersistedUser.prototype, "isFreeVersion", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Column({ type: DataType.BOOLEAN, allowNull: true }),
|
|
70
|
+
__metadata("design:type", Boolean)
|
|
71
|
+
], PersistedUser.prototype, "allowsEmail", void 0);
|
|
64
72
|
__decorate([
|
|
65
73
|
Column({ type: DataType.TEXT, allowNull: true }),
|
|
66
74
|
__metadata("design:type", String)
|
|
@@ -125,10 +133,6 @@ __decorate([
|
|
|
125
133
|
Column({ type: DataType.BOOLEAN, allowNull: true }),
|
|
126
134
|
__metadata("design:type", Boolean)
|
|
127
135
|
], PersistedUser.prototype, "changeEmail", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
Column({ type: DataType.BOOLEAN, allowNull: true }),
|
|
130
|
-
__metadata("design:type", Boolean)
|
|
131
|
-
], PersistedUser.prototype, "allowsEmail", void 0);
|
|
132
136
|
__decorate([
|
|
133
137
|
Column({ type: DataType.BOOLEAN, allowNull: true }),
|
|
134
138
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Model, Table } from
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Model, Table } from 'sequelize-typescript';\nimport { UsersFriends } from './UsersFriends';\n\n@Table\nexport class PersistedUser 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 userUuid: string;\n\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.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: object;\n\n async $addFriend(friendUuid: string) {\n await UsersFriends.create({\n userId: this.userUuid,\n friendId: friendUuid,\n createDate: new Date()\n });\n\n await UsersFriends.create({\n userId: friendUuid,\n friendId: this.userUuid,\n createDate: new Date()\n });\n }\n}\n"],"names":["Column","DataType","Default","Model","Table","UsersFriends","PersistedUser","$addFriend","friendUuid","create","userId","userUuid","friendId","createDate","Date","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC/E,SAASC,YAAY,QAAQ,iBAAiB;AAG9C,WAAaC,gBA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f,SAASsB,OAAO;QAAEJ,WAAW,IAAI;IAAC;GArFvCb;;IAwFVN,OAAO;QAAEgB,MAAMf,SAASuB,KAAK;QAAEL,WAAW,IAAI;IAAC;GAxFrCb;AAAAA;IADZF;GACYE"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "90dc-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "A package that contains utils and interfaces used to create 90dc",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@swc/cli": "^0.1.62",
|
|
9
9
|
"@swc/core": "^1.3.36",
|
|
10
|
+
"@types/debug": "^4.1.12",
|
|
10
11
|
"@types/jest": "^29.4.0",
|
|
11
12
|
"@types/node": "^18.14.1",
|
|
12
13
|
"@types/validator": "^13.7.12",
|
|
@@ -20,6 +21,8 @@
|
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@typescript-eslint/parser": "^5.53.0",
|
|
24
|
+
"axios": "^1.6.2",
|
|
25
|
+
"debug": "^4.3.4",
|
|
23
26
|
"eslint": "^8.34.0",
|
|
24
27
|
"sequelize-typescript": "^2.1.5",
|
|
25
28
|
"winston": "^3.8.2"
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Column, DataType, Default, Model, Table } from "sequelize-typescript";
|
|
2
|
-
import { UsersFriends } from "./UsersFriends";
|
|
1
|
+
import { Column, DataType, Default, Index, Model, Table } from "sequelize-typescript";
|
|
3
2
|
|
|
4
3
|
@Table
|
|
5
4
|
export class PersistedUser extends Model {
|
|
5
|
+
|
|
6
|
+
@Index
|
|
6
7
|
@Default(DataType.UUIDV4)
|
|
7
8
|
@Column({
|
|
8
9
|
type: DataType.UUID,
|
|
9
10
|
defaultValue: DataType.UUID,
|
|
10
11
|
allowNull: false,
|
|
11
|
-
primaryKey: true
|
|
12
|
+
primaryKey: true
|
|
12
13
|
})
|
|
13
14
|
declare userUuid: string;
|
|
14
15
|
|
|
@@ -19,10 +20,10 @@ export class PersistedUser extends Model {
|
|
|
19
20
|
declare password: string;
|
|
20
21
|
|
|
21
22
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
22
|
-
declare firstName
|
|
23
|
+
declare firstName?: string;
|
|
23
24
|
|
|
24
25
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
25
|
-
declare lastName
|
|
26
|
+
declare lastName?: string;
|
|
26
27
|
|
|
27
28
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
28
29
|
declare avatar: string;
|
|
@@ -33,11 +34,17 @@ export class PersistedUser extends Model {
|
|
|
33
34
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
34
35
|
declare goal: string;
|
|
35
36
|
|
|
37
|
+
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
38
|
+
declare isFreeVersion: boolean;
|
|
39
|
+
|
|
40
|
+
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
41
|
+
declare allowsEmail: boolean;
|
|
42
|
+
|
|
36
43
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
37
44
|
declare weightGoal: string;
|
|
38
45
|
|
|
39
46
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
40
|
-
declare role:
|
|
47
|
+
declare role: 'default' | 'admin';
|
|
41
48
|
|
|
42
49
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
43
50
|
declare level: string;
|
|
@@ -67,7 +74,7 @@ export class PersistedUser extends Model {
|
|
|
67
74
|
declare registrationDate: string;
|
|
68
75
|
|
|
69
76
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
70
|
-
declare registrationService:
|
|
77
|
+
declare registrationService: 'apple' | 'google' | 'facebook' | 'native';
|
|
71
78
|
|
|
72
79
|
@Column({ type: DataType.TEXT, allowNull: true })
|
|
73
80
|
declare utilityEmail: string;
|
|
@@ -81,26 +88,10 @@ export class PersistedUser extends Model {
|
|
|
81
88
|
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
82
89
|
declare changeEmail: boolean;
|
|
83
90
|
|
|
84
|
-
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
85
|
-
declare allowsEmail: boolean;
|
|
86
|
-
|
|
87
91
|
@Column({ type: DataType.BOOLEAN, allowNull: true })
|
|
88
92
|
declare changeUtilityEmail: boolean;
|
|
89
93
|
|
|
90
94
|
@Column({ type: DataType.JSONB, allowNull: true })
|
|
91
95
|
declare subscription: object;
|
|
92
96
|
|
|
93
|
-
async $addFriend(friendUuid: string) {
|
|
94
|
-
await UsersFriends.create({
|
|
95
|
-
userId: this.userUuid,
|
|
96
|
-
friendId: friendUuid,
|
|
97
|
-
createDate: new Date(),
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
await UsersFriends.create({
|
|
101
|
-
userId: friendUuid,
|
|
102
|
-
friendId: this.userUuid,
|
|
103
|
-
createDate: new Date(),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
97
|
}
|
package/src/lib/utils/Logger.ts
CHANGED
|
@@ -1,54 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import Debug, { Debugger } from "debug";
|
|
4
|
+
import * as crypto from "crypto";
|
|
2
5
|
|
|
3
|
-
class
|
|
6
|
+
export class Log {
|
|
7
|
+
private static instance: Log | null = null;
|
|
8
|
+
private readonly debugLib: Debugger;
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
warn: 1,
|
|
9
|
-
info: 2,
|
|
10
|
-
http: 3,
|
|
11
|
-
debug: 4,
|
|
12
|
-
}
|
|
10
|
+
constructor(debug: Debugger) {
|
|
11
|
+
this.debugLib = debug;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
14
|
+
public static getInstance(): Log {
|
|
15
|
+
if (!Log.instance) {
|
|
16
|
+
const debug: Debugger = Debug(
|
|
17
|
+
"@swish:" + (process.env.npm_package_name || "package-name-not-specified")
|
|
18
|
+
);
|
|
19
|
+
Log.instance = new Log(debug);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
return Log.instance;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static extendInstance(name: string) {
|
|
26
|
+
return this.getInstance().extend(name);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public debug(message: string): void {
|
|
30
|
+
this.debugLib(message);
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
public info(message: string): void {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
this.debugLib.log = console.info.bind(console);
|
|
36
|
+
this.debugLib(message);
|
|
37
|
+
}
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
),
|
|
38
|
-
)
|
|
39
|
+
public warn(message: string): void {
|
|
40
|
+
const warnDebug: Debugger = this.debugLib.extend("warning");
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
warnDebug.log = console.warn.bind(console);
|
|
43
|
+
warnDebug(message);
|
|
44
|
+
}
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
format,
|
|
47
|
-
transports,
|
|
48
|
-
})
|
|
46
|
+
public error(message: string | unknown, error?: unknown): void {
|
|
47
|
+
const errorDebug: Debugger = this.debugLib.extend("error");
|
|
48
|
+
// eslint-disable-next-line no-console
|
|
49
|
+
errorDebug.log = console.error.bind(console);
|
|
50
|
+
errorDebug(message, error);
|
|
51
|
+
}
|
|
49
52
|
|
|
53
|
+
public catchError(error: unknown): void {
|
|
54
|
+
if (axios.isAxiosError(error)) {
|
|
55
|
+
this.error(error.toJSON());
|
|
56
|
+
}
|
|
57
|
+
if (typeof error === "string") {
|
|
58
|
+
error.toUpperCase(); // works, `e` narrowed to string
|
|
59
|
+
this.error(error);
|
|
60
|
+
} else if (error instanceof Error) {
|
|
61
|
+
error.message; // works, `e` narrowed to Error
|
|
62
|
+
this.error(error.message);
|
|
63
|
+
}
|
|
50
64
|
}
|
|
51
|
-
}
|
|
52
65
|
|
|
66
|
+
public catchErrorAndLogUuid(error: unknown): string {
|
|
67
|
+
const uuid: string = crypto.randomUUID();
|
|
68
|
+
this.error(`ERROR UUID: ${uuid}`);
|
|
69
|
+
this.catchError(error);
|
|
70
|
+
|
|
71
|
+
return uuid;
|
|
72
|
+
}
|
|
53
73
|
|
|
54
|
-
|
|
74
|
+
public extend(extensionName: string): Log {
|
|
75
|
+
const debugExtension: Debugger = this.debugLib.extend(extensionName);
|
|
76
|
+
return new Log(debugExtension);
|
|
77
|
+
}
|
|
78
|
+
}
|