@flusys/nestjs-auth 5.1.1 → 5.1.3
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/cjs/dtos/company-branch.dto.js +109 -14
- package/cjs/dtos/company.dto.js +107 -12
- package/cjs/dtos/user.dto.js +34 -0
- package/cjs/services/auth-datasource.provider.js +0 -47
- package/cjs/services/branch.service.js +4 -8
- package/cjs/services/company.service.js +4 -8
- package/cjs/services/user.service.js +10 -16
- package/controllers/authentication.controller.d.ts +1 -1
- package/controllers/branch.controller.d.ts +2 -2
- package/controllers/company.controller.d.ts +2 -2
- package/controllers/user.controller.d.ts +3 -3
- package/dtos/company-branch.dto.d.ts +13 -3
- package/dtos/company.dto.d.ts +13 -3
- package/fesm/dtos/company-branch.dto.js +109 -14
- package/fesm/dtos/company.dto.js +107 -12
- package/fesm/dtos/user.dto.js +34 -0
- package/fesm/services/auth-datasource.provider.js +2 -49
- package/fesm/services/branch.service.js +5 -9
- package/fesm/services/company.service.js +5 -9
- package/fesm/services/user.service.js +11 -17
- package/interceptors/clear-token.interceptor.d.ts +1 -1
- package/interceptors/set-token.interceptor.d.ts +1 -1
- package/package.json +15 -15
- package/services/auth-datasource.provider.d.ts +0 -2
- package/services/auth-email.service.d.ts +1 -1
- package/services/authentication.service.d.ts +1 -1
- package/services/branch.service.d.ts +3 -6
- package/services/company.service.d.ts +3 -6
- package/services/user.service.d.ts +5 -8
package/cjs/dtos/user.dto.js
CHANGED
|
@@ -20,6 +20,7 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _swagger = require("@nestjs/swagger");
|
|
23
|
+
const _classtransformer = require("class-transformer");
|
|
23
24
|
const _classvalidator = require("class-validator");
|
|
24
25
|
const _passwordvalidator = require("../validators/password.validator");
|
|
25
26
|
function _define_property(obj, key, value) {
|
|
@@ -58,6 +59,7 @@ let CreateUserDto = class CreateUserDto {
|
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
_ts_decorate([
|
|
62
|
+
(0, _classtransformer.Expose)(),
|
|
61
63
|
(0, _swagger.ApiProperty)({
|
|
62
64
|
example: 'John Doe',
|
|
63
65
|
description: 'Full name'
|
|
@@ -66,6 +68,7 @@ _ts_decorate([
|
|
|
66
68
|
_ts_metadata("design:type", String)
|
|
67
69
|
], CreateUserDto.prototype, "name", void 0);
|
|
68
70
|
_ts_decorate([
|
|
71
|
+
(0, _classtransformer.Expose)(),
|
|
69
72
|
(0, _swagger.ApiPropertyOptional)({
|
|
70
73
|
example: '+1234567890',
|
|
71
74
|
description: 'Phone number'
|
|
@@ -75,6 +78,7 @@ _ts_decorate([
|
|
|
75
78
|
_ts_metadata("design:type", String)
|
|
76
79
|
], CreateUserDto.prototype, "phone", void 0);
|
|
77
80
|
_ts_decorate([
|
|
81
|
+
(0, _classtransformer.Expose)(),
|
|
78
82
|
(0, _swagger.ApiProperty)({
|
|
79
83
|
example: 'john@example.com',
|
|
80
84
|
description: 'Email address'
|
|
@@ -83,6 +87,7 @@ _ts_decorate([
|
|
|
83
87
|
_ts_metadata("design:type", String)
|
|
84
88
|
], CreateUserDto.prototype, "email", void 0);
|
|
85
89
|
_ts_decorate([
|
|
90
|
+
(0, _classtransformer.Expose)(),
|
|
86
91
|
(0, _swagger.ApiProperty)({
|
|
87
92
|
example: 'SecureP@ss123',
|
|
88
93
|
description: 'Password (must meet complexity requirements)'
|
|
@@ -94,6 +99,7 @@ _ts_decorate([
|
|
|
94
99
|
_ts_metadata("design:type", String)
|
|
95
100
|
], CreateUserDto.prototype, "password", void 0);
|
|
96
101
|
_ts_decorate([
|
|
102
|
+
(0, _classtransformer.Expose)(),
|
|
97
103
|
(0, _swagger.ApiPropertyOptional)({
|
|
98
104
|
description: 'Profile picture file ID'
|
|
99
105
|
}),
|
|
@@ -102,6 +108,7 @@ _ts_decorate([
|
|
|
102
108
|
_ts_metadata("design:type", String)
|
|
103
109
|
], CreateUserDto.prototype, "profilePictureId", void 0);
|
|
104
110
|
_ts_decorate([
|
|
111
|
+
(0, _classtransformer.Expose)(),
|
|
105
112
|
(0, _swagger.ApiPropertyOptional)({
|
|
106
113
|
default: true,
|
|
107
114
|
description: 'Is user active'
|
|
@@ -111,6 +118,7 @@ _ts_decorate([
|
|
|
111
118
|
_ts_metadata("design:type", Boolean)
|
|
112
119
|
], CreateUserDto.prototype, "isActive", void 0);
|
|
113
120
|
_ts_decorate([
|
|
121
|
+
(0, _classtransformer.Expose)(),
|
|
114
122
|
(0, _swagger.ApiPropertyOptional)({
|
|
115
123
|
default: false,
|
|
116
124
|
description: 'Is email verified'
|
|
@@ -120,6 +128,7 @@ _ts_decorate([
|
|
|
120
128
|
_ts_metadata("design:type", Boolean)
|
|
121
129
|
], CreateUserDto.prototype, "emailVerified", void 0);
|
|
122
130
|
_ts_decorate([
|
|
131
|
+
(0, _classtransformer.Expose)(),
|
|
123
132
|
(0, _swagger.ApiPropertyOptional)({
|
|
124
133
|
default: false,
|
|
125
134
|
description: 'Is phone verified'
|
|
@@ -129,6 +138,7 @@ _ts_decorate([
|
|
|
129
138
|
_ts_metadata("design:type", Boolean)
|
|
130
139
|
], CreateUserDto.prototype, "phoneVerified", void 0);
|
|
131
140
|
_ts_decorate([
|
|
141
|
+
(0, _classtransformer.Expose)(),
|
|
132
142
|
(0, _swagger.ApiPropertyOptional)({
|
|
133
143
|
description: 'Additional custom fields'
|
|
134
144
|
}),
|
|
@@ -152,6 +162,7 @@ let UpdateUserDto = class UpdateUserDto {
|
|
|
152
162
|
}
|
|
153
163
|
};
|
|
154
164
|
_ts_decorate([
|
|
165
|
+
(0, _classtransformer.Expose)(),
|
|
155
166
|
(0, _swagger.ApiProperty)({
|
|
156
167
|
description: 'User ID'
|
|
157
168
|
}),
|
|
@@ -159,6 +170,7 @@ _ts_decorate([
|
|
|
159
170
|
_ts_metadata("design:type", String)
|
|
160
171
|
], UpdateUserDto.prototype, "id", void 0);
|
|
161
172
|
_ts_decorate([
|
|
173
|
+
(0, _classtransformer.Expose)(),
|
|
162
174
|
(0, _swagger.ApiPropertyOptional)({
|
|
163
175
|
example: 'John Doe',
|
|
164
176
|
description: 'Full name'
|
|
@@ -168,6 +180,7 @@ _ts_decorate([
|
|
|
168
180
|
_ts_metadata("design:type", String)
|
|
169
181
|
], UpdateUserDto.prototype, "name", void 0);
|
|
170
182
|
_ts_decorate([
|
|
183
|
+
(0, _classtransformer.Expose)(),
|
|
171
184
|
(0, _swagger.ApiPropertyOptional)({
|
|
172
185
|
example: '+1234567890',
|
|
173
186
|
description: 'Phone number'
|
|
@@ -177,6 +190,7 @@ _ts_decorate([
|
|
|
177
190
|
_ts_metadata("design:type", String)
|
|
178
191
|
], UpdateUserDto.prototype, "phone", void 0);
|
|
179
192
|
_ts_decorate([
|
|
193
|
+
(0, _classtransformer.Expose)(),
|
|
180
194
|
(0, _swagger.ApiPropertyOptional)({
|
|
181
195
|
example: 'john@example.com',
|
|
182
196
|
description: 'Email address'
|
|
@@ -186,6 +200,7 @@ _ts_decorate([
|
|
|
186
200
|
_ts_metadata("design:type", String)
|
|
187
201
|
], UpdateUserDto.prototype, "email", void 0);
|
|
188
202
|
_ts_decorate([
|
|
203
|
+
(0, _classtransformer.Expose)(),
|
|
189
204
|
(0, _swagger.ApiPropertyOptional)({
|
|
190
205
|
description: 'New password (must meet complexity requirements)'
|
|
191
206
|
}),
|
|
@@ -196,6 +211,7 @@ _ts_decorate([
|
|
|
196
211
|
_ts_metadata("design:type", String)
|
|
197
212
|
], UpdateUserDto.prototype, "password", void 0);
|
|
198
213
|
_ts_decorate([
|
|
214
|
+
(0, _classtransformer.Expose)(),
|
|
199
215
|
(0, _swagger.ApiPropertyOptional)({
|
|
200
216
|
description: 'Current password (required when changing password on own profile)'
|
|
201
217
|
}),
|
|
@@ -204,6 +220,7 @@ _ts_decorate([
|
|
|
204
220
|
_ts_metadata("design:type", String)
|
|
205
221
|
], UpdateUserDto.prototype, "oldPassword", void 0);
|
|
206
222
|
_ts_decorate([
|
|
223
|
+
(0, _classtransformer.Expose)(),
|
|
207
224
|
(0, _swagger.ApiPropertyOptional)({
|
|
208
225
|
description: 'Profile picture file ID'
|
|
209
226
|
}),
|
|
@@ -212,6 +229,7 @@ _ts_decorate([
|
|
|
212
229
|
_ts_metadata("design:type", String)
|
|
213
230
|
], UpdateUserDto.prototype, "profilePictureId", void 0);
|
|
214
231
|
_ts_decorate([
|
|
232
|
+
(0, _classtransformer.Expose)(),
|
|
215
233
|
(0, _swagger.ApiPropertyOptional)({
|
|
216
234
|
description: 'Is user active'
|
|
217
235
|
}),
|
|
@@ -220,6 +238,7 @@ _ts_decorate([
|
|
|
220
238
|
_ts_metadata("design:type", Boolean)
|
|
221
239
|
], UpdateUserDto.prototype, "isActive", void 0);
|
|
222
240
|
_ts_decorate([
|
|
241
|
+
(0, _classtransformer.Expose)(),
|
|
223
242
|
(0, _swagger.ApiPropertyOptional)({
|
|
224
243
|
description: 'Is email verified'
|
|
225
244
|
}),
|
|
@@ -228,6 +247,7 @@ _ts_decorate([
|
|
|
228
247
|
_ts_metadata("design:type", Boolean)
|
|
229
248
|
], UpdateUserDto.prototype, "emailVerified", void 0);
|
|
230
249
|
_ts_decorate([
|
|
250
|
+
(0, _classtransformer.Expose)(),
|
|
231
251
|
(0, _swagger.ApiPropertyOptional)({
|
|
232
252
|
description: 'Is phone verified'
|
|
233
253
|
}),
|
|
@@ -236,6 +256,7 @@ _ts_decorate([
|
|
|
236
256
|
_ts_metadata("design:type", Boolean)
|
|
237
257
|
], UpdateUserDto.prototype, "phoneVerified", void 0);
|
|
238
258
|
_ts_decorate([
|
|
259
|
+
(0, _classtransformer.Expose)(),
|
|
239
260
|
(0, _swagger.ApiPropertyOptional)({
|
|
240
261
|
description: 'Additional custom fields'
|
|
241
262
|
}),
|
|
@@ -261,18 +282,21 @@ let UserResponseDto = class UserResponseDto {
|
|
|
261
282
|
}
|
|
262
283
|
};
|
|
263
284
|
_ts_decorate([
|
|
285
|
+
(0, _classtransformer.Expose)(),
|
|
264
286
|
(0, _swagger.ApiProperty)({
|
|
265
287
|
example: '550e8400-e29b-41d4-a716-446655440000'
|
|
266
288
|
}),
|
|
267
289
|
_ts_metadata("design:type", String)
|
|
268
290
|
], UserResponseDto.prototype, "id", void 0);
|
|
269
291
|
_ts_decorate([
|
|
292
|
+
(0, _classtransformer.Expose)(),
|
|
270
293
|
(0, _swagger.ApiProperty)({
|
|
271
294
|
example: 'John Doe'
|
|
272
295
|
}),
|
|
273
296
|
_ts_metadata("design:type", String)
|
|
274
297
|
], UserResponseDto.prototype, "name", void 0);
|
|
275
298
|
_ts_decorate([
|
|
299
|
+
(0, _classtransformer.Expose)(),
|
|
276
300
|
(0, _swagger.ApiPropertyOptional)({
|
|
277
301
|
example: '+1-555-123-4567',
|
|
278
302
|
nullable: true
|
|
@@ -280,12 +304,14 @@ _ts_decorate([
|
|
|
280
304
|
_ts_metadata("design:type", Object)
|
|
281
305
|
], UserResponseDto.prototype, "phone", void 0);
|
|
282
306
|
_ts_decorate([
|
|
307
|
+
(0, _classtransformer.Expose)(),
|
|
283
308
|
(0, _swagger.ApiProperty)({
|
|
284
309
|
example: 'john@example.com'
|
|
285
310
|
}),
|
|
286
311
|
_ts_metadata("design:type", String)
|
|
287
312
|
], UserResponseDto.prototype, "email", void 0);
|
|
288
313
|
_ts_decorate([
|
|
314
|
+
(0, _classtransformer.Expose)(),
|
|
289
315
|
(0, _swagger.ApiPropertyOptional)({
|
|
290
316
|
example: 'pic_abc123',
|
|
291
317
|
nullable: true
|
|
@@ -293,24 +319,28 @@ _ts_decorate([
|
|
|
293
319
|
_ts_metadata("design:type", Object)
|
|
294
320
|
], UserResponseDto.prototype, "profilePictureId", void 0);
|
|
295
321
|
_ts_decorate([
|
|
322
|
+
(0, _classtransformer.Expose)(),
|
|
296
323
|
(0, _swagger.ApiProperty)({
|
|
297
324
|
example: true
|
|
298
325
|
}),
|
|
299
326
|
_ts_metadata("design:type", Boolean)
|
|
300
327
|
], UserResponseDto.prototype, "isActive", void 0);
|
|
301
328
|
_ts_decorate([
|
|
329
|
+
(0, _classtransformer.Expose)(),
|
|
302
330
|
(0, _swagger.ApiProperty)({
|
|
303
331
|
example: true
|
|
304
332
|
}),
|
|
305
333
|
_ts_metadata("design:type", Boolean)
|
|
306
334
|
], UserResponseDto.prototype, "emailVerified", void 0);
|
|
307
335
|
_ts_decorate([
|
|
336
|
+
(0, _classtransformer.Expose)(),
|
|
308
337
|
(0, _swagger.ApiProperty)({
|
|
309
338
|
example: false
|
|
310
339
|
}),
|
|
311
340
|
_ts_metadata("design:type", Boolean)
|
|
312
341
|
], UserResponseDto.prototype, "phoneVerified", void 0);
|
|
313
342
|
_ts_decorate([
|
|
343
|
+
(0, _classtransformer.Expose)(),
|
|
314
344
|
(0, _swagger.ApiPropertyOptional)({
|
|
315
345
|
example: '2024-12-18T10:30:00.000Z',
|
|
316
346
|
nullable: true
|
|
@@ -318,6 +348,7 @@ _ts_decorate([
|
|
|
318
348
|
_ts_metadata("design:type", Object)
|
|
319
349
|
], UserResponseDto.prototype, "lastLoginAt", void 0);
|
|
320
350
|
_ts_decorate([
|
|
351
|
+
(0, _classtransformer.Expose)(),
|
|
321
352
|
(0, _swagger.ApiPropertyOptional)({
|
|
322
353
|
example: {
|
|
323
354
|
department: 'Engineering',
|
|
@@ -328,18 +359,21 @@ _ts_decorate([
|
|
|
328
359
|
_ts_metadata("design:type", Object)
|
|
329
360
|
], UserResponseDto.prototype, "additionalFields", void 0);
|
|
330
361
|
_ts_decorate([
|
|
362
|
+
(0, _classtransformer.Expose)(),
|
|
331
363
|
(0, _swagger.ApiProperty)({
|
|
332
364
|
example: '2024-01-15T10:30:00.000Z'
|
|
333
365
|
}),
|
|
334
366
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
335
367
|
], UserResponseDto.prototype, "createdAt", void 0);
|
|
336
368
|
_ts_decorate([
|
|
369
|
+
(0, _classtransformer.Expose)(),
|
|
337
370
|
(0, _swagger.ApiProperty)({
|
|
338
371
|
example: '2024-12-18T14:45:00.000Z'
|
|
339
372
|
}),
|
|
340
373
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
341
374
|
], UserResponseDto.prototype, "updatedAt", void 0);
|
|
342
375
|
_ts_decorate([
|
|
376
|
+
(0, _classtransformer.Expose)(),
|
|
343
377
|
(0, _swagger.ApiPropertyOptional)({
|
|
344
378
|
example: null,
|
|
345
379
|
nullable: true
|
|
@@ -83,53 +83,6 @@ function _ts_param(paramIndex, decorator) {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
let AuthDataSourceProvider = class AuthDataSourceProvider extends _nestjsshared.MultiTenantDataSourceService {
|
|
86
|
-
async getSingleDataSource() {
|
|
87
|
-
if (!AuthDataSourceProvider.singleDataSource) {
|
|
88
|
-
if (AuthDataSourceProvider.singleConnectionLock) {
|
|
89
|
-
return AuthDataSourceProvider.singleConnectionLock;
|
|
90
|
-
}
|
|
91
|
-
const lockPromise = (async ()=>{
|
|
92
|
-
const config = this.getDefaultDatabaseConfig();
|
|
93
|
-
if (!config) {
|
|
94
|
-
throw new _common.InternalServerErrorException({
|
|
95
|
-
message: 'Default database config is not available',
|
|
96
|
-
messageKey: _nestjsshared.SYSTEM_MESSAGES.DATABASE_CONFIG_NOT_AVAILABLE
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const ds = await this.createDataSourceFromConfig(config);
|
|
100
|
-
AuthDataSourceProvider.singleDataSource = ds;
|
|
101
|
-
AuthDataSourceProvider.initialized = true;
|
|
102
|
-
return ds;
|
|
103
|
-
})();
|
|
104
|
-
AuthDataSourceProvider.singleConnectionLock = lockPromise;
|
|
105
|
-
try {
|
|
106
|
-
return await lockPromise;
|
|
107
|
-
} finally{
|
|
108
|
-
AuthDataSourceProvider.singleConnectionLock = null;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return AuthDataSourceProvider.singleDataSource;
|
|
112
|
-
}
|
|
113
|
-
async getOrCreateTenantConnection(tenant) {
|
|
114
|
-
const existing = AuthDataSourceProvider.tenantConnections.get(tenant.id);
|
|
115
|
-
if (existing?.isInitialized) {
|
|
116
|
-
return existing;
|
|
117
|
-
}
|
|
118
|
-
const pendingConnection = AuthDataSourceProvider.connectionLocks.get(tenant.id);
|
|
119
|
-
if (pendingConnection) {
|
|
120
|
-
return pendingConnection;
|
|
121
|
-
}
|
|
122
|
-
const config = this.buildTenantDatabaseConfig(tenant);
|
|
123
|
-
const connectionPromise = this.createDataSourceFromConfig(config);
|
|
124
|
-
AuthDataSourceProvider.connectionLocks.set(tenant.id, connectionPromise);
|
|
125
|
-
try {
|
|
126
|
-
const dataSource = await connectionPromise;
|
|
127
|
-
AuthDataSourceProvider.tenantConnections.set(tenant.id, dataSource);
|
|
128
|
-
return dataSource;
|
|
129
|
-
} finally{
|
|
130
|
-
AuthDataSourceProvider.connectionLocks.delete(tenant.id);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
86
|
static buildParentOptions(options) {
|
|
134
87
|
return {
|
|
135
88
|
bootstrapAppConfig: options.bootstrapAppConfig,
|
|
@@ -42,13 +42,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
42
42
|
decorator(target, key, paramIndex);
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
let BranchService = class BranchService extends _classes.
|
|
46
|
-
resolveEntity() {
|
|
47
|
-
return _companybranchentity.CompanyBranch;
|
|
48
|
-
}
|
|
49
|
-
getDataSourceProvider() {
|
|
50
|
-
return this.dataSourceProvider;
|
|
51
|
-
}
|
|
45
|
+
let BranchService = class BranchService extends _classes.ApiService {
|
|
52
46
|
// Query Customization
|
|
53
47
|
async getSelectQuery(query, _user, select) {
|
|
54
48
|
if (!select?.length) {
|
|
@@ -56,6 +50,8 @@ let BranchService = class BranchService extends _classes.RequestScopedApiService
|
|
|
56
50
|
'id',
|
|
57
51
|
'name',
|
|
58
52
|
'slug',
|
|
53
|
+
'email',
|
|
54
|
+
'phone',
|
|
59
55
|
'isActive',
|
|
60
56
|
'createdAt'
|
|
61
57
|
];
|
|
@@ -89,7 +85,7 @@ let BranchService = class BranchService extends _classes.RequestScopedApiService
|
|
|
89
85
|
return result;
|
|
90
86
|
}
|
|
91
87
|
constructor(cacheManager, utilsService, dataSourceProvider, authConfig){
|
|
92
|
-
super('company_branch',
|
|
88
|
+
super('company_branch', cacheManager, utilsService, BranchService.name, true, 'auth', _companybranchentity.CompanyBranch, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "authConfig", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.authConfig = authConfig;
|
|
93
89
|
}
|
|
94
90
|
};
|
|
95
91
|
BranchService = _ts_decorate([
|
|
@@ -40,13 +40,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
40
40
|
decorator(target, key, paramIndex);
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
let CompanyService = class CompanyService extends _classes.
|
|
44
|
-
resolveEntity() {
|
|
45
|
-
return _companyentity.Company;
|
|
46
|
-
}
|
|
47
|
-
getDataSourceProvider() {
|
|
48
|
-
return this.dataSourceProvider;
|
|
49
|
-
}
|
|
43
|
+
let CompanyService = class CompanyService extends _classes.ApiService {
|
|
50
44
|
// Query Customization
|
|
51
45
|
async getSelectQuery(query, _user, select) {
|
|
52
46
|
if (!select?.length) {
|
|
@@ -54,6 +48,8 @@ let CompanyService = class CompanyService extends _classes.RequestScopedApiServi
|
|
|
54
48
|
'id',
|
|
55
49
|
'name',
|
|
56
50
|
'slug',
|
|
51
|
+
'email',
|
|
52
|
+
'phone',
|
|
57
53
|
'isActive',
|
|
58
54
|
'createdAt'
|
|
59
55
|
];
|
|
@@ -74,7 +70,7 @@ let CompanyService = class CompanyService extends _classes.RequestScopedApiServi
|
|
|
74
70
|
};
|
|
75
71
|
}
|
|
76
72
|
constructor(cacheManager, utilsService, dataSourceProvider){
|
|
77
|
-
super('company',
|
|
73
|
+
super('company', cacheManager, utilsService, CompanyService.name, true, 'auth', _companyentity.Company, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService;
|
|
78
74
|
}
|
|
79
75
|
};
|
|
80
76
|
CompanyService = _ts_decorate([
|
|
@@ -91,18 +91,12 @@ function _ts_param(paramIndex, decorator) {
|
|
|
91
91
|
decorator(target, key, paramIndex);
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
let UserService = class UserService extends _classes.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
getDataSourceProvider() {
|
|
99
|
-
return this.dataSourceProvider;
|
|
100
|
-
}
|
|
101
|
-
async ensureRepositoryInitialized() {
|
|
102
|
-
await super.ensureRepositoryInitialized();
|
|
94
|
+
let UserService = class UserService extends _classes.ApiService {
|
|
95
|
+
async ensureDataSourceRepository() {
|
|
96
|
+
await super.ensureDataSourceRepository();
|
|
103
97
|
const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
|
|
104
98
|
if (isCompanyFeatureEnabled && !this.permissionRepository) {
|
|
105
|
-
[this.permissionRepository] = await this.
|
|
99
|
+
[this.permissionRepository] = await this.resolveRepositories([
|
|
106
100
|
_usercompanypermissionentity.UserCompanyPermission
|
|
107
101
|
]);
|
|
108
102
|
}
|
|
@@ -117,7 +111,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
117
111
|
messageKey: _config.AUTH_MESSAGES.PROFILE_ACCESS_DENIED
|
|
118
112
|
});
|
|
119
113
|
}
|
|
120
|
-
await this.
|
|
114
|
+
await this.ensureDataSourceRepository();
|
|
121
115
|
const userEntity = await this.repository.findOne({
|
|
122
116
|
where: {
|
|
123
117
|
id: userId
|
|
@@ -132,7 +126,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
132
126
|
return userEntity;
|
|
133
127
|
}
|
|
134
128
|
async verifyEmail(id) {
|
|
135
|
-
await this.
|
|
129
|
+
await this.ensureDataSourceRepository();
|
|
136
130
|
await this.repository.update(id, {
|
|
137
131
|
emailVerified: true
|
|
138
132
|
});
|
|
@@ -143,7 +137,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
143
137
|
]);
|
|
144
138
|
}
|
|
145
139
|
async verifyPhone(id) {
|
|
146
|
-
await this.
|
|
140
|
+
await this.ensureDataSourceRepository();
|
|
147
141
|
await this.repository.update(id, {
|
|
148
142
|
phoneVerified: true
|
|
149
143
|
});
|
|
@@ -154,7 +148,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
154
148
|
]);
|
|
155
149
|
}
|
|
156
150
|
async updateStatus(id, isActive, user) {
|
|
157
|
-
await this.
|
|
151
|
+
await this.ensureDataSourceRepository();
|
|
158
152
|
const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
|
|
159
153
|
if (isCompanyFeatureEnabled && user?.companyId && this.permissionRepository) {
|
|
160
154
|
const permission = await this.permissionRepository.findOne({
|
|
@@ -495,7 +489,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
495
489
|
return 100;
|
|
496
490
|
}
|
|
497
491
|
async profile(dto, user) {
|
|
498
|
-
await this.
|
|
492
|
+
await this.ensureDataSourceRepository();
|
|
499
493
|
if (!this.dataSource) {
|
|
500
494
|
throw new _common.BadRequestException({
|
|
501
495
|
message: 'DataSource not available',
|
|
@@ -559,7 +553,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
559
553
|
}
|
|
560
554
|
}
|
|
561
555
|
constructor(cacheManager, utilsService, dataSourceProvider, authConfig, userEnricher){
|
|
562
|
-
super('appuser',
|
|
556
|
+
super('appuser', cacheManager, utilsService, UserService.name, true, 'auth', _appuserentity.AppUser, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "authConfig", void 0), _define_property(this, "userEnricher", void 0), _define_property(this, "permissionRepository", void 0), _define_property(this, "dataSource", void 0), _define_property(this, "logAdapter", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.authConfig = authConfig, this.userEnricher = userEnricher, this.logAdapter = (0, _classes.createModuleLogger)(this.constructor.name);
|
|
563
557
|
}
|
|
564
558
|
};
|
|
565
559
|
_ts_decorate([
|
|
@@ -7,7 +7,7 @@ import { AuthenticationService } from '../services/authentication.service';
|
|
|
7
7
|
export declare class AuthenticationController {
|
|
8
8
|
private readonly authService;
|
|
9
9
|
private readonly authConfig?;
|
|
10
|
-
constructor(authService: AuthenticationService, authConfig?: AuthConfigService);
|
|
10
|
+
constructor(authService: AuthenticationService, authConfig?: AuthConfigService | undefined);
|
|
11
11
|
login(loginDto: LoginDto): Promise<SingleResponseDto<LoginResponseDto | CompanySelectionResponseDto | LoginResponseRequiresEmailVerificationDto>>;
|
|
12
12
|
register(req: Request, registrationDto: RegistrationDto): Promise<SingleResponseDto<RegistrationResponseDto>>;
|
|
13
13
|
refreshToken(req: Request, refreshTokenDto: RefreshTokenDto): Promise<SingleResponseDto<{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CompanyBranchResponseDto, CreateCompanyBranchDto, UpdateCompanyBranchDto } from '../dtos/company-branch.dto';
|
|
2
2
|
import { BranchService } from '../services/branch.service';
|
|
3
3
|
declare const BranchController_base: abstract new (service: BranchService) => {
|
|
4
|
-
readonly enabledEndpoints: import("@flusys/nestjs-shared
|
|
4
|
+
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
5
5
|
service: BranchService;
|
|
6
|
-
isEnabled(endpoint: import("@flusys/nestjs-shared
|
|
6
|
+
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
7
7
|
insert(addDto: CreateCompanyBranchDto, user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<CompanyBranchResponseDto>>;
|
|
8
8
|
insertMany(addDto: CreateCompanyBranchDto[], user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<CompanyBranchResponseDto>>;
|
|
9
9
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<CompanyBranchResponseDto>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CompanyResponseDto, CreateCompanyDto, UpdateCompanyDto } from '../dtos/company.dto';
|
|
2
2
|
import { CompanyService } from '../services/company.service';
|
|
3
3
|
declare const CompanyController_base: abstract new (service: CompanyService) => {
|
|
4
|
-
readonly enabledEndpoints: import("@flusys/nestjs-shared
|
|
4
|
+
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
5
5
|
service: CompanyService;
|
|
6
|
-
isEnabled(endpoint: import("@flusys/nestjs-shared
|
|
6
|
+
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
7
7
|
insert(addDto: CreateCompanyDto, user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<CompanyResponseDto>>;
|
|
8
8
|
insertMany(addDto: CreateCompanyDto[], user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<CompanyResponseDto>>;
|
|
9
9
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: import("@flusys/nestjs-shared").ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<CompanyResponseDto>>;
|
|
@@ -3,9 +3,9 @@ import { CreateUserDto, UpdateUserDto, UserResponseDto } from '../dtos/user.dto'
|
|
|
3
3
|
import { IUser } from '../interfaces/user.interface';
|
|
4
4
|
import { UserService } from '../services/user.service';
|
|
5
5
|
declare const UserController_base: abstract new (service: UserService) => {
|
|
6
|
-
readonly enabledEndpoints: import("@flusys/nestjs-shared
|
|
6
|
+
readonly enabledEndpoints: import("@flusys/nestjs-shared").ApiEndpoint[] | "all";
|
|
7
7
|
service: UserService;
|
|
8
|
-
isEnabled(endpoint: import("@flusys/nestjs-shared
|
|
8
|
+
isEnabled(endpoint: import("@flusys/nestjs-shared").ApiEndpoint): boolean;
|
|
9
9
|
insert(addDto: CreateUserDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<UserResponseDto>>;
|
|
10
10
|
insertMany(addDto: CreateUserDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").BulkResponseDto<UserResponseDto>>;
|
|
11
11
|
getById(id: string, body: import("@flusys/nestjs-shared").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared").SingleResponseDto<UserResponseDto>>;
|
|
@@ -60,7 +60,7 @@ export declare class UserController extends UserController_base {
|
|
|
60
60
|
success: boolean;
|
|
61
61
|
message: string;
|
|
62
62
|
messageKey: "user.profile.section.data.success";
|
|
63
|
-
data: import("..").IProfileSectionData;
|
|
63
|
+
data: import("..").IProfileSectionData | null;
|
|
64
64
|
}>;
|
|
65
65
|
updateProfileSection(id: string, sectionId: string, data: Record<string, any>, user: ILoggedUserInfo): Promise<{
|
|
66
66
|
success: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
1
2
|
export declare class CreateCompanyBranchDto {
|
|
2
3
|
name: string;
|
|
3
4
|
slug: string;
|
|
@@ -15,9 +16,18 @@ declare const UpdateCompanyBranchDto_base: import("@nestjs/common").Type<Partial
|
|
|
15
16
|
export declare class UpdateCompanyBranchDto extends UpdateCompanyBranchDto_base {
|
|
16
17
|
id: string;
|
|
17
18
|
}
|
|
18
|
-
export declare class CompanyBranchResponseDto extends
|
|
19
|
+
export declare class CompanyBranchResponseDto extends IdentityResponseDto {
|
|
20
|
+
name: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
companyId: string;
|
|
23
|
+
parentId?: string | null;
|
|
24
|
+
logoId?: string | null;
|
|
25
|
+
address?: string | null;
|
|
26
|
+
phone?: string | null;
|
|
27
|
+
email?: string | null;
|
|
28
|
+
serial?: number | null;
|
|
29
|
+
isActive: boolean;
|
|
19
30
|
readOnly: boolean;
|
|
20
|
-
|
|
21
|
-
updatedAt: Date;
|
|
31
|
+
additionalFields?: Record<string, any> | null;
|
|
22
32
|
}
|
|
23
33
|
export {};
|
package/dtos/company.dto.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
1
2
|
export declare class CreateCompanyDto {
|
|
2
3
|
name: string;
|
|
3
4
|
slug: string;
|
|
@@ -15,9 +16,18 @@ declare const UpdateCompanyDto_base: import("@nestjs/common").Type<Partial<Creat
|
|
|
15
16
|
export declare class UpdateCompanyDto extends UpdateCompanyDto_base {
|
|
16
17
|
id: string;
|
|
17
18
|
}
|
|
18
|
-
export declare class CompanyResponseDto extends
|
|
19
|
+
export declare class CompanyResponseDto extends IdentityResponseDto {
|
|
20
|
+
name: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
logoId?: string | null;
|
|
23
|
+
address?: string | null;
|
|
24
|
+
phone?: string | null;
|
|
25
|
+
email?: string | null;
|
|
26
|
+
website?: string | null;
|
|
27
|
+
serial?: number | null;
|
|
28
|
+
isActive: boolean;
|
|
19
29
|
readOnly: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
settings?: Record<string, any> | null;
|
|
31
|
+
additionalFields?: Record<string, any> | null;
|
|
22
32
|
}
|
|
23
33
|
export {};
|