gemcap-be-common 1.5.65 → 1.5.66

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/db/reports.db.ts CHANGED
@@ -285,7 +285,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
285
285
  }))
286
286
  : statementTransactions.slice();
287
287
 
288
- const isParticipant = group.product.masterLoanProductId != null;
288
+ const isParticipant = group.product.masteredLoanProductId != null;
289
289
  const groupedMappedStatementTransactions = await Promise.all(statementTransactionsWithBalance.map(async (statement) => {
290
290
 
291
291
  const transactions = [];
@@ -19,7 +19,7 @@ export interface ILoanProduct {
19
19
  isBalanceActual: boolean;
20
20
  isFloatedBalanceActual: boolean;
21
21
  isParticipant?: boolean;
22
- masterLoanProductId: mongoose.Types.ObjectId;
22
+ masteredLoanProductId: mongoose.Types.ObjectId;
23
23
  minPercent: number;
24
24
  maxPercent: number;
25
25
  prepaymentDate?: Date;
@@ -42,10 +42,10 @@ export interface ILoanProductLean extends ILoanProduct {
42
42
  updatedAt: Date;
43
43
  }
44
44
 
45
- export interface ILoanProductPlain extends Omit<ILoanProduct, 'borrowerId' | 'masterLoanProductId'> {
45
+ export interface ILoanProductPlain extends Omit<ILoanProduct, 'borrowerId' | 'masteredLoanProductId'> {
46
46
  _id: string;
47
47
  borrowerId: string;
48
- masterLoanProductId: string;
48
+ masteredLoanProductId: string;
49
49
  }
50
50
 
51
51
  export interface ILoanProductWithId extends ILoanProduct {
@@ -128,7 +128,7 @@ export const LoanProductSchema = new mongoose.Schema(
128
128
  type: Boolean,
129
129
  required: false,
130
130
  },
131
- masterLoanProductId: {
131
+ masteredLoanProductId: {
132
132
  type: mongoose.Schema.Types.ObjectId,
133
133
  ref: MODEL_NAMES.loanProducts,
134
134
  default: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.65",
3
+ "version": "1.5.66",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -112,7 +112,7 @@ export class LoanChargesService {
112
112
  if (!masterProduct) {
113
113
  return 0;
114
114
  }
115
- const participationProduct = await LoanProduct.findOne({ masterLoanProductId: masterProduct._id }).lean();
115
+ const participationProduct = await LoanProduct.findOne({ masteredLoanProductId: masterProduct._id }).lean();
116
116
  if (!participationProduct) {
117
117
  return 0;
118
118
  }
@@ -29,7 +29,7 @@ export class LoanProductsService {
29
29
  const masterProducts = await LoanProduct.find({ code: { $in: codes } });
30
30
  const masterProductIds = masterProducts.map((product) => product._id);
31
31
  const loanProducts = await LoanProduct
32
- .find({ masterLoanProductId: { $in: masterProductIds } })
32
+ .find({ masteredLoanProductId: { $in: masterProductIds } })
33
33
  .sort({ code: 1 })
34
34
  .lean();
35
35
  return loanProducts.reduce((acc, loanProduct) => ({ ...acc, [loanProduct.code]: loanProduct._id.toString() }), {});
@@ -416,7 +416,7 @@ export class QuickbooksService {
416
416
  if (totalAmountValue === 0) {
417
417
  return;
418
418
  }
419
- let totalAmount = product.masterLoanProductId != null ? -totalAmountValue : totalAmountValue;
419
+ let totalAmount = product.masteredLoanProductId != null ? -totalAmountValue : totalAmountValue;
420
420
  totalAmount = isAccrual ? totalAmount : -totalAmount;
421
421
  const quickbooksAccountBS = await QuickbooksAccount.findOne({ accountCode: charge.code, ...companyFilter }).lean();
422
422
  const quickbooksAccountPL = await QuickbooksAccount.findOne({ accountCode: PLCode, ...companyFilter }).lean();
@@ -433,7 +433,7 @@ export class QuickbooksService {
433
433
  ...trTemplate,
434
434
  productId,
435
435
  class: borrower.code,
436
- memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} ${EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
436
+ memo: `${borrower.code} ${product.masteredLoanProductId != null ? 'PARTICIPANT' : ''} ${EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
437
437
  };
438
438
 
439
439
  tr.account = quickbooksAccountBS.fullName;
@@ -500,8 +500,8 @@ export class QuickbooksService {
500
500
  ...trTemplate,
501
501
  productId,
502
502
  class: borrower.code,
503
- amount: product.masterLoanProductId != null ? +amount : -+amount,
504
- memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
503
+ amount: product.masteredLoanProductId != null ? +amount : -+amount,
504
+ memo: `${borrower.code} ${product.masteredLoanProductId != null ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
505
505
  };
506
506
 
507
507
  if (settlementCode === 'null') {
@@ -100,7 +100,7 @@ export class InvestorSummaryService {
100
100
  await Promise.all(borrowerIds.map(async (borrowerId) => {
101
101
  const borrower = await BorrowerModel.findById(borrowerId).lean();
102
102
  const borrowerProducts = await this.loanChargesService.getLoanProducts(borrowerId);
103
- await Promise.all(borrowerProducts.filter((product) => product.masterLoanProductId == null).map(async (product) => {
103
+ await Promise.all(borrowerProducts.filter((product) => product.masteredLoanProductId == null).map(async (product) => {
104
104
  const productId = product._id.toString();
105
105
  const isRevolver = product.type === ELoanTypes.REVOLVER;
106
106
  const { balance: balanceEnd } = await this.loanChargesService.getLoanProductBalance(productId, end);
@@ -426,7 +426,7 @@ export class ReportsService {
426
426
  const manyTermProduct = products.filter((product) => product.type === ELoanTypes.TERM).length > 1;
427
427
 
428
428
  return await Promise.all(products.map(async (product) => {
429
- if (product.masterLoanProductId != null) {
429
+ if (product.masteredLoanProductId != null) {
430
430
  return null as IBankReportData;
431
431
  }
432
432
  if (dayjs(product.deactivationDate).isBefore(dayjs(date))) {