gemcap-be-common 1.3.91 → 1.3.93
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.
|
@@ -158,13 +158,13 @@ export type TProspectFiles = {
|
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
160
|
export type TProspectAuditorFiles = Map<string, IProspectFile[]>;
|
|
161
|
-
export interface
|
|
161
|
+
export interface IProspectFilesLegacy {
|
|
162
162
|
files: TProspectFiles;
|
|
163
163
|
auditorFiles: TProspectAuditorFiles;
|
|
164
164
|
auditorSharedFiles: IProspectFile[];
|
|
165
165
|
acceptedFiles: string[];
|
|
166
166
|
}
|
|
167
|
-
export interface IProspect extends IProspectBase, IProspectExternalNew,
|
|
167
|
+
export interface IProspect extends IProspectBase, IProspectExternalNew, IProspectFilesLegacy {
|
|
168
168
|
probability: number;
|
|
169
169
|
businessDescription: string;
|
|
170
170
|
comments: string;
|
|
@@ -205,11 +205,12 @@ export interface IProspectBaseWithId extends IProspectBase {
|
|
|
205
205
|
export interface IProspectWithId extends IProspect {
|
|
206
206
|
_id: string;
|
|
207
207
|
}
|
|
208
|
-
export type IProspectExternal = Pick<IProspectWithId, 'info' | '
|
|
208
|
+
export type IProspectExternal = Pick<IProspectWithId, 'info' | 'isLocked' | 'status' | '_id'> & {
|
|
209
209
|
auditorFiles: IProspectFile[];
|
|
210
210
|
prospectFiles: IProspectFile[];
|
|
211
211
|
};
|
|
212
|
-
export type IProspectExternalAuditors = Pick<IProspectWithId, 'info' | '
|
|
212
|
+
export type IProspectExternalAuditors = Pick<IProspectWithId, 'info' | 'isLocked'> & {
|
|
213
|
+
files: IProspectFile[];
|
|
213
214
|
auditorFiles: IProspectFile[];
|
|
214
215
|
auditorSharedFiles: IProspectFile[];
|
|
215
216
|
};
|
package/models/Prospect.model.js
CHANGED
|
@@ -384,6 +384,7 @@ const fileDetailsSchema = new mongoose_1.default.Schema({
|
|
|
384
384
|
const ProspectFilesSchema = {
|
|
385
385
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
386
386
|
default: (0, exports.initialFileGroups)(),
|
|
387
|
+
required: false,
|
|
387
388
|
};
|
|
388
389
|
exports.ProspectSchema = new mongoose_1.default.Schema({
|
|
389
390
|
isDeclined: {
|
|
@@ -498,9 +499,11 @@ exports.ProspectSchema = new mongoose_1.default.Schema({
|
|
|
498
499
|
type: Map,
|
|
499
500
|
of: [fileDetailsSchema],
|
|
500
501
|
default: {},
|
|
502
|
+
required: false,
|
|
501
503
|
},
|
|
502
504
|
acceptedFiles: [{
|
|
503
505
|
type: String,
|
|
506
|
+
required: false,
|
|
504
507
|
}],
|
|
505
508
|
underwriterIds: [{
|
|
506
509
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
package/models/Prospect.model.ts
CHANGED
|
@@ -343,14 +343,14 @@ export type TProspectFiles = {
|
|
|
343
343
|
|
|
344
344
|
export type TProspectAuditorFiles = Map<string, IProspectFile[]>;
|
|
345
345
|
|
|
346
|
-
export interface
|
|
346
|
+
export interface IProspectFilesLegacy {
|
|
347
347
|
files: TProspectFiles;
|
|
348
348
|
auditorFiles: TProspectAuditorFiles;
|
|
349
349
|
auditorSharedFiles: IProspectFile[];
|
|
350
350
|
acceptedFiles: string[];
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
export interface IProspect extends IProspectBase, IProspectExternalNew,
|
|
353
|
+
export interface IProspect extends IProspectBase, IProspectExternalNew, IProspectFilesLegacy {
|
|
354
354
|
probability: number;
|
|
355
355
|
businessDescription: string;
|
|
356
356
|
comments: string;
|
|
@@ -395,10 +395,11 @@ export interface IProspectWithId extends IProspect {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
export type IProspectExternal =
|
|
398
|
-
Pick<IProspectWithId, 'info' | '
|
|
398
|
+
Pick<IProspectWithId, 'info' | 'isLocked' | 'status' | '_id'>
|
|
399
399
|
& { auditorFiles: IProspectFile[], prospectFiles: IProspectFile[] }
|
|
400
400
|
|
|
401
|
-
export type IProspectExternalAuditors = Pick<IProspectWithId, 'info' | '
|
|
401
|
+
export type IProspectExternalAuditors = Pick<IProspectWithId, 'info' | 'isLocked'> & {
|
|
402
|
+
files: IProspectFile[];
|
|
402
403
|
auditorFiles: IProspectFile[];
|
|
403
404
|
auditorSharedFiles: IProspectFile[];
|
|
404
405
|
}
|
|
@@ -540,6 +541,7 @@ const fileDetailsSchema = new mongoose.Schema<IProspectFile>({
|
|
|
540
541
|
const ProspectFilesSchema = {
|
|
541
542
|
type: mongoose.Schema.Types.Mixed,
|
|
542
543
|
default: initialFileGroups(),
|
|
544
|
+
required: false,
|
|
543
545
|
};
|
|
544
546
|
|
|
545
547
|
export const ProspectSchema = new mongoose.Schema<IProspect, ProspectModel>(
|
|
@@ -656,9 +658,11 @@ export const ProspectSchema = new mongoose.Schema<IProspect, ProspectModel>(
|
|
|
656
658
|
type: Map,
|
|
657
659
|
of: [fileDetailsSchema],
|
|
658
660
|
default: {},
|
|
661
|
+
required: false,
|
|
659
662
|
},
|
|
660
663
|
acceptedFiles: [{
|
|
661
664
|
type: String,
|
|
665
|
+
required: false,
|
|
662
666
|
}],
|
|
663
667
|
underwriterIds: [{
|
|
664
668
|
type: mongoose.Schema.Types.ObjectId,
|
package/package.json
CHANGED
|
@@ -19,7 +19,8 @@ class CrmProspectsService {
|
|
|
19
19
|
for (const [group, rowMap] of Object.entries(files || {})) {
|
|
20
20
|
for (const [rowId, fileArray] of Object.entries(rowMap)) {
|
|
21
21
|
for (const file of fileArray) {
|
|
22
|
-
|
|
22
|
+
const newFile = {
|
|
23
|
+
type: ProspectFile_model_1.EProspectFileType.FILE,
|
|
23
24
|
prospectId,
|
|
24
25
|
group,
|
|
25
26
|
rowId,
|
|
@@ -28,23 +29,27 @@ class CrmProspectsService {
|
|
|
28
29
|
uploadedAt: file.uploadedAt,
|
|
29
30
|
sharepointId: file.sharepointId,
|
|
30
31
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
31
|
-
}
|
|
32
|
+
};
|
|
33
|
+
await ProspectFile_model_1.ProspectFile.create(newFile);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
for (const file of auditorSharedFiles) {
|
|
36
|
-
|
|
38
|
+
const newFile = {
|
|
39
|
+
type: ProspectFile_model_1.EProspectFileType.AUDITOR_SHARED_FILE,
|
|
37
40
|
prospectId,
|
|
38
41
|
fileId: file.fileId,
|
|
39
42
|
filename: file.filename,
|
|
40
43
|
uploadedAt: file.uploadedAt,
|
|
41
44
|
sharepointId: file.sharepointId,
|
|
42
45
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
43
|
-
}
|
|
46
|
+
};
|
|
47
|
+
await ProspectFile_model_1.ProspectFile.create(newFile);
|
|
44
48
|
}
|
|
45
49
|
for (const [auditorId, fileArray] of Object.entries(auditorFiles)) {
|
|
46
50
|
for (const file of fileArray) {
|
|
47
|
-
|
|
51
|
+
const newFile = {
|
|
52
|
+
type: ProspectFile_model_1.EProspectFileType.AUDITOR_FILE,
|
|
48
53
|
prospectId,
|
|
49
54
|
auditorId: new mongoose_1.default.Types.ObjectId(auditorId),
|
|
50
55
|
fileId: file.fileId,
|
|
@@ -52,7 +57,8 @@ class CrmProspectsService {
|
|
|
52
57
|
uploadedAt: file.uploadedAt,
|
|
53
58
|
sharepointId: file.sharepointId,
|
|
54
59
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
55
|
-
}
|
|
60
|
+
};
|
|
61
|
+
await ProspectFile_model_1.ProspectFile.create(newFile);
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { Prospect } from '../models/Prospect.model';
|
|
4
|
-
import { ProspectFile } from '../models/ProspectFile.model';
|
|
4
|
+
import { EProspectFileType, IProspectFile, ProspectFile } from '../models/ProspectFile.model';
|
|
5
5
|
|
|
6
6
|
export class CrmProspectsService {
|
|
7
7
|
async resetFiles() {
|
|
@@ -18,7 +18,8 @@ export class CrmProspectsService {
|
|
|
18
18
|
for (const [group, rowMap] of Object.entries(files || {})) {
|
|
19
19
|
for (const [rowId, fileArray] of Object.entries(rowMap)) {
|
|
20
20
|
for (const file of fileArray) {
|
|
21
|
-
|
|
21
|
+
const newFile: IProspectFile = {
|
|
22
|
+
type: EProspectFileType.FILE,
|
|
22
23
|
prospectId,
|
|
23
24
|
group,
|
|
24
25
|
rowId,
|
|
@@ -27,25 +28,29 @@ export class CrmProspectsService {
|
|
|
27
28
|
uploadedAt: file.uploadedAt,
|
|
28
29
|
sharepointId: file.sharepointId,
|
|
29
30
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
30
|
-
}
|
|
31
|
+
};
|
|
32
|
+
await ProspectFile.create(newFile);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
for (const file of auditorSharedFiles) {
|
|
36
|
-
|
|
38
|
+
const newFile: IProspectFile = {
|
|
39
|
+
type: EProspectFileType.AUDITOR_SHARED_FILE,
|
|
37
40
|
prospectId,
|
|
38
41
|
fileId: file.fileId,
|
|
39
42
|
filename: file.filename,
|
|
40
43
|
uploadedAt: file.uploadedAt,
|
|
41
44
|
sharepointId: file.sharepointId,
|
|
42
45
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
43
|
-
}
|
|
46
|
+
};
|
|
47
|
+
await ProspectFile.create(newFile);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
for (const [auditorId, fileArray] of Object.entries(auditorFiles)) {
|
|
47
51
|
for (const file of fileArray) {
|
|
48
|
-
|
|
52
|
+
const newFile: IProspectFile = {
|
|
53
|
+
type: EProspectFileType.AUDITOR_FILE,
|
|
49
54
|
prospectId,
|
|
50
55
|
auditorId: new mongoose.Types.ObjectId(auditorId),
|
|
51
56
|
fileId: file.fileId,
|
|
@@ -53,7 +58,8 @@ export class CrmProspectsService {
|
|
|
53
58
|
uploadedAt: file.uploadedAt,
|
|
54
59
|
sharepointId: file.sharepointId,
|
|
55
60
|
sharepointWebUrl: file.sharepointWebUrl,
|
|
56
|
-
}
|
|
61
|
+
};
|
|
62
|
+
await ProspectFile.create(newFile);
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
}
|