gemcap-be-common 1.5.3 → 1.5.5

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.
@@ -74,65 +74,65 @@ export declare const LoanChargeSchema: mongoose.Schema<any, mongoose.Model<any,
74
74
  createdAt: NativeDate;
75
75
  updatedAt: NativeDate;
76
76
  } & {
77
- name: string;
77
+ borrowerId: mongoose.Types.ObjectId;
78
78
  order: number;
79
79
  active: boolean;
80
- borrowerId: mongoose.Types.ObjectId;
80
+ name: string;
81
81
  code: string;
82
- frequency: string;
83
- productId: mongoose.Types.ObjectId;
84
82
  PLCode: string;
83
+ productId: mongoose.Types.ObjectId;
85
84
  percent: number;
86
85
  minimumAmount: number;
86
+ frequency: string;
87
87
  applyFrom: Date;
88
88
  calculationBasis: string;
89
89
  chargeType: string;
90
90
  includeInYield: boolean;
91
- __v?: number;
92
91
  deletedAt?: Date;
93
92
  paymentOrder?: number;
93
+ __v?: number;
94
94
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
95
95
  createdAt: NativeDate;
96
96
  updatedAt: NativeDate;
97
97
  } & {
98
- name: string;
98
+ borrowerId: mongoose.Types.ObjectId;
99
99
  order: number;
100
100
  active: boolean;
101
- borrowerId: mongoose.Types.ObjectId;
101
+ name: string;
102
102
  code: string;
103
- frequency: string;
104
- productId: mongoose.Types.ObjectId;
105
103
  PLCode: string;
104
+ productId: mongoose.Types.ObjectId;
106
105
  percent: number;
107
106
  minimumAmount: number;
107
+ frequency: string;
108
108
  applyFrom: Date;
109
109
  calculationBasis: string;
110
110
  chargeType: string;
111
111
  includeInYield: boolean;
112
- __v?: number;
113
112
  deletedAt?: Date;
114
113
  paymentOrder?: number;
114
+ __v?: number;
115
115
  }>> & mongoose.FlatRecord<{
116
116
  createdAt: NativeDate;
117
117
  updatedAt: NativeDate;
118
118
  } & {
119
- name: string;
119
+ borrowerId: mongoose.Types.ObjectId;
120
120
  order: number;
121
121
  active: boolean;
122
- borrowerId: mongoose.Types.ObjectId;
122
+ name: string;
123
123
  code: string;
124
- frequency: string;
125
- productId: mongoose.Types.ObjectId;
126
124
  PLCode: string;
125
+ productId: mongoose.Types.ObjectId;
127
126
  percent: number;
128
127
  minimumAmount: number;
128
+ frequency: string;
129
129
  applyFrom: Date;
130
130
  calculationBasis: string;
131
131
  chargeType: string;
132
132
  includeInYield: boolean;
133
- __v?: number;
134
133
  deletedAt?: Date;
135
134
  paymentOrder?: number;
135
+ __v?: number;
136
136
  }> & {
137
137
  _id: mongoose.Types.ObjectId;
138
138
  }>;
@@ -11,7 +11,7 @@ const loan_charge_type_enum_1 = require("../enums/loan-charge-type.enum");
11
11
  const _models_1 = require("./_models");
12
12
  exports.chargeViewValidationSchema = joi_1.default.object({
13
13
  valid: joi_1.default.boolean(),
14
- _id: joi_1.default.string(),
14
+ _id: joi_1.default.string().allow(null),
15
15
  active: joi_1.default.boolean(),
16
16
  name: joi_1.default.string().required(),
17
17
  code: joi_1.default.string().required(),
@@ -7,7 +7,7 @@ import { MODEL_NAMES } from './_models';
7
7
 
8
8
  export const chargeViewValidationSchema = Joi.object<ILoanChargeView & { valid: boolean }>({
9
9
  valid: Joi.boolean(),
10
- _id: Joi.string(),
10
+ _id: Joi.string().allow(null),
11
11
  active: Joi.boolean(),
12
12
  name: Joi.string().required(),
13
13
  code: Joi.string().required(),
@@ -47,7 +47,7 @@ export interface ILoanProduct {
47
47
  settlementCode: string;
48
48
  isDefaultPaymentOrder: boolean;
49
49
  calculationRequired: boolean;
50
- deactivationDate?: Date;
50
+ deactivationDate?: Date | null;
51
51
  }
52
52
  export interface ILoanProductDoc extends ILoanProduct, mongoose.Document {
53
53
  _id: mongoose.Types.ObjectId;
@@ -81,12 +81,12 @@ export declare const LoanProductSchema: mongoose.Schema<any, mongoose.Model<any,
81
81
  createdAt: NativeDate;
82
82
  updatedAt: NativeDate;
83
83
  } & {
84
- type: string;
85
- name: string;
84
+ borrowerId: mongoose.Types.ObjectId;
86
85
  order: number;
87
86
  active: boolean;
88
- borrowerId: mongoose.Types.ObjectId;
89
87
  code: string;
88
+ name: string;
89
+ type: string;
90
90
  startDate: Date;
91
91
  maturityDate: Date;
92
92
  commitment: number;
@@ -94,25 +94,25 @@ export declare const LoanProductSchema: mongoose.Schema<any, mongoose.Model<any,
94
94
  isFloatedBalanceActual: boolean;
95
95
  isParticipant: boolean;
96
96
  isDefaultPaymentOrder: boolean;
97
- __v?: number;
98
- settlementCode?: string;
99
97
  masterCode?: string;
100
98
  payoffDate?: Date;
101
99
  minPercent?: number;
102
100
  maxPercent?: number;
103
101
  prepaymentDate?: Date;
104
102
  prepaymentTerms?: string;
103
+ settlementCode?: string;
105
104
  deactivationDate?: Date;
105
+ __v?: number;
106
106
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
107
107
  createdAt: NativeDate;
108
108
  updatedAt: NativeDate;
109
109
  } & {
110
- type: string;
111
- name: string;
110
+ borrowerId: mongoose.Types.ObjectId;
112
111
  order: number;
113
112
  active: boolean;
114
- borrowerId: mongoose.Types.ObjectId;
115
113
  code: string;
114
+ name: string;
115
+ type: string;
116
116
  startDate: Date;
117
117
  maturityDate: Date;
118
118
  commitment: number;
@@ -120,25 +120,25 @@ export declare const LoanProductSchema: mongoose.Schema<any, mongoose.Model<any,
120
120
  isFloatedBalanceActual: boolean;
121
121
  isParticipant: boolean;
122
122
  isDefaultPaymentOrder: boolean;
123
- __v?: number;
124
- settlementCode?: string;
125
123
  masterCode?: string;
126
124
  payoffDate?: Date;
127
125
  minPercent?: number;
128
126
  maxPercent?: number;
129
127
  prepaymentDate?: Date;
130
128
  prepaymentTerms?: string;
129
+ settlementCode?: string;
131
130
  deactivationDate?: Date;
131
+ __v?: number;
132
132
  }>> & mongoose.FlatRecord<{
133
133
  createdAt: NativeDate;
134
134
  updatedAt: NativeDate;
135
135
  } & {
136
- type: string;
137
- name: string;
136
+ borrowerId: mongoose.Types.ObjectId;
138
137
  order: number;
139
138
  active: boolean;
140
- borrowerId: mongoose.Types.ObjectId;
141
139
  code: string;
140
+ name: string;
141
+ type: string;
142
142
  startDate: Date;
143
143
  maturityDate: Date;
144
144
  commitment: number;
@@ -146,15 +146,15 @@ export declare const LoanProductSchema: mongoose.Schema<any, mongoose.Model<any,
146
146
  isFloatedBalanceActual: boolean;
147
147
  isParticipant: boolean;
148
148
  isDefaultPaymentOrder: boolean;
149
- __v?: number;
150
- settlementCode?: string;
151
149
  masterCode?: string;
152
150
  payoffDate?: Date;
153
151
  minPercent?: number;
154
152
  maxPercent?: number;
155
153
  prepaymentDate?: Date;
156
154
  prepaymentTerms?: string;
155
+ settlementCode?: string;
157
156
  deactivationDate?: Date;
157
+ __v?: number;
158
158
  }> & {
159
159
  _id: mongoose.Types.ObjectId;
160
160
  }>;
@@ -26,7 +26,7 @@ export interface ILoanProduct {
26
26
  settlementCode: string;
27
27
  isDefaultPaymentOrder: boolean;
28
28
  calculationRequired: boolean;
29
- deactivationDate?: Date;
29
+ deactivationDate?: Date | null;
30
30
  }
31
31
 
32
32
  export interface ILoanProductDoc extends ILoanProduct, mongoose.Document {
@@ -71,8 +71,8 @@ export declare const LoanStatementSchema: mongoose.Schema<any, mongoose.Model<an
71
71
  createdAt: NativeDate;
72
72
  updatedAt: NativeDate;
73
73
  } & {
74
- date: Date;
75
74
  order: number;
75
+ date: Date;
76
76
  amount: number;
77
77
  chargeId: mongoose.Types.ObjectId;
78
78
  isSystem: boolean;
@@ -86,8 +86,8 @@ export declare const LoanStatementSchema: mongoose.Schema<any, mongoose.Model<an
86
86
  createdAt: NativeDate;
87
87
  updatedAt: NativeDate;
88
88
  } & {
89
- date: Date;
90
89
  order: number;
90
+ date: Date;
91
91
  amount: number;
92
92
  chargeId: mongoose.Types.ObjectId;
93
93
  isSystem: boolean;
@@ -101,8 +101,8 @@ export declare const LoanStatementSchema: mongoose.Schema<any, mongoose.Model<an
101
101
  createdAt: NativeDate;
102
102
  updatedAt: NativeDate;
103
103
  } & {
104
- date: Date;
105
104
  order: number;
105
+ date: Date;
106
106
  amount: number;
107
107
  chargeId: mongoose.Types.ObjectId;
108
108
  isSystem: boolean;
@@ -32,9 +32,9 @@ export declare const allSchemas: {
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
34
  order: number;
35
- amount: number;
36
35
  bbcSheetId: import("mongoose").Types.ObjectId;
37
36
  apDate: Date;
37
+ amount: number;
38
38
  __v?: number;
39
39
  poNumber?: string;
40
40
  customerName?: string;
@@ -46,9 +46,9 @@ export declare const allSchemas: {
46
46
  updatedAt: NativeDate;
47
47
  } & {
48
48
  order: number;
49
- amount: number;
50
49
  bbcSheetId: import("mongoose").Types.ObjectId;
51
50
  apDate: Date;
51
+ amount: number;
52
52
  __v?: number;
53
53
  poNumber?: string;
54
54
  customerName?: string;
@@ -60,9 +60,9 @@ export declare const allSchemas: {
60
60
  updatedAt: NativeDate;
61
61
  } & {
62
62
  order: number;
63
- amount: number;
64
63
  bbcSheetId: import("mongoose").Types.ObjectId;
65
64
  apDate: Date;
65
+ amount: number;
66
66
  __v?: number;
67
67
  poNumber?: string;
68
68
  customerName?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
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;
89
87
  LAST_MONTH?: boolean;
90
88
  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<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
49
+ getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
50
50
  _id: import("mongoose").Types.ObjectId;
51
- }>)[]>;
51
+ }>)[] | BrokerView[]>;
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[]>;
@@ -195,7 +195,9 @@ class LoanChargesService {
195
195
  }
196
196
  validateLoanCharge(loanCharge) {
197
197
  const validationResult = LoanCharges_model_1.chargeViewValidationSchema.validate(loanCharge);
198
- console.log({ validationResult });
198
+ if (validationResult.error) {
199
+ console.error('Validation error for loan charge:', validationResult.error.details);
200
+ }
199
201
  return !!validationResult.error;
200
202
  }
201
203
  async saveLoanCharges(borrowerId, loanCharges, quickCreate = false) {
@@ -227,7 +227,9 @@ export class LoanChargesService {
227
227
 
228
228
  validateLoanCharge(loanCharge: ILoanChargeView) {
229
229
  const validationResult = chargeViewValidationSchema.validate(loanCharge);
230
- console.log({ validationResult })
230
+ if (validationResult.error) {
231
+ console.error('Validation error for loan charge:', validationResult.error.details);
232
+ }
231
233
  return !!validationResult.error;
232
234
  }
233
235