gemcap-be-common 1.3.87 → 1.3.89

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.
@@ -1,16 +1,16 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
- import { CRMProspect } from '../models/Prospect.model';
4
- import { CRMProspectFile } from '../models/ProspectFile.model';
3
+ import { Prospect } from '../models/Prospect.model';
4
+ import { ProspectFile } from '../models/ProspectFile.model';
5
5
 
6
6
  export class CrmProspectsService {
7
7
  async resetFiles() {
8
- await CRMProspectFile.deleteMany({});
8
+ await ProspectFile.deleteMany({});
9
9
  await this.migrateFiles();
10
10
  }
11
11
 
12
12
  async migrateFiles() {
13
- const prospects = await CRMProspect.find().lean();
13
+ const prospects = await Prospect.find().lean();
14
14
 
15
15
  for (const prospect of prospects) {
16
16
  const { _id: prospectId, files, auditorFiles, auditorSharedFiles } = prospect;
@@ -18,7 +18,7 @@ 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
- await CRMProspectFile.create({
21
+ await ProspectFile.create({
22
22
  prospectId,
23
23
  group,
24
24
  rowId,
@@ -33,7 +33,7 @@ export class CrmProspectsService {
33
33
  }
34
34
 
35
35
  for (const file of auditorSharedFiles) {
36
- await CRMProspectFile.create({
36
+ await ProspectFile.create({
37
37
  prospectId,
38
38
  fileId: file.fileId,
39
39
  filename: file.filename,
@@ -45,7 +45,7 @@ export class CrmProspectsService {
45
45
 
46
46
  for (const [auditorId, fileArray] of Object.entries(auditorFiles)) {
47
47
  for (const file of fileArray) {
48
- await CRMProspectFile.create({
48
+ await ProspectFile.create({
49
49
  prospectId,
50
50
  auditorId: new mongoose.Types.ObjectId(auditorId),
51
51
  fileId: file.fileId,