gemcap-be-common 1.3.166 → 1.3.168

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.
@@ -28,8 +28,10 @@ export interface IAppraiserContact {
28
28
  appraiserId: mongoose.Types.ObjectId;
29
29
  isDeleted: boolean;
30
30
  name: string;
31
- email?: string;
32
- normalizedEmail?: string;
31
+ title?: string;
32
+ speciality?: string;
33
+ email?: string[];
34
+ normalizedEmail?: string[];
33
35
  phone?: string;
34
36
  comment?: string;
35
37
  order?: number;
@@ -11,7 +11,9 @@ exports.AppraiserContactValidationSchema = joi_1.default.object({
11
11
  _id: joi_1.default.string(),
12
12
  appraiserId: joi_1.default.string(),
13
13
  name: joi_1.default.string().required(),
14
- email: joi_1.default.string().allow(''),
14
+ title: joi_1.default.string().allow(''),
15
+ speciality: joi_1.default.string().allow(''),
16
+ email: joi_1.default.array().items(joi_1.default.string().email()).allow(null),
15
17
  phone: joi_1.default.string().allow(''),
16
18
  comment: joi_1.default.string().allow(''),
17
19
  isDeleted: joi_1.default.boolean(),
@@ -31,14 +33,20 @@ exports.AppraiserContactSchema = new mongoose_1.default.Schema({
31
33
  type: String,
32
34
  required: true,
33
35
  },
34
- email: {
36
+ title: {
35
37
  type: String,
36
38
  },
37
- normalizedEmail: {
39
+ speciality: {
38
40
  type: String,
41
+ },
42
+ email: {
43
+ type: [String],
44
+ },
45
+ normalizedEmail: {
46
+ type: [String],
39
47
  lowercase: true,
40
48
  select: false,
41
- unique: true,
49
+ // unique: true, // TODO potential issue with unique email normalization
42
50
  },
43
51
  phone: {
44
52
  type: String,
@@ -7,8 +7,10 @@ export interface IAppraiserContact {
7
7
  appraiserId: mongoose.Types.ObjectId;
8
8
  isDeleted: boolean;
9
9
  name: string;
10
- email?: string;
11
- normalizedEmail?: string;
10
+ title?: string;
11
+ speciality?: string;
12
+ email?: string[];
13
+ normalizedEmail?: string[];
12
14
  phone?: string;
13
15
  comment?: string;
14
16
  order?: number;
@@ -25,7 +27,9 @@ export const AppraiserContactValidationSchema = Joi.object({
25
27
  _id: Joi.string(),
26
28
  appraiserId: Joi.string(),
27
29
  name: Joi.string().required(),
28
- email: Joi.string().allow(''),
30
+ title: Joi.string().allow(''),
31
+ speciality: Joi.string().allow(''),
32
+ email: Joi.array().items(Joi.string().email()).allow(null),
29
33
  phone: Joi.string().allow(''),
30
34
  comment: Joi.string().allow(''),
31
35
  isDeleted: Joi.boolean(),
@@ -49,14 +53,20 @@ export const AppraiserContactSchema = new mongoose.Schema<IAppraiserContact, App
49
53
  type: String,
50
54
  required: true,
51
55
  },
52
- email: {
56
+ title: {
53
57
  type: String,
54
58
  },
55
- normalizedEmail: {
59
+ speciality: {
56
60
  type: String,
61
+ },
62
+ email: {
63
+ type: [String],
64
+ },
65
+ normalizedEmail: {
66
+ type: [String],
57
67
  lowercase: true,
58
68
  select: false,
59
- unique: true,
69
+ // unique: true, // TODO potential issue with unique email normalization
60
70
  },
61
71
  phone: {
62
72
  type: String,
@@ -202,6 +202,7 @@ export interface IProspect extends IProspectBase, IProspectExternalNew {
202
202
  contacts: IProspectContact[];
203
203
  underwriterIds: mongoose.Types.ObjectId[];
204
204
  auditorIds: mongoose.Types.ObjectId[];
205
+ appraiserIds: mongoose.Types.ObjectId[];
205
206
  }
206
207
  export interface IProspectBaseWithId extends IProspectBase {
207
208
  _id: string;
@@ -355,6 +355,7 @@ exports.ProspectValidationSchema = joi_1.default.object({
355
355
  })),
356
356
  underwriterIds: joi_1.default.array().items(joi_1.default.string()),
357
357
  auditorIds: joi_1.default.array().items(joi_1.default.string()),
358
+ appraiserIds: joi_1.default.array().items(joi_1.default.string()),
358
359
  acceptedFiles: joi_1.default.array().items(joi_1.default.string()).allow(null),
359
360
  }).concat(exports.ProspectInfoValidationSchema);
360
361
  const contactSchema = new mongoose_1.default.Schema({
@@ -510,7 +511,11 @@ exports.ProspectSchema = new mongoose_1.default.Schema({
510
511
  }],
511
512
  auditorIds: [{
512
513
  type: mongoose_1.default.Schema.Types.ObjectId,
513
- ref: 'auditors',
514
+ ref: _models_1.MODEL_NAMES.auditors,
515
+ }],
516
+ appraiserIds: [{
517
+ type: mongoose_1.default.Schema.Types.ObjectId,
518
+ ref: _models_1.MODEL_NAMES.appraiser,
514
519
  }],
515
520
  }, {
516
521
  timestamps: { createdAt: true, updatedAt: true },
@@ -397,6 +397,7 @@ export interface IProspect extends IProspectBase, IProspectExternalNew {
397
397
  contacts: IProspectContact[];
398
398
  underwriterIds: mongoose.Types.ObjectId[];
399
399
  auditorIds: mongoose.Types.ObjectId[];
400
+ appraiserIds: mongoose.Types.ObjectId[];
400
401
  }
401
402
 
402
403
  export interface IProspectBaseWithId extends IProspectBase {
@@ -499,6 +500,7 @@ export const ProspectValidationSchema = Joi.object({
499
500
  })),
500
501
  underwriterIds: Joi.array().items(Joi.string()),
501
502
  auditorIds: Joi.array().items(Joi.string()),
503
+ appraiserIds: Joi.array().items(Joi.string()),
502
504
  acceptedFiles: Joi.array().items(Joi.string()).allow(null),
503
505
  }).concat(ProspectInfoValidationSchema);
504
506
 
@@ -660,7 +662,11 @@ export const ProspectSchema = new mongoose.Schema<IProspect, ProspectModel>(
660
662
  }],
661
663
  auditorIds: [{
662
664
  type: mongoose.Schema.Types.ObjectId,
663
- ref: 'auditors',
665
+ ref: MODEL_NAMES.auditors,
666
+ }],
667
+ appraiserIds: [{
668
+ type: mongoose.Schema.Types.ObjectId,
669
+ ref: MODEL_NAMES.appraiser,
664
670
  }],
665
671
  },
666
672
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.3.166",
3
+ "version": "1.3.168",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {