gemcap-be-common 1.5.2 → 1.5.4

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(),
@@ -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.2",
3
+ "version": "1.5.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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.debug({ 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.debug({ 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
 
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
155
155
  getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
156
156
  transactionIdsToMark: string[];
157
157
  transactions: {
158
- [x: string]: (string | number | Date | string[])[];
158
+ [x: string]: (string | number | string[] | Date)[];
159
159
  }[];
160
160
  }>;
161
161
  getBorrowerIdsForFile(transactionFileId: string): Promise<{