gemcap-be-common 1.2.24 → 1.2.26

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.
Files changed (93) hide show
  1. package/db/availability.db.d.ts +2 -2
  2. package/db/availability.db.js +7 -7
  3. package/db/availability.db.ts +3 -3
  4. package/db/bbcDates.db.d.ts +2 -2
  5. package/db/bbcDates.db.js +10 -9
  6. package/db/bbcDates.db.ts +3 -2
  7. package/db/bbcSheets.db.d.ts +2 -2
  8. package/db/bbcSheets.db.js +6 -6
  9. package/db/bbcSheets.db.ts +2 -2
  10. package/db/collaterals.db.d.ts +6 -6
  11. package/db/collaterals.db.js +18 -15
  12. package/db/collaterals.db.ts +8 -12
  13. package/db/inventory-availability.db.d.ts +2 -1
  14. package/db/inventory-availability.db.js +8 -7
  15. package/db/inventory-availability.db.ts +2 -3
  16. package/db/inventory-manual-entry.db.d.ts +1 -1
  17. package/db/inventory-manual-entry.db.js +2 -2
  18. package/db/inventory-manual-entry.db.ts +1 -1
  19. package/db/inventory-seasonal-rates.db.d.ts +1 -1
  20. package/db/inventory-seasonal-rates.db.js +5 -5
  21. package/db/inventory-seasonal-rates.db.ts +1 -1
  22. package/db/loan-products.db.d.ts +3 -2
  23. package/db/loan-products.db.js +18 -15
  24. package/db/loan-products.db.ts +9 -10
  25. package/db/loan-statement.db.js +4 -3
  26. package/db/loan-statement.db.ts +2 -1
  27. package/db/microservice-tasks.db.d.ts +2 -2
  28. package/db/microservice-tasks.db.js +9 -9
  29. package/db/microservice-tasks.db.ts +3 -2
  30. package/db/receivables.db.d.ts +1 -1
  31. package/db/receivables.db.js +24 -23
  32. package/db/receivables.db.ts +4 -3
  33. package/db/user-logs.db.d.ts +1 -1
  34. package/db/user-logs.db.js +2 -2
  35. package/db/user-logs.db.ts +1 -1
  36. package/helpers/column-desciptions.helper.d.ts +4 -4
  37. package/helpers/column-desciptions.helper.js +51 -49
  38. package/helpers/column-desciptions.helper.ts +7 -4
  39. package/helpers/numbers.helper.d.ts +1 -1
  40. package/helpers/numbers.helper.js +7 -6
  41. package/helpers/numbers.helper.ts +3 -2
  42. package/helpers/paginator.helper.d.ts +1 -1
  43. package/helpers/paginator.helper.js +2 -2
  44. package/helpers/paginator.helper.ts +1 -1
  45. package/helpers/users.helper.d.ts +2 -1
  46. package/helpers/users.helper.js +4 -4
  47. package/helpers/users.helper.ts +2 -1
  48. package/interfaces/collaterals.interface.d.ts +3 -1
  49. package/interfaces/collaterals.interface.ts +3 -1
  50. package/interfaces/custom-row.interface.d.ts +2 -1
  51. package/interfaces/custom-row.interface.ts +2 -1
  52. package/interfaces/email-addresses.interface.d.ts +1 -1
  53. package/interfaces/email-addresses.interface.ts +1 -1
  54. package/interfaces/query.interface.d.ts +1 -1
  55. package/interfaces/query.interface.ts +1 -1
  56. package/models/AccountPayableItem.model.d.ts +1 -1
  57. package/models/AccountPayableItem.model.ts +1 -1
  58. package/models/InventoryAvailability.model.d.ts +2 -2
  59. package/models/InventoryAvailability.model.js +1 -1
  60. package/models/InventoryAvailability.model.ts +2 -2
  61. package/models/InventoryItem.model.d.ts +1 -1
  62. package/models/InventoryItem.model.ts +1 -1
  63. package/models/LoanCharges.model.d.ts +2 -1
  64. package/models/LoanCharges.model.js +33 -32
  65. package/models/LoanCharges.model.ts +2 -2
  66. package/models/LoanProducts.model.d.ts +1 -1
  67. package/models/LoanProducts.model.ts +1 -1
  68. package/models/LoanTransaction.model.js +5 -5
  69. package/models/LoanTransaction.model.ts +1 -1
  70. package/models/MicroserviceTask.model.d.ts +2 -1
  71. package/models/MicroserviceTask.model.js +2 -1
  72. package/models/MicroserviceTask.model.ts +4 -3
  73. package/models/ReceivableItem.model.d.ts +1 -1
  74. package/models/ReceivableItem.model.ts +1 -1
  75. package/models/Yield.model.d.ts +1 -1
  76. package/models/Yield.model.ts +1 -1
  77. package/package.json +1 -1
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/db/index.d.ts +0 -12
  80. package/db/index.js +0 -28
  81. package/db/index.ts +0 -12
  82. package/enums/index.d.ts +0 -14
  83. package/enums/index.js +0 -30
  84. package/enums/index.ts +0 -14
  85. package/helpers/index.d.ts +0 -9
  86. package/helpers/index.js +0 -25
  87. package/helpers/index.ts +0 -9
  88. package/interfaces/index.d.ts +0 -14
  89. package/interfaces/index.js +0 -30
  90. package/interfaces/index.ts +0 -14
  91. package/models/index.d.ts +0 -29
  92. package/models/index.js +0 -45
  93. package/models/index.ts +0 -29
@@ -1,5 +1,5 @@
1
- import { IAvailabilitySignDoc, IAvailabilitySignItem, IAvailabilitySignView } from '../models';
2
- import { IResult } from '../interfaces';
1
+ import { IAvailabilitySignDoc, IAvailabilitySignItem, IAvailabilitySignView } from '../models/AvailabilitySigns.model';
2
+ import { IResult } from '../interfaces/result.interface';
3
3
  export declare const findAvailabilitySignsByBBCDateId: (bbcDateId: string) => Promise<IAvailabilitySignDoc>;
4
4
  export declare const getAvailabilitySigns: (bbcDateId: string) => Promise<IAvailabilitySignView[]>;
5
5
  export declare const addAvailabilitySign: (bbcDateId: string, sign: IAvailabilitySignItem) => Promise<IResult>;
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.updateAvailabilitySigns = exports.addAvailabilitySign = exports.getAvailabilitySigns = exports.findAvailabilitySignsByBBCDateId = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
- const models_1 = require("../models");
8
+ const AvailabilitySigns_model_1 = require("../models/AvailabilitySigns.model");
9
9
  const findAvailabilitySignsByBBCDateId = async (bbcDateId) => {
10
- return models_1.AvailabilitySignsModel.findOne({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }).lean();
10
+ return AvailabilitySigns_model_1.AvailabilitySignsModel.findOne({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }).lean();
11
11
  };
12
12
  exports.findAvailabilitySignsByBBCDateId = findAvailabilitySignsByBBCDateId;
13
13
  const getAvailabilitySigns = async (bbcDateId) => {
14
- return models_1.AvailabilitySignsModel.aggregate([
14
+ return AvailabilitySigns_model_1.AvailabilitySignsModel.aggregate([
15
15
  {
16
16
  $match: {
17
17
  'bbcDateId': new mongoose_1.default.Types.ObjectId(bbcDateId)
@@ -73,9 +73,9 @@ const getAvailabilitySigns = async (bbcDateId) => {
73
73
  };
74
74
  exports.getAvailabilitySigns = getAvailabilitySigns;
75
75
  const addAvailabilitySign = async (bbcDateId, sign) => {
76
- const availabilitySigns = await models_1.AvailabilitySignsModel.findOne({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }).lean();
76
+ const availabilitySigns = await AvailabilitySigns_model_1.AvailabilitySignsModel.findOne({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }).lean();
77
77
  if (!availabilitySigns) {
78
- await models_1.AvailabilitySignsModel.create({ bbcDateId, signs: [sign] });
78
+ await AvailabilitySigns_model_1.AvailabilitySignsModel.create({ bbcDateId, signs: [sign] });
79
79
  return { message: 'Availability was signed', success: true };
80
80
  }
81
81
  const activeSigns = availabilitySigns.signs.filter((sign) => !sign.revokedAt);
@@ -87,11 +87,11 @@ const addAvailabilitySign = async (bbcDateId, sign) => {
87
87
  return { message: `Availability required only ${availabilitySigns.requiredSigns} signs`, success: false };
88
88
  }
89
89
  const updatedSigns = availabilitySigns.signs.slice();
90
- await models_1.AvailabilitySignsModel.findOneAndUpdate({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }, { signs: [...updatedSigns, sign] });
90
+ await AvailabilitySigns_model_1.AvailabilitySignsModel.findOneAndUpdate({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }, { signs: [...updatedSigns, sign] });
91
91
  return { message: 'Availability was signed', success: true };
92
92
  };
93
93
  exports.addAvailabilitySign = addAvailabilitySign;
94
94
  const updateAvailabilitySigns = async (bbcDateId, signs) => {
95
- await models_1.AvailabilitySignsModel.findOneAndUpdate({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }, { signs: signs });
95
+ await AvailabilitySigns_model_1.AvailabilitySignsModel.findOneAndUpdate({ bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId) }, { signs: signs });
96
96
  };
97
97
  exports.updateAvailabilitySigns = updateAvailabilitySigns;
@@ -4,9 +4,9 @@ import {
4
4
  AvailabilitySignsModel,
5
5
  IAvailabilitySignDoc,
6
6
  IAvailabilitySignItem,
7
- IAvailabilitySignView
8
- } from '../models';
9
- import { IResult } from '../interfaces';
7
+ IAvailabilitySignView,
8
+ } from '../models/AvailabilitySigns.model';
9
+ import { IResult } from '../interfaces/result.interface';
10
10
 
11
11
  export const findAvailabilitySignsByBBCDateId = async (bbcDateId: string): Promise<IAvailabilitySignDoc> => {
12
12
  return AvailabilitySignsModel.findOne({ bbcDateId: new mongoose.Types.ObjectId(bbcDateId) }).lean();
@@ -23,8 +23,8 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- import { IBBCDateDoc } from '../models';
27
- import { ECollaterals } from '../enums';
26
+ import { IBBCDateDoc } from '../models/BBCDate.model';
27
+ import { ECollaterals } from '../enums/collaterals.enum';
28
28
  export declare const getBBCDateDoc: (bbcDateId: string) => Promise<mongoose.FlattenMaps<IBBCDateDoc> & {
29
29
  _id: mongoose.Types.ObjectId;
30
30
  }>;
package/db/bbcDates.db.js CHANGED
@@ -5,14 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createBBCDate = exports.getBBCDatesByType = exports.getBBCDatesForPeriod = exports.getBBCDates = exports.getOlderBBCDates = exports.getLatestSignedBBCDateDoc = exports.getBBCDatesByBorrower = exports.getBBCDateDoc = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
- const models_1 = require("../models");
8
+ const BBCDate_model_1 = require("../models/BBCDate.model");
9
+ const BBCSheet_model_1 = require("../models/BBCSheet.model");
9
10
  const availability_db_1 = require("./availability.db");
10
11
  const getBBCDateDoc = async (bbcDateId) => {
11
- return models_1.BBCDateModel.findById(bbcDateId).lean();
12
+ return BBCDate_model_1.BBCDateModel.findById(bbcDateId).lean();
12
13
  };
13
14
  exports.getBBCDateDoc = getBBCDateDoc;
14
15
  const getBBCDatesByBorrower = async (borrowerId, sortOrder = 1) => {
15
- return models_1.BBCDateModel.aggregate([
16
+ return BBCDate_model_1.BBCDateModel.aggregate([
16
17
  {
17
18
  $match: {
18
19
  borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
@@ -25,7 +26,7 @@ const getBBCDatesByBorrower = async (borrowerId, sortOrder = 1) => {
25
26
  };
26
27
  exports.getBBCDatesByBorrower = getBBCDatesByBorrower;
27
28
  const getLatestSignedBBCDateDoc = async (borrowerId) => {
28
- const bbcDates = await models_1.BBCDateModel.aggregate([
29
+ const bbcDates = await BBCDate_model_1.BBCDateModel.aggregate([
29
30
  {
30
31
  $match: {
31
32
  borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
@@ -55,7 +56,7 @@ const getLatestSignedBBCDateDoc = async (borrowerId) => {
55
56
  };
56
57
  exports.getLatestSignedBBCDateDoc = getLatestSignedBBCDateDoc;
57
58
  const getOlderBBCDates = async (borrowerId, bbcDate) => {
58
- return models_1.BBCDateModel.aggregate([
59
+ return BBCDate_model_1.BBCDateModel.aggregate([
59
60
  {
60
61
  $match: {
61
62
  borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
@@ -69,7 +70,7 @@ const getOlderBBCDates = async (borrowerId, bbcDate) => {
69
70
  };
70
71
  exports.getOlderBBCDates = getOlderBBCDates;
71
72
  const getBBCDates = async (borrowerId, bbcDate) => {
72
- return models_1.BBCDateModel.aggregate([
73
+ return BBCDate_model_1.BBCDateModel.aggregate([
73
74
  {
74
75
  $match: {
75
76
  borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
@@ -83,7 +84,7 @@ const getBBCDates = async (borrowerId, bbcDate) => {
83
84
  };
84
85
  exports.getBBCDates = getBBCDates;
85
86
  const getBBCDatesForPeriod = async (borrowerId, bbcDateStart, bbcDateEnd) => {
86
- return models_1.BBCDateModel.aggregate([
87
+ return BBCDate_model_1.BBCDateModel.aggregate([
87
88
  {
88
89
  $match: {
89
90
  $and: [
@@ -102,7 +103,7 @@ const getBBCDatesForPeriod = async (borrowerId, bbcDateStart, bbcDateEnd) => {
102
103
  };
103
104
  exports.getBBCDatesForPeriod = getBBCDatesForPeriod;
104
105
  const getBBCDatesByType = (borrowerId, collateralType) => {
105
- return models_1.BBCSheetModel.aggregate([
106
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
106
107
  {
107
108
  $match: {
108
109
  'dataType': collateralType,
@@ -155,7 +156,7 @@ const getBBCDatesByType = (borrowerId, collateralType) => {
155
156
  };
156
157
  exports.getBBCDatesByType = getBBCDatesByType;
157
158
  const createBBCDate = async (borrowerId, bbcDate) => {
158
- const newBBC = await models_1.BBCDateModel.create({ borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId), bbcDate });
159
+ const newBBC = await BBCDate_model_1.BBCDateModel.create({ borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId), bbcDate });
159
160
  return newBBC.save();
160
161
  };
161
162
  exports.createBBCDate = createBBCDate;
package/db/bbcDates.db.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
- import { BBCDateModel, BBCSheetModel, IBBCDateDoc } from '../models';
3
+ import { BBCDateModel, IBBCDateDoc } from '../models/BBCDate.model';
4
+ import { BBCSheetModel } from '../models/BBCSheet.model';
4
5
  import { getAvailabilitySigns } from './availability.db';
5
- import { ECollaterals } from '../enums';
6
+ import { ECollaterals } from '../enums/collaterals.enum';
6
7
 
7
8
  export const getBBCDateDoc = async (bbcDateId: string) => {
8
9
  return BBCDateModel.findById(bbcDateId).lean();
@@ -23,8 +23,8 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- import { ECollaterals } from '../enums';
27
- import { IBBCSheetDoc } from '../models';
26
+ import { ECollaterals } from '../enums/collaterals.enum';
27
+ import { IBBCSheetDoc } from '../models/BBCSheet.model';
28
28
  export declare const getBBCSheetsByType: (bbcDateIds: string[], collateralType: ECollaterals) => Promise<IBBCSheetDoc[]>;
29
29
  export declare const getBBCSheetsByTypeGroupedByBBC: (bbcDateIds: string[], collateralType: ECollaterals) => Promise<{
30
30
  _id: mongoose.Types.ObjectId;
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createBBCSheet = exports.getUniqueDatesForPeriod = exports.getUniqueDates = exports.getBBCSheetsByTypeGroupedByBBC = exports.getBBCSheetsByType = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
- const models_1 = require("../models");
8
+ const BBCSheet_model_1 = require("../models/BBCSheet.model");
9
9
  const getBBCSheetsByType = async (bbcDateIds, collateralType) => {
10
- return models_1.BBCSheetModel.aggregate([
10
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
11
11
  {
12
12
  $match: {
13
13
  bbcDateId: { $in: bbcDateIds.map((id) => new mongoose_1.default.Types.ObjectId(id)) },
@@ -21,7 +21,7 @@ const getBBCSheetsByType = async (bbcDateIds, collateralType) => {
21
21
  };
22
22
  exports.getBBCSheetsByType = getBBCSheetsByType;
23
23
  const getBBCSheetsByTypeGroupedByBBC = async (bbcDateIds, collateralType) => {
24
- return models_1.BBCSheetModel.aggregate([
24
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
25
25
  {
26
26
  $match: {
27
27
  bbcDateId: { $in: bbcDateIds.map((id) => new mongoose_1.default.Types.ObjectId(id)) },
@@ -52,7 +52,7 @@ const getBBCSheetsByTypeGroupedByBBC = async (bbcDateIds, collateralType) => {
52
52
  };
53
53
  exports.getBBCSheetsByTypeGroupedByBBC = getBBCSheetsByTypeGroupedByBBC;
54
54
  const getUniqueDates = async (borrowerId, limit, collateral) => {
55
- return models_1.BBCSheetModel.aggregate([
55
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
56
56
  {
57
57
  $match: {
58
58
  'dataType': collateral,
@@ -109,7 +109,7 @@ const getUniqueDates = async (borrowerId, limit, collateral) => {
109
109
  };
110
110
  exports.getUniqueDates = getUniqueDates;
111
111
  const getUniqueDatesForPeriod = async (borrowerId, collateral, startDate, endDate) => {
112
- return models_1.BBCSheetModel.aggregate([
112
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
113
113
  {
114
114
  $match: {
115
115
  'dataType': collateral,
@@ -169,7 +169,7 @@ const createBBCSheet = async (bbcDateId, dataType) => {
169
169
  fileName: 'manual.xlsx',
170
170
  sheetName: 'manual',
171
171
  };
172
- const newBBCSheet = new models_1.BBCSheetModel(newSheet);
172
+ const newBBCSheet = new BBCSheet_model_1.BBCSheetModel(newSheet);
173
173
  return newBBCSheet.save();
174
174
  };
175
175
  exports.createBBCSheet = createBBCSheet;
@@ -1,7 +1,7 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
- import { ECollaterals } from '../enums';
4
- import { BBCSheetModel, IBBCSheet, IBBCSheetDoc } from '../models';
3
+ import { ECollaterals } from '../enums/collaterals.enum';
4
+ import { BBCSheetModel, IBBCSheet, IBBCSheetDoc } from '../models/BBCSheet.model';
5
5
 
6
6
  export const getBBCSheetsByType = async (bbcDateIds: string[], collateralType: ECollaterals) => {
7
7
  return BBCSheetModel.aggregate<IBBCSheetDoc>([
@@ -23,8 +23,8 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- import { IPaginatorOptions } from '../interfaces';
27
- import { ECollaterals } from '../enums';
26
+ import { IPaginatorOptions } from '../interfaces/collaterals.interface';
27
+ import { ECollaterals } from '../enums/collaterals.enum';
28
28
  export interface IBbcDateWithSheets {
29
29
  _id: mongoose.Types.ObjectId;
30
30
  bbcDate: Date;
@@ -36,13 +36,13 @@ export interface IBbcDateWithSheets {
36
36
  extraInfo?: string;
37
37
  }
38
38
  export declare const collateralMap: {
39
- INVENTORY: mongoose.Model<import("../models").IInventoryItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models").IInventoryItemDoc> & import("../models").IInventoryItemDoc & {
39
+ INVENTORY: mongoose.Model<import("../models/InventoryItem.model").IInventoryItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models/InventoryItem.model").IInventoryItemDoc> & import("../models/InventoryItem.model").IInventoryItemDoc & {
40
40
  _id: mongoose.Types.ObjectId;
41
41
  }, any>;
42
- RECEIVABLE: mongoose.Model<import("../models").IReceivableItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models").IReceivableItemDoc> & import("../models").IReceivableItemDoc & {
42
+ RECEIVABLE: mongoose.Model<import("../models/ReceivableItem.model").IReceivableItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models/ReceivableItem.model").IReceivableItemDoc> & import("../models/ReceivableItem.model").IReceivableItemDoc & {
43
43
  _id: mongoose.Types.ObjectId;
44
44
  }, any>;
45
- ACCOUNT_PAYABLE: mongoose.Model<import("../models").IAccountPayableItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models").IAccountPayableItemDoc> & import("../models").IAccountPayableItemDoc & {
45
+ ACCOUNT_PAYABLE: mongoose.Model<import("../models/AccountPayableItem.model").IAccountPayableItemDoc, {}, {}, {}, mongoose.Document<unknown, {}, import("../models/AccountPayableItem.model").IAccountPayableItemDoc> & import("../models/AccountPayableItem.model").IAccountPayableItemDoc & {
46
46
  _id: mongoose.Types.ObjectId;
47
47
  }, any>;
48
48
  };
@@ -84,7 +84,7 @@ export declare const ITEMS_PAGINATION: (paginatorOptions: IPaginatorOptions) =>
84
84
  $skip?: undefined;
85
85
  })[];
86
86
  export declare const findCollateralsWithSheets: (borrowerId: string, collateralTypes?: ECollaterals[]) => Promise<IBbcDateWithSheets[]>;
87
- export declare const getBBCSheetsForBorrowerAndType: (borrowerId: string, collateralType: ECollaterals) => Promise<import("../models").IBBCSheetDoc[]>;
87
+ export declare const getBBCSheetsForBorrowerAndType: (borrowerId: string, collateralType: ECollaterals) => Promise<import("../models/BBCSheet.model").IBBCSheetDoc[]>;
88
88
  export declare const getCollateralListBySheet: (sheetIds: string[], collateralType: ECollaterals) => Promise<any>;
89
89
  export declare const getPreviousCollateralDocument: (borrowerId: string, date: Date, collateralType: ECollaterals, limit?: number) => Promise<{
90
90
  _id: mongoose.Types.ObjectId;
@@ -6,21 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getCollateralDocsByBBC = exports.getPreviousCollateralDocument = exports.getCollateralListBySheet = exports.getBBCSheetsForBorrowerAndType = exports.findCollateralsWithSheets = exports.ITEMS_PAGINATION = exports.createQuery = exports.COLLATERALS_LOOKUP = exports.collateralFields = exports.collateralMap = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const _models_1 = require("../models/_models");
9
- const enums_1 = require("../enums");
10
- const models_1 = require("../models");
11
- const models_2 = require("../models");
12
- const helpers_1 = require("../helpers");
9
+ const collaterals_enum_1 = require("../enums/collaterals.enum");
10
+ const AccountPayableItem_model_1 = require("../models/AccountPayableItem.model");
11
+ const BBCDate_model_1 = require("../models/BBCDate.model");
12
+ const BBCSheet_model_1 = require("../models/BBCSheet.model");
13
+ const InventoryItem_model_1 = require("../models/InventoryItem.model");
14
+ const ReceivableItem_model_1 = require("../models/ReceivableItem.model");
15
+ const enums_helper_1 = require("../helpers/enums.helper");
13
16
  const bbcSheets_db_1 = require("./bbcSheets.db");
14
17
  const bbcDates_db_1 = require("./bbcDates.db");
15
18
  exports.collateralMap = {
16
- [enums_1.ECollaterals.INVENTORY]: models_1.InventoryItemModel,
17
- [enums_1.ECollaterals.RECEIVABLE]: models_2.ReceivableItemModel,
18
- [enums_1.ECollaterals.ACCOUNT_PAYABLE]: models_1.AccountPayableItemModel,
19
+ [collaterals_enum_1.ECollaterals.INVENTORY]: InventoryItem_model_1.InventoryItemModel,
20
+ [collaterals_enum_1.ECollaterals.RECEIVABLE]: ReceivableItem_model_1.ReceivableItemModel,
21
+ [collaterals_enum_1.ECollaterals.ACCOUNT_PAYABLE]: AccountPayableItem_model_1.AccountPayableItemModel,
19
22
  };
20
23
  exports.collateralFields = {
21
- [enums_1.ECollaterals.INVENTORY]: models_1.INVENTORY_FIELDS,
22
- [enums_1.ECollaterals.RECEIVABLE]: models_2.RECEIVABLE_FIELDS,
23
- [enums_1.ECollaterals.ACCOUNT_PAYABLE]: models_1.ACCOUNT_PAYABLE_FIELDS,
24
+ [collaterals_enum_1.ECollaterals.INVENTORY]: InventoryItem_model_1.INVENTORY_FIELDS,
25
+ [collaterals_enum_1.ECollaterals.RECEIVABLE]: ReceivableItem_model_1.RECEIVABLE_FIELDS,
26
+ [collaterals_enum_1.ECollaterals.ACCOUNT_PAYABLE]: AccountPayableItem_model_1.ACCOUNT_PAYABLE_FIELDS,
24
27
  };
25
28
  exports.COLLATERALS_LOOKUP = [
26
29
  {
@@ -51,7 +54,7 @@ exports.COLLATERALS_LOOKUP = [
51
54
  },
52
55
  ];
53
56
  const createQuery = (groupFields, collateralType) => {
54
- const enumKey = (0, helpers_1.getEnumKeyByEnumValue)(enums_1.ECollaterals, collateralType);
57
+ const enumKey = (0, enums_helper_1.getEnumKeyByEnumValue)(collaterals_enum_1.ECollaterals, collateralType);
55
58
  const itemFields = exports.collateralFields[enumKey];
56
59
  if (!itemFields) {
57
60
  console.error('Incorrect collateralType - ', collateralType);
@@ -90,7 +93,7 @@ const findCollateralsWithSheets = async (borrowerId, collateralTypes) => {
90
93
  ],
91
94
  }
92
95
  : bbcFilter;
93
- return models_1.BBCSheetModel.aggregate([
96
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
94
97
  {
95
98
  $match: collateralFilter,
96
99
  },
@@ -151,7 +154,7 @@ const getBBCSheetsForBorrowerAndType = async (borrowerId, collateralType) => {
151
154
  };
152
155
  exports.getBBCSheetsForBorrowerAndType = getBBCSheetsForBorrowerAndType;
153
156
  const getCollateralListBySheet = async (sheetIds, collateralType) => {
154
- const enumKey = (0, helpers_1.getEnumKeyByEnumValue)(enums_1.ECollaterals, collateralType);
157
+ const enumKey = (0, enums_helper_1.getEnumKeyByEnumValue)(collaterals_enum_1.ECollaterals, collateralType);
155
158
  const sheetIdsMapped = sheetIds.map((sheetId) => new mongoose_1.default.Types.ObjectId(sheetId));
156
159
  return exports.collateralMap[enumKey].aggregate([
157
160
  {
@@ -195,7 +198,7 @@ const getCollateralListBySheet = async (sheetIds, collateralType) => {
195
198
  };
196
199
  exports.getCollateralListBySheet = getCollateralListBySheet;
197
200
  const getPreviousCollateralDocument = async (borrowerId, date, collateralType, limit = 1) => {
198
- return models_1.BBCSheetModel.aggregate([
201
+ return BBCSheet_model_1.BBCSheetModel.aggregate([
199
202
  {
200
203
  $match: {
201
204
  'dataType': collateralType,
@@ -273,7 +276,7 @@ const getCollateralDocsByBBC = async (bbcIds, collateralType) => {
273
276
  },
274
277
  ]);
275
278
  if (!aggregationResult.length) {
276
- const BBCs = await models_1.BBCDateModel.find({ _id: { $in: bbcIds } }).lean();
279
+ const BBCs = await BBCDate_model_1.BBCDateModel.find({ _id: { $in: bbcIds } }).lean();
277
280
  return BBCs.map((BBC) => ({ ...BBC, items: [] }));
278
281
  }
279
282
  return aggregationResult;
@@ -1,18 +1,14 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
3
  import { MODEL_NAMES } from '../models/_models';
4
- import { IPaginatorOptions } from '../interfaces';
5
- import { ECollaterals } from '../enums';
6
- import {
7
- ACCOUNT_PAYABLE_FIELDS,
8
- AccountPayableItemModel,
9
- BBCDateModel,
10
- BBCSheetModel,
11
- INVENTORY_FIELDS,
12
- InventoryItemModel,
13
- } from '../models';
14
- import { RECEIVABLE_FIELDS, ReceivableItemModel } from '../models';
15
- import { getEnumKeyByEnumValue } from '../helpers';
4
+ import { IPaginatorOptions } from '../interfaces/collaterals.interface';
5
+ import { ECollaterals } from '../enums/collaterals.enum';
6
+ import { ACCOUNT_PAYABLE_FIELDS, AccountPayableItemModel } from '../models/AccountPayableItem.model';
7
+ import { BBCDateModel } from '../models/BBCDate.model';
8
+ import { BBCSheetModel } from '../models/BBCSheet.model';
9
+ import { INVENTORY_FIELDS, InventoryItemModel } from '../models/InventoryItem.model';
10
+ import { RECEIVABLE_FIELDS, ReceivableItemModel } from '../models/ReceivableItem.model';
11
+ import { getEnumKeyByEnumValue } from '../helpers/enums.helper';
16
12
  import { getBBCSheetsByType } from './bbcSheets.db';
17
13
  import { getBBCDatesByBorrower } from './bbcDates.db';
18
14
 
@@ -1,4 +1,5 @@
1
- import { IInventoryAvailabilityDocument, IInventoryAvailabilityItem, IInventoryAvailabilitySummary } from '../models';
1
+ import { IInventoryAvailabilityDocument, IInventoryAvailabilitySummary } from '../models/InventoryAvailability.model';
2
+ import { IInventoryAvailabilityItem } from '../models/InventoryAvailabilityItem.model';
2
3
  export declare const getInventoryAvailabilityByBBCDateId: (bbcDateId: string) => Promise<IInventoryAvailabilityDocument>;
3
4
  export declare const saveInventoryAvailabilityItems: (inventoryAvailabilityId: string, items: IInventoryAvailabilityItem[]) => Promise<void>;
4
5
  export declare const saveInventoryAvailabilitySummary: (inventoryAvailabilityId: string, summary: IInventoryAvailabilitySummary[]) => Promise<void>;
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setManualInputsToggle = exports.updateAvailabilityStatus = exports.saveInventoryAvailabilitySummary = exports.saveInventoryAvailabilityItems = exports.getInventoryAvailabilityByBBCDateId = void 0;
4
- const models_1 = require("../models");
4
+ const InventoryAvailability_model_1 = require("../models/InventoryAvailability.model");
5
+ const InventoryAvailabilityItem_model_1 = require("../models/InventoryAvailabilityItem.model");
5
6
  const getInventoryAvailabilityByBBCDateId = async (bbcDateId) => {
6
- return models_1.InventoryAvailabilityModel
7
+ return InventoryAvailability_model_1.InventoryAvailabilityModel
7
8
  .findOne({ bbcDateId })
8
9
  .lean();
9
10
  };
10
11
  exports.getInventoryAvailabilityByBBCDateId = getInventoryAvailabilityByBBCDateId;
11
12
  const saveInventoryAvailabilityItems = async (inventoryAvailabilityId, items) => {
12
- await models_1.InventoryAvailabilityItemModel.deleteMany({ inventoryAvailabilityId });
13
- await models_1.InventoryAvailabilityItemModel.insertMany(items);
13
+ await InventoryAvailabilityItem_model_1.InventoryAvailabilityItemModel.deleteMany({ inventoryAvailabilityId });
14
+ await InventoryAvailabilityItem_model_1.InventoryAvailabilityItemModel.insertMany(items);
14
15
  };
15
16
  exports.saveInventoryAvailabilityItems = saveInventoryAvailabilityItems;
16
17
  const saveInventoryAvailabilitySummary = async (inventoryAvailabilityId, summary) => {
17
- await models_1.InventoryAvailabilityModel.findByIdAndUpdate(inventoryAvailabilityId, { summary }, { upsert: true, new: true });
18
+ await InventoryAvailability_model_1.InventoryAvailabilityModel.findByIdAndUpdate(inventoryAvailabilityId, { summary }, { upsert: true, new: true });
18
19
  };
19
20
  exports.saveInventoryAvailabilitySummary = saveInventoryAvailabilitySummary;
20
21
  const updateAvailabilityStatus = async (bbcDateId, status) => {
21
- await models_1.InventoryAvailabilityModel.updateOne({ bbcDateId }, { status });
22
+ await InventoryAvailability_model_1.InventoryAvailabilityModel.updateOne({ bbcDateId }, { status });
22
23
  };
23
24
  exports.updateAvailabilityStatus = updateAvailabilityStatus;
24
25
  const setManualInputsToggle = async (bbcDateId, useManualInputs) => {
25
- await models_1.InventoryAvailabilityModel.updateOne({ bbcDateId }, { useManualInputs });
26
+ await InventoryAvailability_model_1.InventoryAvailabilityModel.updateOne({ bbcDateId }, { useManualInputs });
26
27
  };
27
28
  exports.setManualInputsToggle = setManualInputsToggle;
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  IInventoryAvailabilityDocument,
3
- IInventoryAvailabilityItem,
4
3
  IInventoryAvailabilitySummary,
5
- InventoryAvailabilityItemModel,
6
4
  InventoryAvailabilityModel,
7
- } from '../models';
5
+ } from '../models/InventoryAvailability.model';
6
+ import { IInventoryAvailabilityItem, InventoryAvailabilityItemModel } from '../models/InventoryAvailabilityItem.model';
8
7
 
9
8
  export const getInventoryAvailabilityByBBCDateId = async (bbcDateId: string): Promise<IInventoryAvailabilityDocument> => {
10
9
  return InventoryAvailabilityModel
@@ -1,2 +1,2 @@
1
- import { IInventoryManualEntry } from '../models';
1
+ import { IInventoryManualEntry } from '../models/InventoryManualEntry.model';
2
2
  export declare const getInventoryManualEntryData: (bbcDateId: string) => Promise<IInventoryManualEntry>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInventoryManualEntryData = void 0;
4
- const models_1 = require("../models");
4
+ const InventoryManualEntry_model_1 = require("../models/InventoryManualEntry.model");
5
5
  const getInventoryManualEntryData = async (bbcDateId) => {
6
- const manualEntry = await models_1.InventoryManualEntryModel.findOne({ bbcDateId }).lean();
6
+ const manualEntry = await InventoryManualEntry_model_1.InventoryManualEntryModel.findOne({ bbcDateId }).lean();
7
7
  if (!manualEntry) {
8
8
  return {
9
9
  bbcDateId: bbcDateId,
@@ -1,4 +1,4 @@
1
- import { IInventoryManualEntry, InventoryManualEntryModel } from '../models';
1
+ import { IInventoryManualEntry, InventoryManualEntryModel } from '../models/InventoryManualEntry.model';
2
2
 
3
3
  export const getInventoryManualEntryData = async (bbcDateId: string) => {
4
4
  const manualEntry = await InventoryManualEntryModel.findOne({ bbcDateId }).lean();
@@ -1,4 +1,4 @@
1
- import { IInventorySeasonalRatesDoc, IInventorySeasonalRatesItemDoc } from '../models';
1
+ import { IInventorySeasonalRatesDoc, IInventorySeasonalRatesItemDoc } from '../models/InventorySeasonalRates.model';
2
2
  export declare const getNewSeasonalRates: (borrowerId: string) => Promise<IInventorySeasonalRatesDoc>;
3
3
  export declare const getSeasonalRates: (borrowerId: string) => Promise<IInventorySeasonalRatesDoc>;
4
4
  export declare const saveSeasonalRates: (borrowerId: string, rates: IInventorySeasonalRatesItemDoc[]) => Promise<void>;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.saveSeasonalRates = exports.getSeasonalRates = exports.getNewSeasonalRates = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
- const models_1 = require("../models");
8
+ const InventorySeasonalRates_model_1 = require("../models/InventorySeasonalRates.model");
9
9
  const getNewSeasonalRates = async (borrowerId) => {
10
10
  return {
11
11
  borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
@@ -14,7 +14,7 @@ const getNewSeasonalRates = async (borrowerId) => {
14
14
  };
15
15
  exports.getNewSeasonalRates = getNewSeasonalRates;
16
16
  const getSeasonalRates = async (borrowerId) => {
17
- const foundRates = await models_1.InventorySeasonalEntryModel.findOne({ borrowerId });
17
+ const foundRates = await InventorySeasonalRates_model_1.InventorySeasonalEntryModel.findOne({ borrowerId });
18
18
  if (foundRates) {
19
19
  return foundRates;
20
20
  }
@@ -22,20 +22,20 @@ const getSeasonalRates = async (borrowerId) => {
22
22
  };
23
23
  exports.getSeasonalRates = getSeasonalRates;
24
24
  const saveSeasonalRates = async (borrowerId, rates) => {
25
- const foundRates = await models_1.InventorySeasonalEntryModel.findOne({ borrowerId });
25
+ const foundRates = await InventorySeasonalRates_model_1.InventorySeasonalEntryModel.findOne({ borrowerId });
26
26
  if (foundRates) {
27
27
  const mappedRates = rates.map((rate) => {
28
28
  const { _id, ...restRate } = rate;
29
29
  return restRate;
30
30
  });
31
- await models_1.InventorySeasonalEntryModel.findByIdAndUpdate(foundRates._id, { items: mappedRates });
31
+ await InventorySeasonalRates_model_1.InventorySeasonalEntryModel.findByIdAndUpdate(foundRates._id, { items: mappedRates });
32
32
  }
33
33
  else {
34
34
  const mappedRates = rates.map((rate) => {
35
35
  const { _id, ...restRate } = rate;
36
36
  return restRate;
37
37
  });
38
- const newRates = await models_1.InventorySeasonalEntryModel.create({ borrowerId, items: mappedRates });
38
+ const newRates = await InventorySeasonalRates_model_1.InventorySeasonalEntryModel.create({ borrowerId, items: mappedRates });
39
39
  await newRates.save();
40
40
  }
41
41
  };
@@ -4,7 +4,7 @@ import {
4
4
  IInventorySeasonalRatesDoc,
5
5
  IInventorySeasonalRatesItemDoc,
6
6
  InventorySeasonalEntryModel,
7
- } from '../models';
7
+ } from '../models/InventorySeasonalRates.model';
8
8
 
9
9
  export const getNewSeasonalRates = async (borrowerId: string) => {
10
10
  return <IInventorySeasonalRatesDoc>{
@@ -23,8 +23,9 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- import { ILoanChargeView, IStatementPeriod } from '../models';
27
- export declare const getLoanProductById: (productId: string) => Promise<mongoose.FlattenMaps<import("../models").ILoanProductDoc> & {
26
+ import { ILoanChargeView } from '../models/LoanCharges.model';
27
+ import { IStatementPeriod } from '../models/LoanStatementTransaction.model';
28
+ export declare const getLoanProductById: (productId: string) => Promise<mongoose.FlattenMaps<import("../models/LoanProducts.model").ILoanProductDoc> & {
28
29
  _id: mongoose.Types.ObjectId;
29
30
  }>;
30
31
  export declare const getLoanProductBalance: (productId: string, forDate?: Date) => Promise<{