gemcap-be-common 1.4.121 → 1.4.122

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.
@@ -51,6 +51,7 @@ export declare const AccountSchema: {
51
51
  accountId1: {
52
52
  type: typeof Schema.Types.Mixed;
53
53
  required: false;
54
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
54
55
  validate: {
55
56
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
56
57
  message: (props: any) => string;
@@ -59,6 +60,7 @@ export declare const AccountSchema: {
59
60
  accountId2: {
60
61
  type: typeof Schema.Types.Mixed;
61
62
  required: false;
63
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
62
64
  validate: {
63
65
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
64
66
  message: (props: any) => string;
@@ -68,6 +70,7 @@ export declare const AccountSchema: {
68
70
  accountId1: {
69
71
  type: typeof Schema.Types.Mixed;
70
72
  required: false;
73
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
71
74
  validate: {
72
75
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
73
76
  message: (props: any) => string;
@@ -76,6 +79,7 @@ export declare const AccountSchema: {
76
79
  accountId2: {
77
80
  type: typeof Schema.Types.Mixed;
78
81
  required: false;
82
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
79
83
  validate: {
80
84
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
81
85
  message: (props: any) => string;
@@ -85,6 +89,7 @@ export declare const AccountSchema: {
85
89
  accountId1: {
86
90
  type: typeof Schema.Types.Mixed;
87
91
  required: false;
92
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
88
93
  validate: {
89
94
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
90
95
  message: (props: any) => string;
@@ -93,6 +98,7 @@ export declare const AccountSchema: {
93
98
  accountId2: {
94
99
  type: typeof Schema.Types.Mixed;
95
100
  required: false;
101
+ set: (value: unknown) => mongoose.Types.ObjectId | 'BANK' | null;
96
102
  validate: {
97
103
  validator: (value: mongoose.Types.ObjectId | 'BANK' | null) => boolean;
98
104
  message: (props: any) => string;
@@ -26,12 +26,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.CashAllocationProduct = exports.CashAllocationProductSchema = exports.AccountSchema = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
28
  const _models_1 = require("./_models");
29
+ const normalizeAccountValue = (value) => {
30
+ if (value === null || value === undefined || value === '') {
31
+ return null;
32
+ }
33
+ if (value === 'BANK') {
34
+ return 'BANK';
35
+ }
36
+ if (typeof value === 'string' && mongoose_1.default.isValidObjectId(value)) {
37
+ return new mongoose_1.default.Types.ObjectId(value);
38
+ }
39
+ if (value instanceof mongoose_1.default.Types.ObjectId) {
40
+ return value;
41
+ }
42
+ return null;
43
+ };
29
44
  exports.AccountSchema = {
30
45
  type: Map,
31
46
  of: new mongoose_1.Schema({
32
47
  accountId1: {
33
48
  type: mongoose_1.Schema.Types.Mixed,
34
49
  required: false,
50
+ set: normalizeAccountValue,
35
51
  validate: {
36
52
  validator: function (value) {
37
53
  return (value === null ||
@@ -44,6 +60,7 @@ exports.AccountSchema = {
44
60
  accountId2: {
45
61
  type: mongoose_1.Schema.Types.Mixed,
46
62
  required: false,
63
+ set: normalizeAccountValue,
47
64
  validate: {
48
65
  validator: function (value) {
49
66
  return (value === null ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.121",
3
+ "version": "1.4.122",
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
+ LAST_MONTH?: boolean;
88
+ CURRENT_MONTH?: boolean;
87
89
  ENTIRE_LOAN?: boolean;
88
90
  SELECTED_PERIOD?: boolean;
89
- CURRENT_MONTH?: boolean;
90
- LAST_MONTH?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;