@culturefy/shared 1.0.32 → 1.0.34
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/build/cjs/enums/secretKeys.enum.js +1 -0
- package/build/cjs/enums/secretKeys.enum.js.map +1 -1
- package/build/cjs/middlewares/token-validation.js +15 -462
- package/build/cjs/middlewares/token-validation.js.map +1 -1
- package/build/cjs/models/user.model.js +272 -366
- package/build/cjs/models/user.model.js.map +1 -1
- package/build/cjs/service/user.service.js +89 -84
- package/build/cjs/service/user.service.js.map +1 -1
- package/build/esm/enums/secretKeys.enum.js +1 -0
- package/build/esm/enums/secretKeys.enum.js.map +1 -1
- package/build/esm/middlewares/token-validation.js +16 -463
- package/build/esm/middlewares/token-validation.js.map +1 -1
- package/build/esm/models/user.model.js +272 -366
- package/build/esm/models/user.model.js.map +1 -1
- package/build/esm/service/user.service.js +89 -85
- package/build/esm/service/user.service.js.map +1 -1
- package/build/src/enums/secretKeys.enum.d.ts +2 -1
- package/build/src/enums/secretKeys.enum.js +1 -0
- package/build/src/enums/secretKeys.enum.js.map +1 -1
- package/build/src/middlewares/token-validation.d.ts +1 -1
- package/build/src/middlewares/token-validation.js +16 -314
- package/build/src/middlewares/token-validation.js.map +1 -1
- package/build/src/models/user.model.d.ts +0 -5
- package/build/src/models/user.model.js +266 -263
- package/build/src/models/user.model.js.map +1 -1
- package/build/src/service/user.service.d.ts +0 -6
- package/build/src/service/user.service.js +1 -107
- package/build/src/service/user.service.js.map +1 -1
- package/package.json +1 -1
- package/src/enums/secretKeys.enum.ts +1 -0
- package/src/middlewares/token-validation.ts +19 -432
- package/src/models/user.model.ts +265 -265
- package/src/service/user.service.ts +79 -77
package/src/models/user.model.ts
CHANGED
|
@@ -218,273 +218,273 @@ export default interface IUser {
|
|
|
218
218
|
youtubeAuthTokens?: UserYoutubeAuthTokensDTO
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
const otpSchema = new Schema({
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
});
|
|
221
|
+
// const otpSchema = new Schema({
|
|
222
|
+
// otp: { type: String, required: true },
|
|
223
|
+
// expiresAt: { type: Date, required: true }
|
|
224
|
+
// });
|
|
225
225
|
|
|
226
|
-
const schema = new Schema<IUser>(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
226
|
+
// const schema = new Schema<IUser>(
|
|
227
|
+
// {
|
|
228
|
+
// email: {
|
|
229
|
+
// type: Schema.Types.String,
|
|
230
|
+
// required: false,
|
|
231
|
+
// // unique: true,
|
|
232
|
+
// trim: true,
|
|
233
|
+
// // select: false,
|
|
234
|
+
// },
|
|
235
|
+
// userId: {
|
|
236
|
+
// type: Schema.Types.ObjectId,
|
|
237
|
+
// required: false,
|
|
238
|
+
// },
|
|
239
|
+
// employeeId: {
|
|
240
|
+
// type: Schema.Types.String,
|
|
241
|
+
// required: false,
|
|
242
|
+
// },
|
|
243
|
+
// password: {
|
|
244
|
+
// type: Schema.Types.String,
|
|
245
|
+
// required: false,
|
|
246
|
+
// select: false,
|
|
247
|
+
// },
|
|
248
|
+
// profileviews: {
|
|
249
|
+
// type: Schema.Types.Number,
|
|
250
|
+
// required: false,
|
|
251
|
+
// default: 0,
|
|
252
|
+
// },
|
|
253
|
+
// profilePicUrl: {
|
|
254
|
+
// type: Schema.Types.String,
|
|
255
|
+
// required: false,
|
|
256
|
+
// trim: true,
|
|
257
|
+
// },
|
|
258
|
+
// cultureGroup: [{ type: Schema.Types.ObjectId, required: false, ref: 'Cultur' }],
|
|
259
|
+
// firstName: {
|
|
260
|
+
// type: Schema.Types.String,
|
|
261
|
+
// required: false,
|
|
262
|
+
// trim: true,
|
|
263
|
+
// },
|
|
264
|
+
// lastName: {
|
|
265
|
+
// type: Schema.Types.String,
|
|
266
|
+
// required: false,
|
|
267
|
+
// trim: true,
|
|
268
|
+
// },
|
|
269
|
+
// dateOfBirth: {
|
|
270
|
+
// type: Schema.Types.Date,
|
|
271
|
+
// required: false,
|
|
272
|
+
// },
|
|
273
|
+
// phoneNumber: {
|
|
274
|
+
// type: Schema.Types.String,
|
|
275
|
+
// required: false,
|
|
276
|
+
// },
|
|
277
|
+
// location: {
|
|
278
|
+
// type: Schema.Types.Mixed,
|
|
279
|
+
// required: false,
|
|
280
|
+
// },
|
|
281
|
+
// role: {
|
|
282
|
+
// type: Schema.Types.ObjectId,
|
|
283
|
+
// required: false,
|
|
284
|
+
// },
|
|
285
|
+
// roleId: {
|
|
286
|
+
// type: Schema.Types.ObjectId,
|
|
287
|
+
// required: false,
|
|
288
|
+
// },
|
|
289
|
+
// business: {
|
|
290
|
+
// type: Schema.Types.ObjectId,
|
|
291
|
+
// ref: 'Businesses',
|
|
292
|
+
// required: false,
|
|
293
|
+
// },
|
|
294
|
+
// following: {
|
|
295
|
+
// type: [Schema.Types.ObjectId],
|
|
296
|
+
// ref: USER_DOCUMENT_NAME,
|
|
297
|
+
// required: false,
|
|
298
|
+
// default: []
|
|
299
|
+
// },
|
|
300
|
+
// businessId: {
|
|
301
|
+
// type: Schema.Types.ObjectId,
|
|
302
|
+
// ref: 'Businesses',
|
|
303
|
+
// required: false,
|
|
304
|
+
// // strictPopulate: false,
|
|
305
|
+
// },
|
|
306
|
+
// fcm_token: { type: Schema.Types.Array, required: false },
|
|
307
|
+
// bio: { type: Schema.Types.String, required: false },
|
|
308
|
+
// gender: { type: Schema.Types.String, required: false },
|
|
309
|
+
// skills: [{ type: Schema.Types.ObjectId, required: false, ref: 'userSkills' }],
|
|
310
|
+
// website: { type: Schema.Types.String, required: false },
|
|
311
|
+
// socialLinks: {
|
|
312
|
+
// facebook: { type: Schema.Types.String, required: false },
|
|
313
|
+
// linkedin: { type: Schema.Types.String, required: false },
|
|
314
|
+
// instagram: { type: Schema.Types.String, required: false },
|
|
315
|
+
// twitter: { type: Schema.Types.String, required: false },
|
|
316
|
+
// },
|
|
317
|
+
// lifeExperience: [{ type: Schema.Types.ObjectId, required: false, ref: 'Life' }],
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
// position: { type: Schema.Types.String, required: false },
|
|
320
|
+
// isMentor: { type: Schema.Types.Boolean, required: false },
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
// permissions: [{ type: Schema.Types.Mixed, required: false }],
|
|
323
|
+
// businessQuestionsAnswered: {
|
|
324
|
+
// type: Schema.Types.Boolean,
|
|
325
|
+
// required: false,
|
|
326
|
+
// default: true
|
|
327
|
+
// },
|
|
328
328
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
);
|
|
329
|
+
// type: {
|
|
330
|
+
// type: Schema.Types.String,
|
|
331
|
+
// required: false,
|
|
332
|
+
// // enum: [USER_TYPE.ADMIN, USER_TYPE.SUPER_ADMIN, USER_TYPE.USER]
|
|
333
|
+
// },
|
|
334
|
+
// reward: {
|
|
335
|
+
// points: { type: Schema.Types.Number, default: 0, min: 0 },
|
|
336
|
+
// pointsToSend: { type: Schema.Types.Number, default: 0, min: 0 },
|
|
337
|
+
// pointsToReedem: { type: Schema.Types.Number, default: 0, min: 0 },
|
|
338
|
+
// amount: { type: Schema.Types.Number, default: 0, min: 0 },
|
|
339
|
+
// },
|
|
340
|
+
// verified: {
|
|
341
|
+
// type: Schema.Types.Boolean,
|
|
342
|
+
// default: false,
|
|
343
|
+
// },
|
|
344
|
+
// blocked_transactions: {
|
|
345
|
+
// type: Schema.Types.Boolean,
|
|
346
|
+
// default: false,
|
|
347
|
+
// },
|
|
348
|
+
// status: {
|
|
349
|
+
// type: Schema.Types.Boolean,
|
|
350
|
+
// default: true,
|
|
351
|
+
// },
|
|
352
|
+
// createdAt: {
|
|
353
|
+
// type: Date,
|
|
354
|
+
// required: false,
|
|
355
|
+
// select: false,
|
|
356
|
+
// },
|
|
357
|
+
// updatedAt: {
|
|
358
|
+
// type: Date,
|
|
359
|
+
// required: false,
|
|
360
|
+
// select: false,
|
|
361
|
+
// },
|
|
362
|
+
// invitationHash: { type: Schema.Types.String, required: false },
|
|
363
|
+
// invitationHashExpiryDate: { type: Schema.Types.Date, required: false },
|
|
364
|
+
// isinvitationHashExpired: { type: Schema.Types.Boolean, default: false },
|
|
365
|
+
// coverPicUrl: { type: Schema.Types.String, required: false },
|
|
366
|
+
// isDeleted: {
|
|
367
|
+
// type: Schema.Types.Boolean,
|
|
368
|
+
// default: false,
|
|
369
|
+
// },
|
|
370
|
+
// isActive: {
|
|
371
|
+
// type: Schema.Types.Boolean,
|
|
372
|
+
// default: false,
|
|
373
|
+
// },
|
|
374
|
+
// departmentId: {
|
|
375
|
+
// type: Schema.Types.ObjectId,
|
|
376
|
+
// required: false,
|
|
377
|
+
// },
|
|
378
|
+
// mentorship: {
|
|
379
|
+
// isOpenToMentorship: { type: Schema.Types.Boolean, default: false },
|
|
380
|
+
// isLookingForMentorship: { type: Schema.Types.Boolean, default: false }
|
|
381
|
+
// },
|
|
382
|
+
// ethnicity: {
|
|
383
|
+
// type: Schema.Types.String,
|
|
384
|
+
// required: false,
|
|
385
|
+
// },
|
|
386
|
+
// personOfColor: {
|
|
387
|
+
// type: Schema.Types.String,
|
|
388
|
+
// required: false,
|
|
389
|
+
// },
|
|
390
|
+
// tenure: {
|
|
391
|
+
// type: Schema.Types.Number,
|
|
392
|
+
// required: false,
|
|
393
|
+
// },
|
|
394
|
+
// satisfactionLevel: {
|
|
395
|
+
// type: Schema.Types.Number,
|
|
396
|
+
// required: false,
|
|
397
|
+
// },
|
|
398
|
+
// satisfactionLevelDate: {
|
|
399
|
+
// type: Schema.Types.Date,
|
|
400
|
+
// required: false,
|
|
401
|
+
// },
|
|
402
|
+
// performanceLevel: {
|
|
403
|
+
// type: Schema.Types.Number,
|
|
404
|
+
// required: false,
|
|
405
|
+
// },
|
|
406
|
+
// performanceLevelDate: {
|
|
407
|
+
// type: Schema.Types.Date,
|
|
408
|
+
// required: false,
|
|
409
|
+
// },
|
|
410
|
+
// salary: {
|
|
411
|
+
// type: Schema.Types.Number,
|
|
412
|
+
// required: false,
|
|
413
|
+
// },
|
|
414
|
+
// hireDate: {
|
|
415
|
+
// type: Schema.Types.Date,
|
|
416
|
+
// required: false,
|
|
417
|
+
// },
|
|
418
|
+
// jobLevel: {
|
|
419
|
+
// type: Schema.Types.String,
|
|
420
|
+
// required: false,
|
|
421
|
+
// default: ''
|
|
422
|
+
// },
|
|
423
|
+
// supervisorId: {
|
|
424
|
+
// type: Schema.Types.ObjectId,
|
|
425
|
+
// required: false,
|
|
426
|
+
// },
|
|
427
|
+
// enpsRating: {
|
|
428
|
+
// type: Schema.Types.Number,
|
|
429
|
+
// required: false,
|
|
430
|
+
// },
|
|
431
|
+
// disability: {
|
|
432
|
+
// type: Schema.Types.String,
|
|
433
|
+
// required: false,
|
|
434
|
+
// default: 'no'
|
|
435
|
+
// },
|
|
436
|
+
// diverse: {
|
|
437
|
+
// type: Schema.Types.Boolean,
|
|
438
|
+
// required: false,
|
|
439
|
+
// // default: false
|
|
440
|
+
// },
|
|
441
|
+
// women: {
|
|
442
|
+
// type: Schema.Types.Boolean,
|
|
443
|
+
// required: false,
|
|
444
|
+
// // default: false
|
|
445
|
+
// },
|
|
446
|
+
// poc: {
|
|
447
|
+
// type: Schema.Types.Boolean,
|
|
448
|
+
// required: false,
|
|
449
|
+
// // default: false
|
|
450
|
+
// },
|
|
451
|
+
// isMfaVerified: {
|
|
452
|
+
// type: Schema.Types.Boolean,
|
|
453
|
+
// default: false,
|
|
454
|
+
// required: false,
|
|
455
|
+
// // default: false
|
|
456
|
+
// },
|
|
457
|
+
// mfaVerificationType: {
|
|
458
|
+
// type: Schema.Types.String,
|
|
459
|
+
// default: 'none',
|
|
460
|
+
// required: false,
|
|
461
|
+
// // default: false
|
|
462
|
+
// },
|
|
463
|
+
// verificationOtp: {
|
|
464
|
+
// type: otpSchema,
|
|
465
|
+
// default: null,
|
|
466
|
+
// required: false,
|
|
467
|
+
// // default: false
|
|
468
|
+
// },
|
|
469
|
+
// thirdPartyAuthTokens: {
|
|
470
|
+
// access_token: { type: Schema.Types.String },
|
|
471
|
+
// refresh_token: { type: Schema.Types.String },
|
|
472
|
+
// accountType: { type: Schema.Types.String },
|
|
473
|
+
// email: { type: Schema.Types.String },
|
|
474
|
+
// token_expiry: { type: Schema.Types.Number }
|
|
475
|
+
// },
|
|
476
|
+
// youtubeAuthTokens: {
|
|
477
|
+
// access_token: { type: Schema.Types.String },
|
|
478
|
+
// refresh_token: { type: Schema.Types.String },
|
|
479
|
+
// email: { type: Schema.Types.String },
|
|
480
|
+
// token_expiry: { type: Schema.Types.Number }
|
|
481
|
+
// }
|
|
482
|
+
// },
|
|
483
|
+
// {
|
|
484
|
+
// versionKey: false,
|
|
485
|
+
// timestamps: true,
|
|
486
|
+
// collection: USER_COLLECTION_NAME
|
|
487
|
+
// },
|
|
488
|
+
// );
|
|
489
489
|
|
|
490
|
-
export const UserModel = model<IUser>(USER_DOCUMENT_NAME, schema, USER_COLLECTION_NAME);
|
|
490
|
+
// export const UserModel = model<IUser>(USER_DOCUMENT_NAME, schema, USER_COLLECTION_NAME);
|