gemcap-be-common 1.4.239 → 1.4.241

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.
@@ -309,7 +309,7 @@ const getCollateralsBySheet = async (sheet, paginatorOptions) => {
309
309
  const collateralSheets = await exports.collateralMap[enumKey].aggregate([
310
310
  {
311
311
  $match: {
312
- 'bbcSheetId': new mongoose_1.default.Types.ObjectId(sheet.id),
312
+ 'bbcSheetId': sheet._id,
313
313
  },
314
314
  },
315
315
  ...exports.COLLATERALS_LOOKUP,
@@ -350,7 +350,7 @@ const getCollateralListBySheetId = async (sheet, paginatorOptions) => {
350
350
  return exports.collateralMap[enumKey].aggregate([
351
351
  {
352
352
  $match: {
353
- 'bbcSheetId': new mongoose_1.default.Types.ObjectId(sheet.id),
353
+ 'bbcSheetId': sheet._id,
354
354
  },
355
355
  },
356
356
  ...exports.COLLATERALS_LOOKUP,
@@ -328,7 +328,7 @@ const getCollateralsBySheet = async (sheet: IBBCSheetDoc, paginatorOptions?: IPa
328
328
  const collateralSheets = await collateralMap[enumKey].aggregate([
329
329
  {
330
330
  $match: {
331
- 'bbcSheetId': new mongoose.Types.ObjectId(sheet.id),
331
+ 'bbcSheetId': sheet._id,
332
332
  },
333
333
  },
334
334
  ...COLLATERALS_LOOKUP,
@@ -371,7 +371,7 @@ export const getCollateralListBySheetId = async (sheet: IBBCSheetDoc, paginatorO
371
371
  return collateralMap[enumKey].aggregate([
372
372
  {
373
373
  $match: {
374
- 'bbcSheetId': new mongoose.Types.ObjectId(sheet.id),
374
+ 'bbcSheetId': sheet._id,
375
375
  },
376
376
  },
377
377
  ...COLLATERALS_LOOKUP,
@@ -47,11 +47,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
47
47
  bbcDateId: mongoose.Types.ObjectId;
48
48
  dataType: string;
49
49
  __v?: number;
50
- comment?: string;
51
50
  uploadUser?: string;
52
51
  fileHash?: string;
53
52
  fileName?: string;
54
53
  sheetName?: string;
54
+ comment?: string;
55
55
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
56
56
  createdAt: NativeDate;
57
57
  updatedAt: NativeDate;
@@ -59,11 +59,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
59
59
  bbcDateId: mongoose.Types.ObjectId;
60
60
  dataType: string;
61
61
  __v?: number;
62
- comment?: string;
63
62
  uploadUser?: string;
64
63
  fileHash?: string;
65
64
  fileName?: string;
66
65
  sheetName?: string;
66
+ comment?: string;
67
67
  }>> & mongoose.FlatRecord<{
68
68
  createdAt: NativeDate;
69
69
  updatedAt: NativeDate;
@@ -71,11 +71,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
71
71
  bbcDateId: mongoose.Types.ObjectId;
72
72
  dataType: string;
73
73
  __v?: number;
74
- comment?: string;
75
74
  uploadUser?: string;
76
75
  fileHash?: string;
77
76
  fileName?: string;
78
77
  sheetName?: string;
78
+ comment?: string;
79
79
  }> & {
80
80
  _id: mongoose.Types.ObjectId;
81
81
  }>;
@@ -9,7 +9,6 @@ const _models_1 = require("./_models");
9
9
  const InventoryItem_model_1 = require("./InventoryItem.model");
10
10
  const AccountPayableItem_model_1 = require("./AccountPayableItem.model");
11
11
  const ReceivableItem_model_1 = require("./ReceivableItem.model");
12
- const mongooseLeanId = require('../plugins/id.plugin');
13
12
  exports.BBCSheetSchema = new mongoose_1.default.Schema({
14
13
  bbcDateId: {
15
14
  type: mongoose_1.default.Schema.Types.ObjectId,
@@ -42,7 +41,6 @@ exports.BBCSheetSchema = new mongoose_1.default.Schema({
42
41
  },
43
42
  __v: { type: Number, select: false },
44
43
  }, { timestamps: true });
45
- exports.BBCSheetSchema.plugin(mongooseLeanId);
46
44
  exports.BBCSheetSchema.pre('findOneAndDelete', async function (next) {
47
45
  const bbcSheetId = this.getQuery()['_id'];
48
46
  await InventoryItem_model_1.InventoryItemModel.deleteMany({ bbcSheetId: bbcSheetId });
@@ -6,8 +6,6 @@ import { InventoryItemModel } from './InventoryItem.model';
6
6
  import { AccountPayableItemModel } from './AccountPayableItem.model';
7
7
  import { ReceivableItemModel } from './ReceivableItem.model';
8
8
 
9
- const mongooseLeanId = require('../plugins/id.plugin');
10
-
11
9
  export interface IBBCSheet {
12
10
  bbcDateId: mongoose.Types.ObjectId;
13
11
  dataType: string;
@@ -61,8 +59,6 @@ export const BBCSheetSchema = new mongoose.Schema(
61
59
  { timestamps: true }
62
60
  );
63
61
 
64
- BBCSheetSchema.plugin(mongooseLeanId);
65
-
66
62
  BBCSheetSchema.pre('findOneAndDelete', async function (next) {
67
63
  const bbcSheetId = this.getQuery()['_id'];
68
64
  await InventoryItemModel.deleteMany({ bbcSheetId: bbcSheetId });
@@ -32,25 +32,25 @@ export declare const CustomerGroupSchema: mongoose.Schema<any, mongoose.Model<an
32
32
  createdAt: NativeDate;
33
33
  updatedAt: NativeDate;
34
34
  } & {
35
+ groupName: string;
35
36
  borrowerId: mongoose.Types.ObjectId;
36
37
  items: string[];
37
- groupName: string;
38
38
  __v?: number;
39
39
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
40
40
  createdAt: NativeDate;
41
41
  updatedAt: NativeDate;
42
42
  } & {
43
+ groupName: string;
43
44
  borrowerId: mongoose.Types.ObjectId;
44
45
  items: string[];
45
- groupName: string;
46
46
  __v?: number;
47
47
  }>> & mongoose.FlatRecord<{
48
48
  createdAt: NativeDate;
49
49
  updatedAt: NativeDate;
50
50
  } & {
51
+ groupName: string;
51
52
  borrowerId: mongoose.Types.ObjectId;
52
53
  items: string[];
53
- groupName: string;
54
54
  __v?: number;
55
55
  }> & {
56
56
  _id: mongoose.Types.ObjectId;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CustomerGroupModel = exports.CustomerGroupSchema = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const _models_1 = require("./_models");
9
- const mongooseLeanId = require('gemcap-be-common/plugins/id.plugin');
10
9
  exports.CustomerGroupSchema = new mongoose_1.default.Schema({
11
10
  groupName: {
12
11
  type: String,
@@ -21,5 +20,4 @@ exports.CustomerGroupSchema = new mongoose_1.default.Schema({
21
20
  items: [String],
22
21
  __v: { type: Number, select: false },
23
22
  }, { timestamps: true });
24
- exports.CustomerGroupSchema.plugin(mongooseLeanId);
25
23
  exports.CustomerGroupModel = mongoose_1.default.model(_models_1.MODEL_NAMES.customerGroups, exports.CustomerGroupSchema);
@@ -3,8 +3,6 @@ import mongoose, { Document } from 'mongoose';
3
3
  import { MODEL_NAMES } from './_models';
4
4
  import { IBorrowerGroup } from '../interfaces/group.interface';
5
5
 
6
- const mongooseLeanId = require('gemcap-be-common/plugins/id.plugin');
7
-
8
6
  export interface ICustomerGroupDocument extends IBorrowerGroup, Document {
9
7
  }
10
8
 
@@ -26,6 +24,4 @@ export const CustomerGroupSchema = new mongoose.Schema(
26
24
  { timestamps: true }
27
25
  );
28
26
 
29
- CustomerGroupSchema.plugin(mongooseLeanId);
30
-
31
27
  export const CustomerGroupModel: mongoose.Model<ICustomerGroupDocument> = mongoose.model<ICustomerGroupDocument>(MODEL_NAMES.customerGroups, CustomerGroupSchema);
@@ -48,8 +48,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
48
48
  createdAt: NativeDate;
49
49
  updatedAt: NativeDate;
50
50
  } & {
51
- order: number;
52
51
  unique: boolean;
52
+ order: number;
53
53
  inventoryAvailabilityId: mongoose.Types.ObjectId;
54
54
  inventoryId: mongoose.Types.ObjectId;
55
55
  matched: boolean;
@@ -64,8 +64,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
64
64
  createdAt: NativeDate;
65
65
  updatedAt: NativeDate;
66
66
  } & {
67
- order: number;
68
67
  unique: boolean;
68
+ order: number;
69
69
  inventoryAvailabilityId: mongoose.Types.ObjectId;
70
70
  inventoryId: mongoose.Types.ObjectId;
71
71
  matched: boolean;
@@ -80,8 +80,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
80
80
  createdAt: NativeDate;
81
81
  updatedAt: NativeDate;
82
82
  } & {
83
- order: number;
84
83
  unique: boolean;
84
+ order: number;
85
85
  inventoryAvailabilityId: mongoose.Types.ObjectId;
86
86
  inventoryId: mongoose.Types.ObjectId;
87
87
  matched: boolean;
@@ -71,17 +71,16 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
71
71
  createdAt: NativeDate;
72
72
  updatedAt: NativeDate;
73
73
  } & {
74
- bbcSheetId: mongoose.Types.ObjectId;
75
- order: number;
76
74
  value: number;
77
75
  skuDate: Date;
78
76
  category: string;
79
77
  sku: string;
80
78
  qty: number;
79
+ bbcSheetId: mongoose.Types.ObjectId;
80
+ order: number;
81
81
  __v?: number;
82
- location?: string;
83
- lotNumber?: string;
84
82
  expiryDate?: Date;
83
+ location?: string;
85
84
  unitCost?: number;
86
85
  skuDescription1?: string;
87
86
  skuDescription2?: string;
@@ -89,21 +88,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
89
88
  detail1?: string;
90
89
  detail2?: string;
91
90
  detail3?: string;
91
+ lotNumber?: string;
92
92
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
93
93
  createdAt: NativeDate;
94
94
  updatedAt: NativeDate;
95
95
  } & {
96
- bbcSheetId: mongoose.Types.ObjectId;
97
- order: number;
98
96
  value: number;
99
97
  skuDate: Date;
100
98
  category: string;
101
99
  sku: string;
102
100
  qty: number;
101
+ bbcSheetId: mongoose.Types.ObjectId;
102
+ order: number;
103
103
  __v?: number;
104
- location?: string;
105
- lotNumber?: string;
106
104
  expiryDate?: Date;
105
+ location?: string;
107
106
  unitCost?: number;
108
107
  skuDescription1?: string;
109
108
  skuDescription2?: string;
@@ -111,21 +110,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
111
110
  detail1?: string;
112
111
  detail2?: string;
113
112
  detail3?: string;
113
+ lotNumber?: string;
114
114
  }>> & mongoose.FlatRecord<{
115
115
  createdAt: NativeDate;
116
116
  updatedAt: NativeDate;
117
117
  } & {
118
- bbcSheetId: mongoose.Types.ObjectId;
119
- order: number;
120
118
  value: number;
121
119
  skuDate: Date;
122
120
  category: string;
123
121
  sku: string;
124
122
  qty: number;
123
+ bbcSheetId: mongoose.Types.ObjectId;
124
+ order: number;
125
125
  __v?: number;
126
- location?: string;
127
- lotNumber?: string;
128
126
  expiryDate?: Date;
127
+ location?: string;
129
128
  unitCost?: number;
130
129
  skuDescription1?: string;
131
130
  skuDescription2?: string;
@@ -133,6 +132,7 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
133
132
  detail1?: string;
134
133
  detail2?: string;
135
134
  detail3?: string;
135
+ lotNumber?: string;
136
136
  }> & {
137
137
  _id: mongoose.Types.ObjectId;
138
138
  }>;
@@ -52,8 +52,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
52
52
  } & {
53
53
  bbcSheetId: mongoose.Types.ObjectId;
54
54
  order: number;
55
- invoiceNumber: string;
56
55
  invoiceDate: Date;
56
+ invoiceNumber: string;
57
57
  customerTitle: string;
58
58
  invoiceAmount: number;
59
59
  __v?: number;
@@ -68,8 +68,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
68
68
  } & {
69
69
  bbcSheetId: mongoose.Types.ObjectId;
70
70
  order: number;
71
- invoiceNumber: string;
72
71
  invoiceDate: Date;
72
+ invoiceNumber: string;
73
73
  customerTitle: string;
74
74
  invoiceAmount: number;
75
75
  __v?: number;
@@ -84,8 +84,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
84
84
  } & {
85
85
  bbcSheetId: mongoose.Types.ObjectId;
86
86
  order: number;
87
- invoiceNumber: string;
88
87
  invoiceDate: Date;
88
+ invoiceNumber: string;
89
89
  customerTitle: string;
90
90
  invoiceAmount: number;
91
91
  __v?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.239",
3
+ "version": "1.4.241",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -84,10 +84,10 @@ export declare class BorrowerService {
84
84
  getBorrowerCodesMap(): Promise<Map<string, string>>;
85
85
  getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
86
86
  [x: string]: {
87
+ SELECTED_PERIOD?: boolean;
88
+ ENTIRE_LOAN?: boolean;
87
89
  LAST_MONTH?: boolean;
88
90
  CURRENT_MONTH?: boolean;
89
- ENTIRE_LOAN?: boolean;
90
- SELECTED_PERIOD?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;
@@ -46,9 +46,9 @@ export declare class BrokersService {
46
46
  getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
47
47
  _id: import("mongoose").Types.ObjectId;
48
48
  }>)[]>;
49
- getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
49
+ getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
50
50
  _id: import("mongoose").Types.ObjectId;
51
- }>)[] | BrokerView[]>;
51
+ }>)[]>;
52
52
  getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
53
53
  getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
54
54
  getTotals(borrowerId: string): Promise<BrokerTotalView[]>;
@@ -124,7 +124,7 @@ class CollateralsService {
124
124
  const collateralSheets = await collaterals_db_1.collateralMap[enumKey].aggregate([
125
125
  {
126
126
  $match: {
127
- 'bbcSheetId': new mongoose_1.default.Types.ObjectId(sheet.id),
127
+ 'bbcSheetId': sheet._id,
128
128
  },
129
129
  },
130
130
  ...collaterals_db_1.COLLATERALS_LOOKUP,
@@ -163,7 +163,7 @@ class CollateralsService {
163
163
  async getCollateralItemTotal(sheet) {
164
164
  const enumKey = (0, enums_helper_1.getEnumKeyByEnumValue)(collaterals_enum_1.ECollaterals, sheet.dataType);
165
165
  return collaterals_db_1.collateralMap[enumKey].countDocuments({
166
- 'bbcSheetId': new mongoose_1.default.Types.ObjectId(sheet.id),
166
+ 'bbcSheetId': sheet._id,
167
167
  });
168
168
  }
169
169
  getCollateralsBenford(collaterals) {
@@ -148,7 +148,7 @@ export class CollateralsService {
148
148
  const collateralSheets = await collateralMap[enumKey].aggregate([
149
149
  {
150
150
  $match: {
151
- 'bbcSheetId': new mongoose.Types.ObjectId(sheet.id),
151
+ 'bbcSheetId': sheet._id,
152
152
  },
153
153
  },
154
154
  ...COLLATERALS_LOOKUP,
@@ -189,7 +189,7 @@ export class CollateralsService {
189
189
  const enumKey = getEnumKeyByEnumValue(ECollaterals, sheet.dataType);
190
190
  return collateralMap[enumKey].countDocuments(
191
191
  {
192
- 'bbcSheetId': new mongoose.Types.ObjectId(sheet.id),
192
+ 'bbcSheetId': sheet._id,
193
193
  },
194
194
  );
195
195
  }
@@ -45,7 +45,7 @@ export declare class ComplianceBorrowersService {
45
45
  };
46
46
  };
47
47
  getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
48
- getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items"> | {
48
+ getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "items" | "borrower" | "fundingStatus"> | {
49
49
  items: {
50
50
  instances: any[];
51
51
  item: import("../models/ComplianceItem.model").IComplianceItemDocument;
@@ -106,7 +106,7 @@ export declare class ComplianceBorrowersService {
106
106
  borrower: {
107
107
  _id: string;
108
108
  name: string;
109
- borrowerId: any;
109
+ borrowerId: string;
110
110
  };
111
111
  email: string;
112
112
  mainEmails: IEmailRecipient[];
@@ -398,7 +398,7 @@ class ComplianceBorrowersService {
398
398
  return allComplianceBorrower.map((b) => {
399
399
  const items = b.items.map((item) => {
400
400
  return {
401
- value: item.item?.id ?? null,
401
+ value: item.item?._id.toString() ?? null,
402
402
  title: item.item?.name ?? null,
403
403
  };
404
404
  });
@@ -413,7 +413,7 @@ class ComplianceBorrowersService {
413
413
  return;
414
414
  }
415
415
  return {
416
- borrower: { _id: b._id.toString(), name: b.borrower?.name ?? '', borrowerId: b.borrower?.id ?? '' },
416
+ borrower: { _id: b._id.toString(), name: b.borrower?.name ?? '', borrowerId: b.borrower?._id.toString() ?? '' },
417
417
  email: b.email,
418
418
  mainEmails: b.mainEmails ?? [],
419
419
  financialEmails: b.financialEmails ?? [],
@@ -434,14 +434,14 @@ class ComplianceBorrowersService {
434
434
  .lean();
435
435
  const items = borrower.items.map((item) => {
436
436
  return {
437
- value: item.item?.id ?? null,
437
+ value: item.item?._id.toString() ?? null,
438
438
  title: item.item?.name ?? null,
439
439
  };
440
440
  });
441
441
  const uniqEmails = lodash_1.default.uniq((borrower.items.reduce((acc, item) => [...acc, ...item.emailAddresses], [])).map((email) => email.email));
442
442
  const groupedEmails = borrower.items.reduce((acc, item) => {
443
443
  if (item.emailAddresses.length) {
444
- acc[item.item?.id ?? null] = item.emailAddresses;
444
+ acc[item.item?._id.toString() ?? null] = item.emailAddresses;
445
445
  }
446
446
  return acc;
447
447
  }, {});
@@ -92,7 +92,7 @@ export class ComplianceBorrowersService {
92
92
  // populate: { path: 'instances.files.uploadedBy', model: MODEL_NAMES.users },
93
93
  // }) // TODO remove this when we have a better way to handle users
94
94
  .transform((borrower) => ({ ...borrower, plaidAccessToken: borrower?.plaidAccessToken ?? false }))
95
- .lean() as IComplianceBorrowerDocumentFull;
95
+ .lean<IComplianceBorrowerDocumentFull>();
96
96
  if (!ourBorrower.borrower) {
97
97
  return Promise.resolve({ ...ourBorrower });
98
98
  }
@@ -132,7 +132,7 @@ export class ComplianceBorrowersService {
132
132
  async getAllBorrowersShortened(userAccess: IUserAccess) {
133
133
  type BorrowerComplianceShort = Pick<IComplianceBorrowerWithBorrower, 'borrower' | 'fundingStatus' | 'items'>;
134
134
 
135
- const allComplianceBorrower: BorrowerComplianceShort[] = await BorrowerCompliance
135
+ const allComplianceBorrower = await BorrowerCompliance
136
136
  .find(userAccess.allBorrowers ? { isVisible: true } : {
137
137
  'borrower': { $in: userAccess.borrowersAccess },
138
138
  isVisible: true,
@@ -143,7 +143,7 @@ export class ComplianceBorrowersService {
143
143
  populate: { path: 'item', model: 'complianceItems' },
144
144
  })
145
145
  .collation({ locale: 'en' })
146
- .lean();
146
+ .lean<BorrowerComplianceShort[]>();
147
147
  const borrowers = await Promise.all(allComplianceBorrower.map(async (borrower) => {
148
148
  if (!borrower.borrower) {
149
149
  return borrower;
@@ -435,7 +435,7 @@ export class ComplianceBorrowersService {
435
435
  return allComplianceBorrower.map((b) => {
436
436
  const items = b.items.map((item) => {
437
437
  return {
438
- value: item.item?.id ?? null,
438
+ value: item.item?._id.toString() ?? null,
439
439
  title: item.item?.name ?? null,
440
440
  };
441
441
  });
@@ -450,7 +450,7 @@ export class ComplianceBorrowersService {
450
450
  return;
451
451
  }
452
452
  return {
453
- borrower: { _id: b._id.toString(), name: b.borrower?.name ?? '', borrowerId: b.borrower?.id ?? '' },
453
+ borrower: { _id: b._id.toString(), name: b.borrower?.name ?? '', borrowerId: b.borrower?._id.toString() ?? '' },
454
454
  email: b.email,
455
455
  mainEmails: b.mainEmails ?? [],
456
456
  financialEmails: b.financialEmails ?? [],
@@ -472,14 +472,14 @@ export class ComplianceBorrowersService {
472
472
  .lean<IComplianceBorrowerWithBorrower>();
473
473
  const items = borrower.items.map((item) => {
474
474
  return {
475
- value: item.item?.id ?? null,
475
+ value: item.item?._id.toString() ?? null,
476
476
  title: item.item?.name ?? null,
477
477
  };
478
478
  });
479
479
  const uniqEmails = _.uniq((borrower.items.reduce((acc, item) => [...acc, ...item.emailAddresses], [])).map((email) => email.email));
480
480
  const groupedEmails = borrower.items.reduce((acc, item) => {
481
481
  if (item.emailAddresses.length) {
482
- acc[item.item?.id ?? null] = item.emailAddresses;
482
+ acc[item.item?._id.toString() ?? null] = item.emailAddresses;
483
483
  }
484
484
  return acc;
485
485
  }, {});
@@ -11,8 +11,8 @@ class GroupsService {
11
11
  const groupIds = groups.map((group) => group._id);
12
12
  const allExistedGroups = await groups_db_1.groupsMap[groupType].Model.find({ borrowerId }).lean();
13
13
  await Promise.all(allExistedGroups.map(async (group) => {
14
- if (!groupIds.includes(group.id)) {
15
- await groups_db_1.groupsMap[groupType].Model.findByIdAndDelete(group.id);
14
+ if (!groupIds.includes(group._id.toString())) {
15
+ await groups_db_1.groupsMap[groupType].Model.findByIdAndDelete(group._id.toString());
16
16
  }
17
17
  }));
18
18
  await Promise.all(groups.map(async (group) => {
@@ -9,8 +9,8 @@ export class GroupsService {
9
9
  const groupIds = groups.map((group) => group._id);
10
10
  const allExistedGroups: ICustomerGroupDocument[] = await groupsMap[groupType].Model.find({ borrowerId }).lean();
11
11
  await Promise.all(allExistedGroups.map(async (group) => {
12
- if (!groupIds.includes(group.id)) {
13
- await groupsMap[groupType].Model.findByIdAndDelete(group.id);
12
+ if (!groupIds.includes(group._id.toString())) {
13
+ await groupsMap[groupType].Model.findByIdAndDelete(group._id.toString());
14
14
  }
15
15
  }))
16
16
  await Promise.all(groups.map(async (group) => {
@@ -81,7 +81,7 @@ export declare class LoanPaymentsService {
81
81
  }>;
82
82
  getExpectedPayments(userId: string): Promise<any[] | {
83
83
  borrowers: {
84
- borrowerId: any;
84
+ borrowerId: string;
85
85
  borrowerTitle: string;
86
86
  totalDue: number;
87
87
  productTotals: {
@@ -412,7 +412,7 @@ class LoanPaymentsService {
412
412
  const loanStatementService = this.getLoanStatementService();
413
413
  const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
414
414
  return {
415
- borrowerId: borrower.id,
415
+ borrowerId: borrower._id.toString(),
416
416
  borrowerTitle: borrower.name,
417
417
  totalDue: dueAmounts.total,
418
418
  productTotals: dueAmounts.productTotals,
@@ -459,7 +459,7 @@ export class LoanPaymentsService {
459
459
  const loanStatementService = this.getLoanStatementService();
460
460
  const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
461
461
  return {
462
- borrowerId: borrower.id,
462
+ borrowerId: borrower._id.toString(),
463
463
  borrowerTitle: borrower.name,
464
464
  totalDue: dueAmounts.total,
465
465
  productTotals: dueAmounts.productTotals,
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
155
155
  getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
156
156
  transactionIdsToMark: string[];
157
157
  transactions: {
158
- [x: string]: (string | number | string[] | Date)[];
158
+ [x: string]: (string | number | Date | string[])[];
159
159
  }[];
160
160
  }>;
161
161
  getBorrowerIdsForFile(transactionFileId: string): Promise<{