@experts_hub/shared 1.0.25 → 1.0.27
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/entities/base.entity.d.ts +11 -0
- package/dist/entities/index.d.ts +2 -0
- package/dist/entities/refresh-token.entity.d.ts +12 -0
- package/dist/entities/user.entity.d.ts +33 -0
- package/dist/index.d.mts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +174 -0
- package/dist/index.mjs +188 -0
- package/package.json +4 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseEntity } from './base.entity';
|
|
2
|
+
import { RefreshToken } from './refresh-token.entity';
|
|
3
|
+
export declare enum AccountType {
|
|
4
|
+
ADMIN = "ADMIN",
|
|
5
|
+
SUB_ADMIN = "SUB_ADMIN",
|
|
6
|
+
CLIENT = "CLIENT",
|
|
7
|
+
FREELANCER = "FREELANCER"
|
|
8
|
+
}
|
|
9
|
+
export declare enum AccountStatus {
|
|
10
|
+
INACTIVE = "INACTIVE",
|
|
11
|
+
ACTIVE = "ACTIVE",
|
|
12
|
+
SUSPENDED = "SUSPENDED",
|
|
13
|
+
BLOCKED = "BLOCKED"
|
|
14
|
+
}
|
|
15
|
+
export declare class User extends BaseEntity {
|
|
16
|
+
uniqueId: string;
|
|
17
|
+
username: string;
|
|
18
|
+
firstName: string;
|
|
19
|
+
lastName: string;
|
|
20
|
+
dateOfBirth: Date;
|
|
21
|
+
gender: string;
|
|
22
|
+
profilePictureUrl: string;
|
|
23
|
+
email: string;
|
|
24
|
+
mobile: string;
|
|
25
|
+
password: string;
|
|
26
|
+
accountType: AccountType;
|
|
27
|
+
accountStatus: AccountStatus;
|
|
28
|
+
isEmailVerified: boolean;
|
|
29
|
+
isMobileVerified: boolean;
|
|
30
|
+
lastLoginAt: Date;
|
|
31
|
+
lastLoginIp: string;
|
|
32
|
+
refreshTokens: RefreshToken[];
|
|
33
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -14,4 +14,60 @@ declare const UserTCPAdapter: () => MicroserviceOptions;
|
|
|
14
14
|
|
|
15
15
|
declare const UserRMQAdapter: (mode?: string) => MicroserviceOptions;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare abstract class BaseEntity {
|
|
18
|
+
id: number;
|
|
19
|
+
uuid: string;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
createdBy: number;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
updatedBy: number;
|
|
24
|
+
isDeleted: boolean;
|
|
25
|
+
deletedBy: number;
|
|
26
|
+
deletedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class RefreshToken {
|
|
30
|
+
id: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
tokenId: string;
|
|
33
|
+
deviceInfo: any;
|
|
34
|
+
isRevoked: boolean;
|
|
35
|
+
expiresAt: Date;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
updatedAt: Date;
|
|
38
|
+
user: User;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare enum AccountType {
|
|
42
|
+
ADMIN = "ADMIN",
|
|
43
|
+
SUB_ADMIN = "SUB_ADMIN",
|
|
44
|
+
CLIENT = "CLIENT",
|
|
45
|
+
FREELANCER = "FREELANCER"
|
|
46
|
+
}
|
|
47
|
+
declare enum AccountStatus {
|
|
48
|
+
INACTIVE = "INACTIVE",
|
|
49
|
+
ACTIVE = "ACTIVE",
|
|
50
|
+
SUSPENDED = "SUSPENDED",
|
|
51
|
+
BLOCKED = "BLOCKED"
|
|
52
|
+
}
|
|
53
|
+
declare class User extends BaseEntity {
|
|
54
|
+
uniqueId: string;
|
|
55
|
+
username: string;
|
|
56
|
+
firstName: string;
|
|
57
|
+
lastName: string;
|
|
58
|
+
dateOfBirth: Date;
|
|
59
|
+
gender: string;
|
|
60
|
+
profilePictureUrl: string;
|
|
61
|
+
email: string;
|
|
62
|
+
mobile: string;
|
|
63
|
+
password: string;
|
|
64
|
+
accountType: AccountType;
|
|
65
|
+
accountStatus: AccountStatus;
|
|
66
|
+
isEmailVerified: boolean;
|
|
67
|
+
isMobileVerified: boolean;
|
|
68
|
+
lastLoginAt: Date;
|
|
69
|
+
lastLoginIp: string;
|
|
70
|
+
refreshTokens: RefreshToken[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { AUTHENTICATION_PATTERN, AccountStatus, AccountType, RefreshToken, User, UserRMQAdapter, UserTCPAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,60 @@ declare const UserTCPAdapter: () => MicroserviceOptions;
|
|
|
14
14
|
|
|
15
15
|
declare const UserRMQAdapter: (mode?: string) => MicroserviceOptions;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare abstract class BaseEntity {
|
|
18
|
+
id: number;
|
|
19
|
+
uuid: string;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
createdBy: number;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
updatedBy: number;
|
|
24
|
+
isDeleted: boolean;
|
|
25
|
+
deletedBy: number;
|
|
26
|
+
deletedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class RefreshToken {
|
|
30
|
+
id: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
tokenId: string;
|
|
33
|
+
deviceInfo: any;
|
|
34
|
+
isRevoked: boolean;
|
|
35
|
+
expiresAt: Date;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
updatedAt: Date;
|
|
38
|
+
user: User;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare enum AccountType {
|
|
42
|
+
ADMIN = "ADMIN",
|
|
43
|
+
SUB_ADMIN = "SUB_ADMIN",
|
|
44
|
+
CLIENT = "CLIENT",
|
|
45
|
+
FREELANCER = "FREELANCER"
|
|
46
|
+
}
|
|
47
|
+
declare enum AccountStatus {
|
|
48
|
+
INACTIVE = "INACTIVE",
|
|
49
|
+
ACTIVE = "ACTIVE",
|
|
50
|
+
SUSPENDED = "SUSPENDED",
|
|
51
|
+
BLOCKED = "BLOCKED"
|
|
52
|
+
}
|
|
53
|
+
declare class User extends BaseEntity {
|
|
54
|
+
uniqueId: string;
|
|
55
|
+
username: string;
|
|
56
|
+
firstName: string;
|
|
57
|
+
lastName: string;
|
|
58
|
+
dateOfBirth: Date;
|
|
59
|
+
gender: string;
|
|
60
|
+
profilePictureUrl: string;
|
|
61
|
+
email: string;
|
|
62
|
+
mobile: string;
|
|
63
|
+
password: string;
|
|
64
|
+
accountType: AccountType;
|
|
65
|
+
accountStatus: AccountStatus;
|
|
66
|
+
isEmailVerified: boolean;
|
|
67
|
+
isMobileVerified: boolean;
|
|
68
|
+
lastLoginAt: Date;
|
|
69
|
+
lastLoginIp: string;
|
|
70
|
+
refreshTokens: RefreshToken[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { AUTHENTICATION_PATTERN, AccountStatus, AccountType, RefreshToken, User, UserRMQAdapter, UserTCPAdapter };
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
20
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
+
if (decorator = decorators[i])
|
|
22
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
23
|
+
if (kind && result) __defProp(target, key, result);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
18
26
|
|
|
19
27
|
// src/index.ts
|
|
20
28
|
var index_exports = {};
|
|
21
29
|
__export(index_exports, {
|
|
22
30
|
AUTHENTICATION_PATTERN: () => AUTHENTICATION_PATTERN,
|
|
31
|
+
AccountStatus: () => AccountStatus,
|
|
32
|
+
AccountType: () => AccountType,
|
|
33
|
+
RefreshToken: () => RefreshToken,
|
|
34
|
+
User: () => User,
|
|
23
35
|
UserRMQAdapter: () => UserRMQAdapter,
|
|
24
36
|
UserTCPAdapter: () => UserTCPAdapter
|
|
25
37
|
});
|
|
@@ -107,9 +119,171 @@ var UserRMQAdapter = (mode = "microservice") => {
|
|
|
107
119
|
}
|
|
108
120
|
return config3;
|
|
109
121
|
};
|
|
122
|
+
|
|
123
|
+
// src/entities/user.entity.ts
|
|
124
|
+
var import_typeorm3 = require("typeorm");
|
|
125
|
+
|
|
126
|
+
// src/entities/base.entity.ts
|
|
127
|
+
var import_typeorm = require("typeorm");
|
|
128
|
+
var BaseEntity = class {
|
|
129
|
+
};
|
|
130
|
+
__decorateClass([
|
|
131
|
+
(0, import_typeorm.PrimaryGeneratedColumn)("increment", { type: "integer" })
|
|
132
|
+
], BaseEntity.prototype, "id", 2);
|
|
133
|
+
__decorateClass([
|
|
134
|
+
(0, import_typeorm.Column)({ type: "uuid" }),
|
|
135
|
+
(0, import_typeorm.Generated)("uuid")
|
|
136
|
+
], BaseEntity.prototype, "uuid", 2);
|
|
137
|
+
__decorateClass([
|
|
138
|
+
(0, import_typeorm.CreateDateColumn)({ name: "created_at", type: "timestamp with time zone" })
|
|
139
|
+
], BaseEntity.prototype, "createdAt", 2);
|
|
140
|
+
__decorateClass([
|
|
141
|
+
(0, import_typeorm.Column)({ name: "created_by", type: "integer", nullable: true })
|
|
142
|
+
], BaseEntity.prototype, "createdBy", 2);
|
|
143
|
+
__decorateClass([
|
|
144
|
+
(0, import_typeorm.UpdateDateColumn)({ name: "updated_at", type: "timestamp with time zone" })
|
|
145
|
+
], BaseEntity.prototype, "updatedAt", 2);
|
|
146
|
+
__decorateClass([
|
|
147
|
+
(0, import_typeorm.Column)({ name: "updated_by", type: "integer", nullable: true })
|
|
148
|
+
], BaseEntity.prototype, "updatedBy", 2);
|
|
149
|
+
__decorateClass([
|
|
150
|
+
(0, import_typeorm.Column)({ name: "is_deleted", type: "boolean", default: false })
|
|
151
|
+
], BaseEntity.prototype, "isDeleted", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
(0, import_typeorm.Column)({ name: "deleted_by", type: "integer", nullable: true })
|
|
154
|
+
], BaseEntity.prototype, "deletedBy", 2);
|
|
155
|
+
__decorateClass([
|
|
156
|
+
(0, import_typeorm.DeleteDateColumn)({
|
|
157
|
+
name: "deleted_at",
|
|
158
|
+
type: "timestamp with time zone",
|
|
159
|
+
nullable: true
|
|
160
|
+
})
|
|
161
|
+
], BaseEntity.prototype, "deletedAt", 2);
|
|
162
|
+
|
|
163
|
+
// src/entities/refresh-token.entity.ts
|
|
164
|
+
var import_typeorm2 = require("typeorm");
|
|
165
|
+
var RefreshToken = class {
|
|
166
|
+
};
|
|
167
|
+
__decorateClass([
|
|
168
|
+
(0, import_typeorm2.PrimaryGeneratedColumn)("uuid")
|
|
169
|
+
], RefreshToken.prototype, "id", 2);
|
|
170
|
+
__decorateClass([
|
|
171
|
+
(0, import_typeorm2.Column)({ name: "user_id", type: "integer" })
|
|
172
|
+
], RefreshToken.prototype, "userId", 2);
|
|
173
|
+
__decorateClass([
|
|
174
|
+
(0, import_typeorm2.Column)({ name: "token_id", type: "varchar" })
|
|
175
|
+
], RefreshToken.prototype, "tokenId", 2);
|
|
176
|
+
__decorateClass([
|
|
177
|
+
(0, import_typeorm2.Column)({ name: "device_info", type: "json", nullable: true })
|
|
178
|
+
], RefreshToken.prototype, "deviceInfo", 2);
|
|
179
|
+
__decorateClass([
|
|
180
|
+
(0, import_typeorm2.Column)({ name: "is_revoked", type: "boolean", default: false })
|
|
181
|
+
], RefreshToken.prototype, "isRevoked", 2);
|
|
182
|
+
__decorateClass([
|
|
183
|
+
(0, import_typeorm2.Column)({ name: "expires_at", type: "timestamp with time zone" })
|
|
184
|
+
], RefreshToken.prototype, "expiresAt", 2);
|
|
185
|
+
__decorateClass([
|
|
186
|
+
(0, import_typeorm2.CreateDateColumn)({ name: "created_at", type: "timestamp with time zone" })
|
|
187
|
+
], RefreshToken.prototype, "createdAt", 2);
|
|
188
|
+
__decorateClass([
|
|
189
|
+
(0, import_typeorm2.UpdateDateColumn)({ name: "updated_at", type: "timestamp with time zone" })
|
|
190
|
+
], RefreshToken.prototype, "updatedAt", 2);
|
|
191
|
+
__decorateClass([
|
|
192
|
+
(0, import_typeorm2.ManyToOne)(() => User, (user) => user.refreshTokens),
|
|
193
|
+
(0, import_typeorm2.JoinColumn)({ name: "user_id" })
|
|
194
|
+
], RefreshToken.prototype, "user", 2);
|
|
195
|
+
RefreshToken = __decorateClass([
|
|
196
|
+
(0, import_typeorm2.Entity)("refresh_tokens")
|
|
197
|
+
], RefreshToken);
|
|
198
|
+
|
|
199
|
+
// src/entities/user.entity.ts
|
|
200
|
+
var AccountType = /* @__PURE__ */ ((AccountType2) => {
|
|
201
|
+
AccountType2["ADMIN"] = "ADMIN";
|
|
202
|
+
AccountType2["SUB_ADMIN"] = "SUB_ADMIN";
|
|
203
|
+
AccountType2["CLIENT"] = "CLIENT";
|
|
204
|
+
AccountType2["FREELANCER"] = "FREELANCER";
|
|
205
|
+
return AccountType2;
|
|
206
|
+
})(AccountType || {});
|
|
207
|
+
var AccountStatus = /* @__PURE__ */ ((AccountStatus2) => {
|
|
208
|
+
AccountStatus2["INACTIVE"] = "INACTIVE";
|
|
209
|
+
AccountStatus2["ACTIVE"] = "ACTIVE";
|
|
210
|
+
AccountStatus2["SUSPENDED"] = "SUSPENDED";
|
|
211
|
+
AccountStatus2["BLOCKED"] = "BLOCKED";
|
|
212
|
+
return AccountStatus2;
|
|
213
|
+
})(AccountStatus || {});
|
|
214
|
+
var User = class extends BaseEntity {
|
|
215
|
+
};
|
|
216
|
+
__decorateClass([
|
|
217
|
+
(0, import_typeorm3.Column)({ name: "unique_id", type: "varchar", unique: true })
|
|
218
|
+
], User.prototype, "uniqueId", 2);
|
|
219
|
+
__decorateClass([
|
|
220
|
+
(0, import_typeorm3.Column)({ name: "username", type: "varchar", unique: true, nullable: true })
|
|
221
|
+
], User.prototype, "username", 2);
|
|
222
|
+
__decorateClass([
|
|
223
|
+
(0, import_typeorm3.Column)({ name: "first_name", type: "varchar", length: 100, nullable: true })
|
|
224
|
+
], User.prototype, "firstName", 2);
|
|
225
|
+
__decorateClass([
|
|
226
|
+
(0, import_typeorm3.Column)({ name: "last_name", type: "varchar", length: 100, nullable: true })
|
|
227
|
+
], User.prototype, "lastName", 2);
|
|
228
|
+
__decorateClass([
|
|
229
|
+
(0, import_typeorm3.Column)({ name: "date_of_birth", type: "date", nullable: true })
|
|
230
|
+
], User.prototype, "dateOfBirth", 2);
|
|
231
|
+
__decorateClass([
|
|
232
|
+
(0, import_typeorm3.Column)({ name: "gender", type: "varchar", length: 10, nullable: true })
|
|
233
|
+
], User.prototype, "gender", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
(0, import_typeorm3.Column)({ name: "profile_picture_url", type: "text", nullable: true })
|
|
236
|
+
], User.prototype, "profilePictureUrl", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
(0, import_typeorm3.Column)({ name: "email", type: "varchar", unique: true })
|
|
239
|
+
], User.prototype, "email", 2);
|
|
240
|
+
__decorateClass([
|
|
241
|
+
(0, import_typeorm3.Column)({ name: "mobile", type: "varchar", unique: true, nullable: true })
|
|
242
|
+
], User.prototype, "mobile", 2);
|
|
243
|
+
__decorateClass([
|
|
244
|
+
(0, import_typeorm3.Column)({ name: "password", type: "varchar" })
|
|
245
|
+
], User.prototype, "password", 2);
|
|
246
|
+
__decorateClass([
|
|
247
|
+
(0, import_typeorm3.Column)({
|
|
248
|
+
name: "account_type",
|
|
249
|
+
type: "enum",
|
|
250
|
+
enum: AccountType,
|
|
251
|
+
default: "FREELANCER" /* FREELANCER */
|
|
252
|
+
})
|
|
253
|
+
], User.prototype, "accountType", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
(0, import_typeorm3.Column)({
|
|
256
|
+
name: "account_status",
|
|
257
|
+
type: "enum",
|
|
258
|
+
enum: AccountStatus,
|
|
259
|
+
default: "INACTIVE" /* INACTIVE */
|
|
260
|
+
})
|
|
261
|
+
], User.prototype, "accountStatus", 2);
|
|
262
|
+
__decorateClass([
|
|
263
|
+
(0, import_typeorm3.Column)({ name: "is_email_verified", type: "boolean", default: false })
|
|
264
|
+
], User.prototype, "isEmailVerified", 2);
|
|
265
|
+
__decorateClass([
|
|
266
|
+
(0, import_typeorm3.Column)({ name: "is_mobile_verified", type: "boolean", default: false })
|
|
267
|
+
], User.prototype, "isMobileVerified", 2);
|
|
268
|
+
__decorateClass([
|
|
269
|
+
(0, import_typeorm3.Column)({ name: "last_login_at", type: "timestamp with time zone", nullable: true })
|
|
270
|
+
], User.prototype, "lastLoginAt", 2);
|
|
271
|
+
__decorateClass([
|
|
272
|
+
(0, import_typeorm3.Column)({ name: "last_login_ip", type: "varchar", nullable: true })
|
|
273
|
+
], User.prototype, "lastLoginIp", 2);
|
|
274
|
+
__decorateClass([
|
|
275
|
+
(0, import_typeorm3.OneToMany)(() => RefreshToken, (token) => token.user)
|
|
276
|
+
], User.prototype, "refreshTokens", 2);
|
|
277
|
+
User = __decorateClass([
|
|
278
|
+
(0, import_typeorm3.Entity)("users")
|
|
279
|
+
], User);
|
|
110
280
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
281
|
0 && (module.exports = {
|
|
112
282
|
AUTHENTICATION_PATTERN,
|
|
283
|
+
AccountStatus,
|
|
284
|
+
AccountType,
|
|
285
|
+
RefreshToken,
|
|
286
|
+
User,
|
|
113
287
|
UserRMQAdapter,
|
|
114
288
|
UserTCPAdapter
|
|
115
289
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
// src/modules/authentication/pattern/pattern.ts
|
|
2
13
|
var AUTHENTICATION_PATTERN = {
|
|
3
14
|
handleValidateToken: "handle.validate.token",
|
|
@@ -80,8 +91,185 @@ var UserRMQAdapter = (mode = "microservice") => {
|
|
|
80
91
|
}
|
|
81
92
|
return config3;
|
|
82
93
|
};
|
|
94
|
+
|
|
95
|
+
// src/entities/user.entity.ts
|
|
96
|
+
import { Entity as Entity2, Column as Column3, OneToMany } from "typeorm";
|
|
97
|
+
|
|
98
|
+
// src/entities/base.entity.ts
|
|
99
|
+
import {
|
|
100
|
+
CreateDateColumn,
|
|
101
|
+
PrimaryGeneratedColumn,
|
|
102
|
+
UpdateDateColumn,
|
|
103
|
+
Column,
|
|
104
|
+
DeleteDateColumn,
|
|
105
|
+
Generated
|
|
106
|
+
} from "typeorm";
|
|
107
|
+
var BaseEntity = class {
|
|
108
|
+
};
|
|
109
|
+
__decorateClass([
|
|
110
|
+
PrimaryGeneratedColumn("increment", { type: "integer" })
|
|
111
|
+
], BaseEntity.prototype, "id", 2);
|
|
112
|
+
__decorateClass([
|
|
113
|
+
Column({ type: "uuid" }),
|
|
114
|
+
Generated("uuid")
|
|
115
|
+
], BaseEntity.prototype, "uuid", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
CreateDateColumn({ name: "created_at", type: "timestamp with time zone" })
|
|
118
|
+
], BaseEntity.prototype, "createdAt", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
Column({ name: "created_by", type: "integer", nullable: true })
|
|
121
|
+
], BaseEntity.prototype, "createdBy", 2);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
UpdateDateColumn({ name: "updated_at", type: "timestamp with time zone" })
|
|
124
|
+
], BaseEntity.prototype, "updatedAt", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
Column({ name: "updated_by", type: "integer", nullable: true })
|
|
127
|
+
], BaseEntity.prototype, "updatedBy", 2);
|
|
128
|
+
__decorateClass([
|
|
129
|
+
Column({ name: "is_deleted", type: "boolean", default: false })
|
|
130
|
+
], BaseEntity.prototype, "isDeleted", 2);
|
|
131
|
+
__decorateClass([
|
|
132
|
+
Column({ name: "deleted_by", type: "integer", nullable: true })
|
|
133
|
+
], BaseEntity.prototype, "deletedBy", 2);
|
|
134
|
+
__decorateClass([
|
|
135
|
+
DeleteDateColumn({
|
|
136
|
+
name: "deleted_at",
|
|
137
|
+
type: "timestamp with time zone",
|
|
138
|
+
nullable: true
|
|
139
|
+
})
|
|
140
|
+
], BaseEntity.prototype, "deletedAt", 2);
|
|
141
|
+
|
|
142
|
+
// src/entities/refresh-token.entity.ts
|
|
143
|
+
import {
|
|
144
|
+
Entity,
|
|
145
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn2,
|
|
146
|
+
Column as Column2,
|
|
147
|
+
ManyToOne,
|
|
148
|
+
JoinColumn,
|
|
149
|
+
CreateDateColumn as CreateDateColumn2,
|
|
150
|
+
UpdateDateColumn as UpdateDateColumn2
|
|
151
|
+
} from "typeorm";
|
|
152
|
+
var RefreshToken = class {
|
|
153
|
+
};
|
|
154
|
+
__decorateClass([
|
|
155
|
+
PrimaryGeneratedColumn2("uuid")
|
|
156
|
+
], RefreshToken.prototype, "id", 2);
|
|
157
|
+
__decorateClass([
|
|
158
|
+
Column2({ name: "user_id", type: "integer" })
|
|
159
|
+
], RefreshToken.prototype, "userId", 2);
|
|
160
|
+
__decorateClass([
|
|
161
|
+
Column2({ name: "token_id", type: "varchar" })
|
|
162
|
+
], RefreshToken.prototype, "tokenId", 2);
|
|
163
|
+
__decorateClass([
|
|
164
|
+
Column2({ name: "device_info", type: "json", nullable: true })
|
|
165
|
+
], RefreshToken.prototype, "deviceInfo", 2);
|
|
166
|
+
__decorateClass([
|
|
167
|
+
Column2({ name: "is_revoked", type: "boolean", default: false })
|
|
168
|
+
], RefreshToken.prototype, "isRevoked", 2);
|
|
169
|
+
__decorateClass([
|
|
170
|
+
Column2({ name: "expires_at", type: "timestamp with time zone" })
|
|
171
|
+
], RefreshToken.prototype, "expiresAt", 2);
|
|
172
|
+
__decorateClass([
|
|
173
|
+
CreateDateColumn2({ name: "created_at", type: "timestamp with time zone" })
|
|
174
|
+
], RefreshToken.prototype, "createdAt", 2);
|
|
175
|
+
__decorateClass([
|
|
176
|
+
UpdateDateColumn2({ name: "updated_at", type: "timestamp with time zone" })
|
|
177
|
+
], RefreshToken.prototype, "updatedAt", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
ManyToOne(() => User, (user) => user.refreshTokens),
|
|
180
|
+
JoinColumn({ name: "user_id" })
|
|
181
|
+
], RefreshToken.prototype, "user", 2);
|
|
182
|
+
RefreshToken = __decorateClass([
|
|
183
|
+
Entity("refresh_tokens")
|
|
184
|
+
], RefreshToken);
|
|
185
|
+
|
|
186
|
+
// src/entities/user.entity.ts
|
|
187
|
+
var AccountType = /* @__PURE__ */ ((AccountType2) => {
|
|
188
|
+
AccountType2["ADMIN"] = "ADMIN";
|
|
189
|
+
AccountType2["SUB_ADMIN"] = "SUB_ADMIN";
|
|
190
|
+
AccountType2["CLIENT"] = "CLIENT";
|
|
191
|
+
AccountType2["FREELANCER"] = "FREELANCER";
|
|
192
|
+
return AccountType2;
|
|
193
|
+
})(AccountType || {});
|
|
194
|
+
var AccountStatus = /* @__PURE__ */ ((AccountStatus2) => {
|
|
195
|
+
AccountStatus2["INACTIVE"] = "INACTIVE";
|
|
196
|
+
AccountStatus2["ACTIVE"] = "ACTIVE";
|
|
197
|
+
AccountStatus2["SUSPENDED"] = "SUSPENDED";
|
|
198
|
+
AccountStatus2["BLOCKED"] = "BLOCKED";
|
|
199
|
+
return AccountStatus2;
|
|
200
|
+
})(AccountStatus || {});
|
|
201
|
+
var User = class extends BaseEntity {
|
|
202
|
+
};
|
|
203
|
+
__decorateClass([
|
|
204
|
+
Column3({ name: "unique_id", type: "varchar", unique: true })
|
|
205
|
+
], User.prototype, "uniqueId", 2);
|
|
206
|
+
__decorateClass([
|
|
207
|
+
Column3({ name: "username", type: "varchar", unique: true, nullable: true })
|
|
208
|
+
], User.prototype, "username", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
Column3({ name: "first_name", type: "varchar", length: 100, nullable: true })
|
|
211
|
+
], User.prototype, "firstName", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
Column3({ name: "last_name", type: "varchar", length: 100, nullable: true })
|
|
214
|
+
], User.prototype, "lastName", 2);
|
|
215
|
+
__decorateClass([
|
|
216
|
+
Column3({ name: "date_of_birth", type: "date", nullable: true })
|
|
217
|
+
], User.prototype, "dateOfBirth", 2);
|
|
218
|
+
__decorateClass([
|
|
219
|
+
Column3({ name: "gender", type: "varchar", length: 10, nullable: true })
|
|
220
|
+
], User.prototype, "gender", 2);
|
|
221
|
+
__decorateClass([
|
|
222
|
+
Column3({ name: "profile_picture_url", type: "text", nullable: true })
|
|
223
|
+
], User.prototype, "profilePictureUrl", 2);
|
|
224
|
+
__decorateClass([
|
|
225
|
+
Column3({ name: "email", type: "varchar", unique: true })
|
|
226
|
+
], User.prototype, "email", 2);
|
|
227
|
+
__decorateClass([
|
|
228
|
+
Column3({ name: "mobile", type: "varchar", unique: true, nullable: true })
|
|
229
|
+
], User.prototype, "mobile", 2);
|
|
230
|
+
__decorateClass([
|
|
231
|
+
Column3({ name: "password", type: "varchar" })
|
|
232
|
+
], User.prototype, "password", 2);
|
|
233
|
+
__decorateClass([
|
|
234
|
+
Column3({
|
|
235
|
+
name: "account_type",
|
|
236
|
+
type: "enum",
|
|
237
|
+
enum: AccountType,
|
|
238
|
+
default: "FREELANCER" /* FREELANCER */
|
|
239
|
+
})
|
|
240
|
+
], User.prototype, "accountType", 2);
|
|
241
|
+
__decorateClass([
|
|
242
|
+
Column3({
|
|
243
|
+
name: "account_status",
|
|
244
|
+
type: "enum",
|
|
245
|
+
enum: AccountStatus,
|
|
246
|
+
default: "INACTIVE" /* INACTIVE */
|
|
247
|
+
})
|
|
248
|
+
], User.prototype, "accountStatus", 2);
|
|
249
|
+
__decorateClass([
|
|
250
|
+
Column3({ name: "is_email_verified", type: "boolean", default: false })
|
|
251
|
+
], User.prototype, "isEmailVerified", 2);
|
|
252
|
+
__decorateClass([
|
|
253
|
+
Column3({ name: "is_mobile_verified", type: "boolean", default: false })
|
|
254
|
+
], User.prototype, "isMobileVerified", 2);
|
|
255
|
+
__decorateClass([
|
|
256
|
+
Column3({ name: "last_login_at", type: "timestamp with time zone", nullable: true })
|
|
257
|
+
], User.prototype, "lastLoginAt", 2);
|
|
258
|
+
__decorateClass([
|
|
259
|
+
Column3({ name: "last_login_ip", type: "varchar", nullable: true })
|
|
260
|
+
], User.prototype, "lastLoginIp", 2);
|
|
261
|
+
__decorateClass([
|
|
262
|
+
OneToMany(() => RefreshToken, (token) => token.user)
|
|
263
|
+
], User.prototype, "refreshTokens", 2);
|
|
264
|
+
User = __decorateClass([
|
|
265
|
+
Entity2("users")
|
|
266
|
+
], User);
|
|
83
267
|
export {
|
|
84
268
|
AUTHENTICATION_PATTERN,
|
|
269
|
+
AccountStatus,
|
|
270
|
+
AccountType,
|
|
271
|
+
RefreshToken,
|
|
272
|
+
User,
|
|
85
273
|
UserRMQAdapter,
|
|
86
274
|
UserTCPAdapter
|
|
87
275
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experts_hub/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Shared DTOs, interfaces, and utilities for experts hub applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@nestjs/microservices": "^11.0.19",
|
|
53
53
|
"@nestjs/swagger": "^11.1.2",
|
|
54
|
-
"
|
|
54
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
55
|
+
"dotenv": "^16.5.0",
|
|
56
|
+
"typeorm": "^0.3.22"
|
|
55
57
|
}
|
|
56
58
|
}
|