gemcap-be-common 1.4.129 → 1.4.131

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.129",
3
+ "version": "1.4.131",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -113,9 +113,6 @@ class QuickbooksService {
113
113
  }
114
114
  if (deleteOld) {
115
115
  const companyId = accounts[0].companyId;
116
- // console.log({ companyId });
117
- // const existingAccounts = await QuickbooksAccount.find({ companyId: new mongoose.Types.ObjectId(companyId) });
118
- // console.log({ existingAccounts });
119
116
  const accountIds = accounts
120
117
  .filter((account) => !account._id.startsWith('new_'))
121
118
  .map((account) => new mongoose_1.default.Types.ObjectId(account._id));
@@ -381,8 +378,8 @@ class QuickbooksService {
381
378
  mainData.push({ ...tr });
382
379
  if (chargeTypes.includes('BROKERS') && isAccrual) {
383
380
  const handleFee = async (broker, shareName) => {
384
- const quickbooksAccountBrokerBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: broker.BSCode }).lean();
385
- const quickbooksAccountBrokerPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: broker.PLCode }).lean();
381
+ const quickbooksAccountBrokerBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: broker.BSCode, companyId: assetCompany._id.toString() }).lean();
382
+ const quickbooksAccountBrokerPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: broker.PLCode, companyId: assetCompany._id.toString() }).lean();
386
383
  if (!quickbooksAccountBrokerBS || !quickbooksAccountBrokerPL) {
387
384
  if (!quickbooksAccountBrokerBS) {
388
385
  reportErrorsSet.add(broker.BSCode);
@@ -11,7 +11,6 @@ import { BorrowerModel } from '../models/Borrower.model';
11
11
  import { ETermLoanStatus, TermLoanModel } from '../models/TermLoan.model';
12
12
  import { EChargeType } from '../db/reports.db';
13
13
  import { IBankView } from '../models/Banks.model';
14
-
15
14
  import { IQuickbooksAccount, QuickbooksAccount } from '../models/QuickbooksAccount.model';
16
15
  import { IQuickbooksUploadItem } from '../classes/quickbook-item';
17
16
  import { IUploadedBankTransaction } from '../models/UploadedBankTransaction.model';
@@ -156,9 +155,6 @@ export class QuickbooksService {
156
155
  }
157
156
  if (deleteOld) {
158
157
  const companyId = accounts[0].companyId;
159
- // console.log({ companyId });
160
- // const existingAccounts = await QuickbooksAccount.find({ companyId: new mongoose.Types.ObjectId(companyId) });
161
- // console.log({ existingAccounts });
162
158
  const accountIds = accounts
163
159
  .filter((account) => !account._id.startsWith('new_'))
164
160
  .map((account) => new mongoose.Types.ObjectId(account._id));
@@ -448,8 +444,8 @@ export class QuickbooksService {
448
444
 
449
445
  const handleFee = async (broker: IProductBrokerDocWithBroker, shareName: 'adminShare' | 'interestShare' | 'otherShare') => {
450
446
 
451
- const quickbooksAccountBrokerBS = await QuickbooksAccount.findOne({ accountCode: broker.BSCode }).lean();
452
- const quickbooksAccountBrokerPL = await QuickbooksAccount.findOne({ accountCode: broker.PLCode }).lean();
447
+ const quickbooksAccountBrokerBS = await QuickbooksAccount.findOne({ accountCode: broker.BSCode, companyId: assetCompany._id.toString() }).lean();
448
+ const quickbooksAccountBrokerPL = await QuickbooksAccount.findOne({ accountCode: broker.PLCode, companyId: assetCompany._id.toString() }).lean();
453
449
  if (!quickbooksAccountBrokerBS || !quickbooksAccountBrokerPL) {
454
450
  if (!quickbooksAccountBrokerBS) {
455
451
  reportErrorsSet.add(broker.BSCode);