90dc-core 1.2.11 → 1.2.13

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
@@ -2,4 +2,6 @@ export * from "./lib/models/ProgramInterfaces";
2
2
  export * from "./lib/models/ExerciseInterfaces";
3
3
  export * from "./lib/models/WorkoutInterfaces";
4
4
  export * from "./lib/models/UserInterfaces";
5
+ export * from "./lib/dbmodels/UsersFriends";
6
+ export * from "./lib/dbmodels/PersistedUser";
5
7
  export * from "./lib/utils/Logger";
package/dist/index.js CHANGED
@@ -3,5 +3,8 @@ export * from "./lib/models/ProgramInterfaces";
3
3
  export * from "./lib/models/ExerciseInterfaces";
4
4
  export * from "./lib/models/WorkoutInterfaces";
5
5
  export * from "./lib/models/UserInterfaces";
6
+ //DB Models
7
+ export * from "./lib/dbmodels/UsersFriends";
8
+ export * from "./lib/dbmodels/PersistedUser";
6
9
  //Utils
7
10
  export * from "./lib/utils/Logger";
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//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,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\"\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"}
@@ -0,0 +1,28 @@
1
+ import { Model } from "sequelize-typescript";
2
+ export declare class PersistedUser extends Model {
3
+ userUuid: string;
4
+ email: string;
5
+ password: string;
6
+ firstName: string;
7
+ lastName: string;
8
+ avatar: string;
9
+ sex: string;
10
+ goal: string;
11
+ weightGoal: string;
12
+ role: "default" | "admin";
13
+ level: string;
14
+ type: string;
15
+ days: number;
16
+ dateOfBirth: string;
17
+ metricSystem: string;
18
+ height: string;
19
+ weight: string;
20
+ activeProgramId: string;
21
+ registrationDate: string;
22
+ registrationService: "apple" | "google" | "facebook" | "native";
23
+ utilityEmail: string;
24
+ emailConfirmed: boolean;
25
+ utilityEmailConfirmed: boolean;
26
+ subscription: object;
27
+ $addFriend(friendUuid: string): Promise<void>;
28
+ }
@@ -0,0 +1,131 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Column, DataType, Default, Model, Table } from "sequelize-typescript";
11
+ import { UsersFriends } from "./UsersFriends";
12
+ let PersistedUser = class PersistedUser extends Model {
13
+ async $addFriend(friendUuid) {
14
+ await UsersFriends.create({
15
+ userId: this.userUuid,
16
+ friendId: friendUuid,
17
+ createDate: new Date(),
18
+ });
19
+ await UsersFriends.create({
20
+ userId: friendUuid,
21
+ friendId: this.userUuid,
22
+ createDate: new Date(),
23
+ });
24
+ }
25
+ };
26
+ __decorate([
27
+ Default(DataType.UUIDV4),
28
+ Column({
29
+ type: DataType.UUID,
30
+ defaultValue: DataType.UUID,
31
+ allowNull: false,
32
+ primaryKey: true,
33
+ }),
34
+ __metadata("design:type", String)
35
+ ], PersistedUser.prototype, "userUuid", void 0);
36
+ __decorate([
37
+ Column({ type: DataType.TEXT, allowNull: false, unique: false }),
38
+ __metadata("design:type", String)
39
+ ], PersistedUser.prototype, "email", void 0);
40
+ __decorate([
41
+ Column({ type: DataType.TEXT, allowNull: false }),
42
+ __metadata("design:type", String)
43
+ ], PersistedUser.prototype, "password", void 0);
44
+ __decorate([
45
+ Column({ type: DataType.TEXT, allowNull: true }),
46
+ __metadata("design:type", String)
47
+ ], PersistedUser.prototype, "firstName", void 0);
48
+ __decorate([
49
+ Column({ type: DataType.TEXT, allowNull: true }),
50
+ __metadata("design:type", String)
51
+ ], PersistedUser.prototype, "lastName", void 0);
52
+ __decorate([
53
+ Column({ type: DataType.TEXT, allowNull: true }),
54
+ __metadata("design:type", String)
55
+ ], PersistedUser.prototype, "avatar", void 0);
56
+ __decorate([
57
+ Column({ type: DataType.TEXT, allowNull: true }),
58
+ __metadata("design:type", String)
59
+ ], PersistedUser.prototype, "sex", void 0);
60
+ __decorate([
61
+ Column({ type: DataType.TEXT, allowNull: true }),
62
+ __metadata("design:type", String)
63
+ ], PersistedUser.prototype, "goal", void 0);
64
+ __decorate([
65
+ Column({ type: DataType.TEXT, allowNull: true }),
66
+ __metadata("design:type", String)
67
+ ], PersistedUser.prototype, "weightGoal", void 0);
68
+ __decorate([
69
+ Column({ type: DataType.TEXT, allowNull: true }),
70
+ __metadata("design:type", String)
71
+ ], PersistedUser.prototype, "role", void 0);
72
+ __decorate([
73
+ Column({ type: DataType.TEXT, allowNull: true }),
74
+ __metadata("design:type", String)
75
+ ], PersistedUser.prototype, "level", void 0);
76
+ __decorate([
77
+ Column({ type: DataType.TEXT, allowNull: true }),
78
+ __metadata("design:type", String)
79
+ ], PersistedUser.prototype, "type", void 0);
80
+ __decorate([
81
+ Column({ type: DataType.TEXT, allowNull: true }),
82
+ __metadata("design:type", Number)
83
+ ], PersistedUser.prototype, "days", void 0);
84
+ __decorate([
85
+ Column({ type: DataType.TEXT, allowNull: true }),
86
+ __metadata("design:type", String)
87
+ ], PersistedUser.prototype, "dateOfBirth", void 0);
88
+ __decorate([
89
+ Column({ type: DataType.TEXT, allowNull: true }),
90
+ __metadata("design:type", String)
91
+ ], PersistedUser.prototype, "metricSystem", void 0);
92
+ __decorate([
93
+ Column({ type: DataType.TEXT, allowNull: true }),
94
+ __metadata("design:type", String)
95
+ ], PersistedUser.prototype, "height", void 0);
96
+ __decorate([
97
+ Column({ type: DataType.TEXT, allowNull: true }),
98
+ __metadata("design:type", String)
99
+ ], PersistedUser.prototype, "weight", void 0);
100
+ __decorate([
101
+ Column({ type: DataType.TEXT, allowNull: true }),
102
+ __metadata("design:type", String)
103
+ ], PersistedUser.prototype, "activeProgramId", void 0);
104
+ __decorate([
105
+ Column({ type: DataType.TEXT, allowNull: true }),
106
+ __metadata("design:type", String)
107
+ ], PersistedUser.prototype, "registrationDate", void 0);
108
+ __decorate([
109
+ Column({ type: DataType.TEXT, allowNull: true }),
110
+ __metadata("design:type", String)
111
+ ], PersistedUser.prototype, "registrationService", void 0);
112
+ __decorate([
113
+ Column({ type: DataType.TEXT, allowNull: true }),
114
+ __metadata("design:type", String)
115
+ ], PersistedUser.prototype, "utilityEmail", void 0);
116
+ __decorate([
117
+ Column({ type: DataType.BOOLEAN, allowNull: true }),
118
+ __metadata("design:type", Boolean)
119
+ ], PersistedUser.prototype, "emailConfirmed", void 0);
120
+ __decorate([
121
+ Column({ type: DataType.BOOLEAN, allowNull: true }),
122
+ __metadata("design:type", Boolean)
123
+ ], PersistedUser.prototype, "utilityEmailConfirmed", void 0);
124
+ __decorate([
125
+ Column({ type: DataType.JSONB, allowNull: true }),
126
+ __metadata("design:type", Object)
127
+ ], PersistedUser.prototype, "subscription", void 0);
128
+ PersistedUser = __decorate([
129
+ Table
130
+ ], PersistedUser);
131
+ export { PersistedUser };
@@ -0,0 +1 @@
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.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.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":"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"}
@@ -0,0 +1,6 @@
1
+ import { Model } from "sequelize-typescript";
2
+ export declare class UsersFriends extends Model {
3
+ userId: string;
4
+ friendId: string;
5
+ createDate: Date;
6
+ }
@@ -0,0 +1,34 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Column, DataType, Model, Table } from "sequelize-typescript";
11
+ let UsersFriends = class UsersFriends extends Model {
12
+ };
13
+ __decorate([
14
+ Column({
15
+ type: DataType.UUID,
16
+ allowNull: false,
17
+ }),
18
+ __metadata("design:type", String)
19
+ ], UsersFriends.prototype, "userId", void 0);
20
+ __decorate([
21
+ Column({
22
+ type: DataType.UUID,
23
+ allowNull: false,
24
+ }),
25
+ __metadata("design:type", String)
26
+ ], UsersFriends.prototype, "friendId", void 0);
27
+ __decorate([
28
+ Column({ type: DataType.DATE, allowNull: false }),
29
+ __metadata("design:type", Date)
30
+ ], UsersFriends.prototype, "createDate", void 0);
31
+ UsersFriends = __decorate([
32
+ Table
33
+ ], UsersFriends);
34
+ export { UsersFriends };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/UsersFriends.ts"],"sourcesContent":["import { Column, DataType, Model, Table } from \"sequelize-typescript\";\n\n@Table\nexport class UsersFriends extends Model {\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare userId: string;\n\n @Column({\n type: DataType.UUID,\n allowNull: false,\n })\n declare friendId: string;\n\n @Column({ type: DataType.DATE, allowNull: false })\n declare createDate: Date;\n}\n"],"names":["Column","DataType","Model","Table","UsersFriends","type","UUID","allowNull","DATE"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAGtE,WAAaC,eAAN,2BAA2BF;AAelC,EAAC;;IAdEF,OAAO;QACNK,MAAMJ,SAASK,IAAI;QACnBC,WAAW,KAAK;IAClB;GAJWH;;IAOVJ,OAAO;QACNK,MAAMJ,SAASK,IAAI;QACnBC,WAAW,KAAK;IAClB;GAVWH;;IAaVJ,OAAO;QAAEK,MAAMJ,SAASO,IAAI;QAAED,WAAW,KAAK;IAAC;GAbrCH;AAAAA;IADZD;GACYC"}
@@ -24,7 +24,7 @@ class Logger {
24
24
  winston.addColors(colors);
25
25
  const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf(
26
26
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
27
- (info) => `\n ${serviceName.toUpperCase()}: ${info.message}\n`));
27
+ (info) => `\n @${serviceName.toUpperCase()}: ${info.message}\n`));
28
28
  const transports = [
29
29
  new winston.transports.Console(),
30
30
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n public static getLogger(serviceName: string){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'magenta',\n http: 'magenta',\n debug: 'white',\n serviceName: 'magenta'\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `\\n ${serviceName.toUpperCase()}: ${info.message}\\n`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","getLogger","serviceName","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","toUpperCase","message","transports","Console","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAcC,UAAUC,WAAmB,EAAC;QAC1C,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPN,aAAa;QACf;QAEAH,QAAQgB,SAAS,CAACD;QAElB,MAAME,SAAiCjB,QAAQiB,MAAM,CAACC,OAAO,CAC3DlB,QAAQiB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DjB,QAAQiB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCrB,QAAQiB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC7E,CAACf,OAAS,CAAC,UAAU,EAAEJ,YAAYoB,WAAW,GAAG,EAAE,EAAEhB,KAAKiB,OAAO,CAAC,EAAE,CAAC;QAIxE,MAAMC,aAAa;YACjB,IAAIzB,QAAQyB,UAAU,CAACC,OAAO;SAC/B;QACD,OAAO1B,QAAQ2B,YAAY,CAAC;YAC1BjB,OAAOA;YACPN;YACAa;YACAQ;QACF;IAEF;AACF;AAGA,eAAexB,OAAM"}
1
+ {"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n public static getLogger(serviceName: string){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'magenta',\n http: 'magenta',\n debug: 'white',\n serviceName: 'magenta'\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `\\n @${serviceName.toUpperCase()}: ${info.message}\\n`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","getLogger","serviceName","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","toUpperCase","message","transports","Console","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAcC,UAAUC,WAAmB,EAAC;QAC1C,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPN,aAAa;QACf;QAEAH,QAAQgB,SAAS,CAACD;QAElB,MAAME,SAAiCjB,QAAQiB,MAAM,CAACC,OAAO,CAC3DlB,QAAQiB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DjB,QAAQiB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCrB,QAAQiB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC7E,CAACf,OAAS,CAAC,WAAW,EAAEJ,YAAYoB,WAAW,GAAG,EAAE,EAAEhB,KAAKiB,OAAO,CAAC,EAAE,CAAC;QAIzE,MAAMC,aAAa;YACjB,IAAIzB,QAAQyB,UAAU,CAACC,OAAO;SAC/B;QACD,OAAO1B,QAAQ2B,YAAY,CAAC;YAC1BjB,OAAOA;YACPN;YACAa;YACAQ;QACF;IAEF;AACF;AAGA,eAAexB,OAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@typescript-eslint/parser": "^5.53.0",
23
23
  "eslint": "^8.34.0",
24
+ "sequelize-typescript": "^2.1.5",
24
25
  "winston": "^3.8.2"
25
26
  },
26
27
  "repository": {
package/src/index.ts CHANGED
@@ -4,5 +4,9 @@ export * from "./lib/models/ExerciseInterfaces";
4
4
  export * from "./lib/models/WorkoutInterfaces";
5
5
  export * from "./lib/models/UserInterfaces";
6
6
 
7
+ //DB Models
8
+ export * from "./lib/dbmodels/UsersFriends"
9
+ export * from "./lib/dbmodels/PersistedUser"
10
+
7
11
  //Utils
8
12
  export * from "./lib/utils/Logger"
@@ -0,0 +1,97 @@
1
+ import { Column, DataType, Default, Model, Table } from "sequelize-typescript";
2
+ import { UsersFriends } from "./UsersFriends";
3
+
4
+ @Table
5
+ export class PersistedUser extends Model {
6
+ @Default(DataType.UUIDV4)
7
+ @Column({
8
+ type: DataType.UUID,
9
+ defaultValue: DataType.UUID,
10
+ allowNull: false,
11
+ primaryKey: true,
12
+ })
13
+ declare userUuid: string;
14
+
15
+ @Column({ type: DataType.TEXT, allowNull: false, unique: false })
16
+ declare email: string;
17
+
18
+ @Column({ type: DataType.TEXT, allowNull: false })
19
+ declare password: string;
20
+
21
+ @Column({ type: DataType.TEXT, allowNull: true })
22
+ declare firstName: string;
23
+
24
+ @Column({ type: DataType.TEXT, allowNull: true })
25
+ declare lastName: string;
26
+
27
+ @Column({ type: DataType.TEXT, allowNull: true })
28
+ declare avatar: string;
29
+
30
+ @Column({ type: DataType.TEXT, allowNull: true })
31
+ declare sex: string;
32
+
33
+ @Column({ type: DataType.TEXT, allowNull: true })
34
+ declare goal: string;
35
+
36
+ @Column({ type: DataType.TEXT, allowNull: true })
37
+ declare weightGoal: string;
38
+
39
+ @Column({ type: DataType.TEXT, allowNull: true })
40
+ declare role: "default" | "admin";
41
+
42
+ @Column({ type: DataType.TEXT, allowNull: true })
43
+ declare level: string;
44
+
45
+ @Column({ type: DataType.TEXT, allowNull: true })
46
+ declare type: string;
47
+
48
+ @Column({ type: DataType.TEXT, allowNull: true })
49
+ declare days: number;
50
+
51
+ @Column({ type: DataType.TEXT, allowNull: true })
52
+ declare dateOfBirth: string;
53
+
54
+ @Column({ type: DataType.TEXT, allowNull: true })
55
+ declare metricSystem: string;
56
+
57
+ @Column({ type: DataType.TEXT, allowNull: true })
58
+ declare height: string;
59
+
60
+ @Column({ type: DataType.TEXT, allowNull: true })
61
+ declare weight: string;
62
+
63
+ @Column({ type: DataType.TEXT, allowNull: true })
64
+ declare activeProgramId: string;
65
+
66
+ @Column({ type: DataType.TEXT, allowNull: true })
67
+ declare registrationDate: string;
68
+
69
+ @Column({ type: DataType.TEXT, allowNull: true })
70
+ declare registrationService: "apple" | "google" | "facebook" | "native";
71
+
72
+ @Column({ type: DataType.TEXT, allowNull: true })
73
+ declare utilityEmail: string;
74
+
75
+ @Column({ type: DataType.BOOLEAN, allowNull: true })
76
+ declare emailConfirmed: boolean;
77
+
78
+ @Column({ type: DataType.BOOLEAN, allowNull: true })
79
+ declare utilityEmailConfirmed: boolean;
80
+
81
+ @Column({ type: DataType.JSONB, allowNull: true })
82
+ declare subscription: object;
83
+
84
+ async $addFriend(friendUuid: string) {
85
+ await UsersFriends.create({
86
+ userId: this.userUuid,
87
+ friendId: friendUuid,
88
+ createDate: new Date(),
89
+ });
90
+
91
+ await UsersFriends.create({
92
+ userId: friendUuid,
93
+ friendId: this.userUuid,
94
+ createDate: new Date(),
95
+ });
96
+ }
97
+ }
@@ -0,0 +1,19 @@
1
+ import { Column, DataType, Model, Table } from "sequelize-typescript";
2
+
3
+ @Table
4
+ export class UsersFriends extends Model {
5
+ @Column({
6
+ type: DataType.UUID,
7
+ allowNull: false,
8
+ })
9
+ declare userId: string;
10
+
11
+ @Column({
12
+ type: DataType.UUID,
13
+ allowNull: false,
14
+ })
15
+ declare friendId: string;
16
+
17
+ @Column({ type: DataType.DATE, allowNull: false })
18
+ declare createDate: Date;
19
+ }
@@ -33,7 +33,7 @@ class Logger {
33
33
  winston.format.colorize({ all: true }),
34
34
  winston.format.printf(
35
35
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
36
- (info) => `\n ${serviceName.toUpperCase()}: ${info.message}\n`,
36
+ (info) => `\n @${serviceName.toUpperCase()}: ${info.message}\n`,
37
37
  ),
38
38
  )
39
39