gemcap-be-common 1.1.102 → 1.2.2
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/db/index.d.ts +4 -1
- package/db/index.js +4 -1
- package/db/index.ts +4 -1
- package/db/inventory-availability.db.d.ts +1 -2
- package/db/inventory-availability.db.js +2 -3
- package/db/inventory-availability.db.ts +7 -2
- package/db/inventory-seasonal-rates.db.d.ts +1 -1
- package/db/inventory-seasonal-rates.db.js +5 -5
- package/db/inventory-seasonal-rates.db.ts +1 -1
- package/db/loan-products.db.d.ts +33 -0
- package/db/loan-products.db.js +139 -0
- package/db/loan-products.db.ts +146 -0
- package/db/loan-statement.db.d.ts +2 -0
- package/db/loan-statement.db.js +59 -0
- package/db/loan-statement.db.ts +53 -0
- package/db/microservice-tasks.db.d.ts +1 -1
- package/db/microservice-tasks.db.ts +1 -2
- package/db/{receivables.ts → receivables.db.ts} +2 -1
- package/db/user-logs.db.d.ts +36 -0
- package/db/user-logs.db.js +41 -0
- package/db/user-logs.db.ts +48 -0
- package/enums/index.d.ts +2 -1
- package/enums/index.js +2 -1
- package/enums/index.ts +2 -1
- package/interfaces/collaterals.interface.d.ts +1 -3
- package/interfaces/collaterals.interface.ts +3 -5
- package/interfaces/index.d.ts +1 -0
- package/interfaces/index.js +1 -0
- package/interfaces/index.ts +1 -0
- package/models/AvailabilitySigns.model.ts +1 -0
- package/models/Banks.model.d.ts +45 -0
- package/models/Banks.model.js +39 -0
- package/models/Banks.model.ts +55 -0
- package/models/DeletedRecords.model.d.ts +35 -0
- package/models/DeletedRecords.model.js +21 -0
- package/models/DeletedRecords.model.ts +28 -0
- package/models/InventoryManualEntry.model.d.ts +2 -0
- package/models/InventorySeasonalRates.model.d.ts +3 -0
- package/models/LoanCharges.model.d.ts +58 -0
- package/models/LoanCharges.model.js +207 -0
- package/models/LoanCharges.model.ts +238 -0
- package/models/LoanProducts.model.d.ts +60 -0
- package/models/LoanProducts.model.js +93 -0
- package/models/LoanProducts.model.ts +130 -0
- package/models/LoanStatementTransaction.model.d.ts +50 -0
- package/models/LoanStatementTransaction.model.js +64 -0
- package/models/LoanStatementTransaction.model.ts +94 -0
- package/models/LoanTransaction.model.d.ts +76 -0
- package/models/LoanTransaction.model.js +160 -0
- package/models/LoanTransaction.model.ts +218 -0
- package/models/MicroserviceTask.model.d.ts +1 -2
- package/models/MicroserviceTask.model.ts +1 -2
- package/models/PostponedTransactions.model.d.ts +39 -0
- package/models/PostponedTransactions.model.js +28 -0
- package/models/PostponedTransactions.model.ts +42 -0
- package/models/UserLog.model.d.ts +55 -0
- package/models/UserLog.model.js +55 -0
- package/models/UserLog.model.ts +72 -0
- package/models/Yield.model.d.ts +46 -0
- package/models/Yield.model.js +48 -0
- package/models/Yield.model.ts +76 -0
- package/models/_models.d.ts +1 -0
- package/models/_models.js +1 -0
- package/models/_models.ts +1 -0
- package/models/index.d.ts +9 -0
- package/models/index.js +9 -0
- package/models/index.ts +9 -0
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/db/{receivables.d.ts → receivables.db.d.ts} +0 -0
- package/db/{receivables.js → receivables.db.js} +1 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoanCharge = exports.defaultChargeList = exports.chargeViewValidationSchema = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const enums_1 = require("../enums");
|
|
10
|
+
const _models_1 = require("./_models");
|
|
11
|
+
exports.chargeViewValidationSchema = joi_1.default.object({
|
|
12
|
+
valid: joi_1.default.boolean(),
|
|
13
|
+
_id: joi_1.default.string(),
|
|
14
|
+
active: joi_1.default.boolean(),
|
|
15
|
+
name: joi_1.default.string().required(),
|
|
16
|
+
code: joi_1.default.string().required(),
|
|
17
|
+
PLCode: joi_1.default.string().required(),
|
|
18
|
+
productId: joi_1.default.string().required(),
|
|
19
|
+
percent: joi_1.default.number().required().min(0),
|
|
20
|
+
minimumAmount: joi_1.default.number().required().min(0),
|
|
21
|
+
frequency: joi_1.default.string().required().valid(...Object.keys(enums_1.EChargeFrequencies)),
|
|
22
|
+
applyFrom: joi_1.default.date().required(),
|
|
23
|
+
calculationBasis: joi_1.default.string().required().valid(...Object.keys(enums_1.EChargeCalculationBasis)),
|
|
24
|
+
chargeType: joi_1.default.string().required().valid(...Object.keys(enums_1.ELoanChargeType)),
|
|
25
|
+
includeInYield: joi_1.default.boolean().required(),
|
|
26
|
+
});
|
|
27
|
+
exports.defaultChargeList = [
|
|
28
|
+
{
|
|
29
|
+
_id: null,
|
|
30
|
+
active: true,
|
|
31
|
+
name: 'Interest',
|
|
32
|
+
code: enums_1.ELoanChargeType.INTEREST_FEE,
|
|
33
|
+
PLCode: '',
|
|
34
|
+
chargeType: enums_1.ELoanChargeType.INTEREST_FEE,
|
|
35
|
+
productId: null,
|
|
36
|
+
percent: 0,
|
|
37
|
+
minimumAmount: 0,
|
|
38
|
+
frequency: enums_1.EChargeFrequencies.DAILY,
|
|
39
|
+
applyFrom: null,
|
|
40
|
+
calculationBasis: enums_1.EChargeCalculationBasis.DAILY_BALANCE,
|
|
41
|
+
includeInYield: false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
_id: null,
|
|
45
|
+
active: true,
|
|
46
|
+
name: 'Admin Fees',
|
|
47
|
+
code: enums_1.ELoanChargeType.ADMIN_FEE,
|
|
48
|
+
PLCode: '',
|
|
49
|
+
chargeType: enums_1.ELoanChargeType.ADMIN_FEE,
|
|
50
|
+
productId: null,
|
|
51
|
+
percent: 0,
|
|
52
|
+
minimumAmount: 0,
|
|
53
|
+
frequency: enums_1.EChargeFrequencies.MONTHLY,
|
|
54
|
+
applyFrom: null,
|
|
55
|
+
calculationBasis: enums_1.EChargeCalculationBasis.AVERAGE_MONTHLY_BALANCE,
|
|
56
|
+
includeInYield: false,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
_id: null,
|
|
60
|
+
active: true,
|
|
61
|
+
name: 'Unused Line Fee',
|
|
62
|
+
code: enums_1.ELoanChargeType.UNUSED_LINE_FEE,
|
|
63
|
+
PLCode: '',
|
|
64
|
+
chargeType: enums_1.ELoanChargeType.UNUSED_LINE_FEE,
|
|
65
|
+
productId: null,
|
|
66
|
+
percent: 0,
|
|
67
|
+
minimumAmount: 0,
|
|
68
|
+
frequency: enums_1.EChargeFrequencies.DAILY,
|
|
69
|
+
applyFrom: null,
|
|
70
|
+
calculationBasis: enums_1.EChargeCalculationBasis.UNUSED_AMOUNT,
|
|
71
|
+
includeInYield: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
_id: null,
|
|
75
|
+
active: true,
|
|
76
|
+
name: 'Annual Line Fee',
|
|
77
|
+
code: enums_1.ELoanChargeType.ANNUAL_LINE_FEE,
|
|
78
|
+
PLCode: '',
|
|
79
|
+
chargeType: enums_1.ELoanChargeType.ANNUAL_LINE_FEE,
|
|
80
|
+
productId: null,
|
|
81
|
+
percent: 0,
|
|
82
|
+
minimumAmount: 0,
|
|
83
|
+
frequency: enums_1.EChargeFrequencies.ANNUAL,
|
|
84
|
+
applyFrom: null,
|
|
85
|
+
calculationBasis: enums_1.EChargeCalculationBasis.COMMITMENT,
|
|
86
|
+
includeInYield: false,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
_id: null,
|
|
90
|
+
active: true,
|
|
91
|
+
name: 'Wire Fee',
|
|
92
|
+
code: enums_1.ELoanChargeType.WIRE_FEE,
|
|
93
|
+
PLCode: '',
|
|
94
|
+
chargeType: enums_1.ELoanChargeType.WIRE_FEE,
|
|
95
|
+
productId: null,
|
|
96
|
+
percent: 0,
|
|
97
|
+
minimumAmount: 0,
|
|
98
|
+
frequency: enums_1.EChargeFrequencies.DISBURSEMENT,
|
|
99
|
+
applyFrom: null,
|
|
100
|
+
calculationBasis: enums_1.EChargeCalculationBasis.DISBURSEMENT_AMOUNT,
|
|
101
|
+
includeInYield: false,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
_id: null,
|
|
105
|
+
active: true,
|
|
106
|
+
name: 'Forbearance',
|
|
107
|
+
code: enums_1.ELoanChargeType.OTHER,
|
|
108
|
+
PLCode: '',
|
|
109
|
+
chargeType: enums_1.ELoanChargeType.OTHER,
|
|
110
|
+
productId: null,
|
|
111
|
+
percent: 0,
|
|
112
|
+
minimumAmount: 0,
|
|
113
|
+
frequency: enums_1.EChargeFrequencies.ONE_TIME,
|
|
114
|
+
applyFrom: null,
|
|
115
|
+
calculationBasis: enums_1.EChargeCalculationBasis.FIXED,
|
|
116
|
+
includeInYield: false,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
_id: null,
|
|
120
|
+
active: true,
|
|
121
|
+
name: 'Overline/Over-advance',
|
|
122
|
+
code: enums_1.ELoanChargeType.OTHER,
|
|
123
|
+
PLCode: '',
|
|
124
|
+
chargeType: enums_1.ELoanChargeType.OTHER,
|
|
125
|
+
productId: null,
|
|
126
|
+
percent: 0,
|
|
127
|
+
minimumAmount: 0,
|
|
128
|
+
frequency: enums_1.EChargeFrequencies.ONE_TIME,
|
|
129
|
+
applyFrom: null,
|
|
130
|
+
calculationBasis: enums_1.EChargeCalculationBasis.FIXED,
|
|
131
|
+
includeInYield: false,
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
const LoanChargeSchema = new mongoose_1.default.Schema({
|
|
135
|
+
borrowerId: {
|
|
136
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
137
|
+
ref: _models_1.MODEL_NAMES.borrowers,
|
|
138
|
+
required: true,
|
|
139
|
+
},
|
|
140
|
+
order: {
|
|
141
|
+
type: Number,
|
|
142
|
+
required: true,
|
|
143
|
+
},
|
|
144
|
+
active: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
required: true,
|
|
147
|
+
},
|
|
148
|
+
name: {
|
|
149
|
+
type: String,
|
|
150
|
+
required: true,
|
|
151
|
+
trim: true,
|
|
152
|
+
},
|
|
153
|
+
code: {
|
|
154
|
+
type: String,
|
|
155
|
+
required: true,
|
|
156
|
+
trim: true,
|
|
157
|
+
},
|
|
158
|
+
PLCode: {
|
|
159
|
+
type: String,
|
|
160
|
+
required: true,
|
|
161
|
+
trim: true,
|
|
162
|
+
},
|
|
163
|
+
productId: {
|
|
164
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
165
|
+
ref: _models_1.MODEL_NAMES.loanProducts,
|
|
166
|
+
required: true,
|
|
167
|
+
},
|
|
168
|
+
percent: {
|
|
169
|
+
type: Number,
|
|
170
|
+
required: true,
|
|
171
|
+
},
|
|
172
|
+
minimumAmount: {
|
|
173
|
+
type: Number,
|
|
174
|
+
required: true,
|
|
175
|
+
},
|
|
176
|
+
frequency: {
|
|
177
|
+
type: String,
|
|
178
|
+
required: true,
|
|
179
|
+
trim: true,
|
|
180
|
+
},
|
|
181
|
+
applyFrom: {
|
|
182
|
+
type: Date,
|
|
183
|
+
required: true,
|
|
184
|
+
},
|
|
185
|
+
calculationBasis: {
|
|
186
|
+
type: String,
|
|
187
|
+
required: true,
|
|
188
|
+
trim: true,
|
|
189
|
+
},
|
|
190
|
+
chargeType: {
|
|
191
|
+
type: String,
|
|
192
|
+
required: true,
|
|
193
|
+
trim: true,
|
|
194
|
+
},
|
|
195
|
+
includeInYield: {
|
|
196
|
+
type: Boolean,
|
|
197
|
+
required: true,
|
|
198
|
+
},
|
|
199
|
+
deletedAt: {
|
|
200
|
+
type: Date,
|
|
201
|
+
},
|
|
202
|
+
paymentOrder: {
|
|
203
|
+
type: Number,
|
|
204
|
+
},
|
|
205
|
+
__v: { type: Number, select: false },
|
|
206
|
+
}, { timestamps: true });
|
|
207
|
+
exports.LoanCharge = mongoose_1.default.model(_models_1.MODEL_NAMES.loanCharges, LoanChargeSchema);
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import mongoose, { Document } from 'mongoose';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
|
|
4
|
+
import { EChargeCalculationBasis, EChargeFrequencies, ELoanChargeType } from '../enums';
|
|
5
|
+
import { MODEL_NAMES } from './_models';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const chargeViewValidationSchema = Joi.object<ILoanChargeView & { valid: boolean }>({
|
|
9
|
+
valid: Joi.boolean(),
|
|
10
|
+
_id: Joi.string(),
|
|
11
|
+
active: Joi.boolean(),
|
|
12
|
+
name: Joi.string().required(),
|
|
13
|
+
code: Joi.string().required(),
|
|
14
|
+
PLCode: Joi.string().required(),
|
|
15
|
+
productId: Joi.string().required(),
|
|
16
|
+
percent: Joi.number().required().min(0),
|
|
17
|
+
minimumAmount: Joi.number().required().min(0),
|
|
18
|
+
frequency: Joi.string().required().valid(...Object.keys(EChargeFrequencies)),
|
|
19
|
+
applyFrom: Joi.date().required(),
|
|
20
|
+
calculationBasis: Joi.string().required().valid(...Object.keys(EChargeCalculationBasis)),
|
|
21
|
+
chargeType: Joi.string().required().valid(...Object.keys(ELoanChargeType)),
|
|
22
|
+
includeInYield: Joi.boolean().required(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export interface ILoanCharge {
|
|
26
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
27
|
+
order: number;
|
|
28
|
+
active: boolean;
|
|
29
|
+
name: string;
|
|
30
|
+
code: string;
|
|
31
|
+
PLCode: string,
|
|
32
|
+
productId: mongoose.Types.ObjectId;
|
|
33
|
+
percent: number;
|
|
34
|
+
minimumAmount: number;
|
|
35
|
+
frequency: EChargeFrequencies;
|
|
36
|
+
applyFrom: Date;
|
|
37
|
+
calculationBasis: EChargeCalculationBasis;
|
|
38
|
+
chargeType: ELoanChargeType;
|
|
39
|
+
deletedAt?: Date;
|
|
40
|
+
paymentOrder?: number;
|
|
41
|
+
includeInYield: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ILoanChargeWithId extends ILoanCharge {
|
|
45
|
+
_id: mongoose.Types.ObjectId;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ILoanChargeView = Omit<ILoanChargeWithId, 'borrowerId' | 'order'>
|
|
49
|
+
|
|
50
|
+
export interface ILoanChargeDoc extends ILoanCharge, Document {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const defaultChargeList: ILoanChargeView[] = [
|
|
54
|
+
{
|
|
55
|
+
_id: null,
|
|
56
|
+
active: true,
|
|
57
|
+
name: 'Interest',
|
|
58
|
+
code: ELoanChargeType.INTEREST_FEE,
|
|
59
|
+
PLCode: '',
|
|
60
|
+
chargeType: ELoanChargeType.INTEREST_FEE,
|
|
61
|
+
productId: null,
|
|
62
|
+
percent: 0,
|
|
63
|
+
minimumAmount: 0,
|
|
64
|
+
frequency: EChargeFrequencies.DAILY,
|
|
65
|
+
applyFrom: null,
|
|
66
|
+
calculationBasis: EChargeCalculationBasis.DAILY_BALANCE,
|
|
67
|
+
includeInYield: false,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
_id: null,
|
|
71
|
+
active: true,
|
|
72
|
+
name: 'Admin Fees',
|
|
73
|
+
code: ELoanChargeType.ADMIN_FEE,
|
|
74
|
+
PLCode: '',
|
|
75
|
+
chargeType: ELoanChargeType.ADMIN_FEE,
|
|
76
|
+
productId: null,
|
|
77
|
+
percent: 0,
|
|
78
|
+
minimumAmount: 0,
|
|
79
|
+
frequency: EChargeFrequencies.MONTHLY,
|
|
80
|
+
applyFrom: null,
|
|
81
|
+
calculationBasis: EChargeCalculationBasis.AVERAGE_MONTHLY_BALANCE,
|
|
82
|
+
includeInYield: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
_id: null,
|
|
86
|
+
active: true,
|
|
87
|
+
name: 'Unused Line Fee',
|
|
88
|
+
code: ELoanChargeType.UNUSED_LINE_FEE,
|
|
89
|
+
PLCode: '',
|
|
90
|
+
chargeType: ELoanChargeType.UNUSED_LINE_FEE,
|
|
91
|
+
productId: null,
|
|
92
|
+
percent: 0,
|
|
93
|
+
minimumAmount: 0,
|
|
94
|
+
frequency: EChargeFrequencies.DAILY,
|
|
95
|
+
applyFrom: null,
|
|
96
|
+
calculationBasis: EChargeCalculationBasis.UNUSED_AMOUNT,
|
|
97
|
+
includeInYield: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
_id: null,
|
|
101
|
+
active: true,
|
|
102
|
+
name: 'Annual Line Fee',
|
|
103
|
+
code: ELoanChargeType.ANNUAL_LINE_FEE,
|
|
104
|
+
PLCode: '',
|
|
105
|
+
chargeType: ELoanChargeType.ANNUAL_LINE_FEE,
|
|
106
|
+
productId: null,
|
|
107
|
+
percent: 0,
|
|
108
|
+
minimumAmount: 0,
|
|
109
|
+
frequency: EChargeFrequencies.ANNUAL,
|
|
110
|
+
applyFrom: null,
|
|
111
|
+
calculationBasis: EChargeCalculationBasis.COMMITMENT,
|
|
112
|
+
includeInYield: false,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
_id: null,
|
|
116
|
+
active: true,
|
|
117
|
+
name: 'Wire Fee',
|
|
118
|
+
code: ELoanChargeType.WIRE_FEE,
|
|
119
|
+
PLCode: '',
|
|
120
|
+
chargeType: ELoanChargeType.WIRE_FEE,
|
|
121
|
+
productId: null,
|
|
122
|
+
percent: 0,
|
|
123
|
+
minimumAmount: 0,
|
|
124
|
+
frequency: EChargeFrequencies.DISBURSEMENT,
|
|
125
|
+
applyFrom: null,
|
|
126
|
+
calculationBasis: EChargeCalculationBasis.DISBURSEMENT_AMOUNT,
|
|
127
|
+
includeInYield: false,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
_id: null,
|
|
131
|
+
active: true,
|
|
132
|
+
name: 'Forbearance',
|
|
133
|
+
code: ELoanChargeType.OTHER,
|
|
134
|
+
PLCode: '',
|
|
135
|
+
chargeType: ELoanChargeType.OTHER,
|
|
136
|
+
productId: null,
|
|
137
|
+
percent: 0,
|
|
138
|
+
minimumAmount: 0,
|
|
139
|
+
frequency: EChargeFrequencies.ONE_TIME,
|
|
140
|
+
applyFrom: null,
|
|
141
|
+
calculationBasis: EChargeCalculationBasis.FIXED,
|
|
142
|
+
includeInYield: false,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
_id: null,
|
|
146
|
+
active: true,
|
|
147
|
+
name: 'Overline/Over-advance',
|
|
148
|
+
code: ELoanChargeType.OTHER,
|
|
149
|
+
PLCode: '',
|
|
150
|
+
chargeType: ELoanChargeType.OTHER,
|
|
151
|
+
productId: null,
|
|
152
|
+
percent: 0,
|
|
153
|
+
minimumAmount: 0,
|
|
154
|
+
frequency: EChargeFrequencies.ONE_TIME,
|
|
155
|
+
applyFrom: null,
|
|
156
|
+
calculationBasis: EChargeCalculationBasis.FIXED,
|
|
157
|
+
includeInYield: false,
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
const LoanChargeSchema = new mongoose.Schema(
|
|
162
|
+
{
|
|
163
|
+
borrowerId: {
|
|
164
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
165
|
+
ref: MODEL_NAMES.borrowers,
|
|
166
|
+
required: true,
|
|
167
|
+
},
|
|
168
|
+
order: {
|
|
169
|
+
type: Number,
|
|
170
|
+
required: true,
|
|
171
|
+
},
|
|
172
|
+
active: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
required: true,
|
|
175
|
+
},
|
|
176
|
+
name: {
|
|
177
|
+
type: String,
|
|
178
|
+
required: true,
|
|
179
|
+
trim: true,
|
|
180
|
+
},
|
|
181
|
+
code: {
|
|
182
|
+
type: String,
|
|
183
|
+
required: true,
|
|
184
|
+
trim: true,
|
|
185
|
+
},
|
|
186
|
+
PLCode: {
|
|
187
|
+
type: String,
|
|
188
|
+
required: true,
|
|
189
|
+
trim: true,
|
|
190
|
+
},
|
|
191
|
+
productId: {
|
|
192
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
193
|
+
ref: MODEL_NAMES.loanProducts,
|
|
194
|
+
required: true,
|
|
195
|
+
},
|
|
196
|
+
percent: {
|
|
197
|
+
type: Number,
|
|
198
|
+
required: true,
|
|
199
|
+
},
|
|
200
|
+
minimumAmount: {
|
|
201
|
+
type: Number,
|
|
202
|
+
required: true,
|
|
203
|
+
},
|
|
204
|
+
frequency: {
|
|
205
|
+
type: String,
|
|
206
|
+
required: true,
|
|
207
|
+
trim: true,
|
|
208
|
+
},
|
|
209
|
+
applyFrom: {
|
|
210
|
+
type: Date,
|
|
211
|
+
required: true,
|
|
212
|
+
},
|
|
213
|
+
calculationBasis: {
|
|
214
|
+
type: String,
|
|
215
|
+
required: true,
|
|
216
|
+
trim: true,
|
|
217
|
+
},
|
|
218
|
+
chargeType: {
|
|
219
|
+
type: String,
|
|
220
|
+
required: true,
|
|
221
|
+
trim: true,
|
|
222
|
+
},
|
|
223
|
+
includeInYield: {
|
|
224
|
+
type: Boolean,
|
|
225
|
+
required: true,
|
|
226
|
+
},
|
|
227
|
+
deletedAt: {
|
|
228
|
+
type: Date,
|
|
229
|
+
},
|
|
230
|
+
paymentOrder: {
|
|
231
|
+
type: Number,
|
|
232
|
+
},
|
|
233
|
+
__v: { type: Number, select: false },
|
|
234
|
+
},
|
|
235
|
+
{ timestamps: true },
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
export const LoanCharge = mongoose.model<ILoanChargeDoc>(MODEL_NAMES.loanCharges, LoanChargeSchema);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import mongoose, { Document } from 'mongoose';
|
|
26
|
+
import { ELoanTypes } from '../enums';
|
|
27
|
+
export interface ILoanProduct {
|
|
28
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
29
|
+
order: number;
|
|
30
|
+
active: boolean;
|
|
31
|
+
code: string;
|
|
32
|
+
masterCode: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: ELoanTypes;
|
|
35
|
+
startDate: Date;
|
|
36
|
+
maturityDate: Date;
|
|
37
|
+
commitment: number;
|
|
38
|
+
isBalanceActual: boolean;
|
|
39
|
+
isFloatedBalanceActual: boolean;
|
|
40
|
+
isParticipant: boolean;
|
|
41
|
+
minPercent: number;
|
|
42
|
+
maxPercent: number;
|
|
43
|
+
prepaymentDate?: Date;
|
|
44
|
+
prepaymentTerms?: string;
|
|
45
|
+
settlementCode: string;
|
|
46
|
+
isDefaultPaymentOrder: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface ILoanProductWithId extends ILoanProduct {
|
|
49
|
+
_id: mongoose.Types.ObjectId;
|
|
50
|
+
}
|
|
51
|
+
export type ILoanProductView = Omit<ILoanProductWithId, 'borrowerId' | 'order'>;
|
|
52
|
+
export interface ILoanProductViewWithBalances extends ILoanProductView {
|
|
53
|
+
balance: number;
|
|
54
|
+
floatedBalance: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ILoanProductDoc extends ILoanProduct, Document {
|
|
57
|
+
}
|
|
58
|
+
export declare const LoanProduct: mongoose.Model<ILoanProductDoc, {}, {}, {}, mongoose.Document<unknown, {}, ILoanProductDoc> & ILoanProductDoc & {
|
|
59
|
+
_id: mongoose.Types.ObjectId;
|
|
60
|
+
}, any>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoanProduct = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const _models_1 = require("./_models");
|
|
9
|
+
const LoanProductSchema = new mongoose_1.default.Schema({
|
|
10
|
+
borrowerId: {
|
|
11
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
12
|
+
ref: 'borrowers',
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
order: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
active: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
code: {
|
|
24
|
+
type: String,
|
|
25
|
+
trim: true,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
masterCode: {
|
|
29
|
+
type: String,
|
|
30
|
+
trim: true,
|
|
31
|
+
},
|
|
32
|
+
name: {
|
|
33
|
+
type: String,
|
|
34
|
+
trim: true,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
type: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
trim: true,
|
|
41
|
+
},
|
|
42
|
+
startDate: {
|
|
43
|
+
type: Date,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
maturityDate: {
|
|
47
|
+
type: Date,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
commitment: {
|
|
51
|
+
type: Number,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
isBalanceActual: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
required: true,
|
|
57
|
+
default: true,
|
|
58
|
+
},
|
|
59
|
+
isFloatedBalanceActual: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
required: true,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
isParticipant: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
minPercent: {
|
|
69
|
+
type: Number,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
maxPercent: {
|
|
73
|
+
type: Number,
|
|
74
|
+
required: false,
|
|
75
|
+
},
|
|
76
|
+
prepaymentDate: {
|
|
77
|
+
type: Date,
|
|
78
|
+
},
|
|
79
|
+
prepaymentTerms: {
|
|
80
|
+
type: String,
|
|
81
|
+
trim: true,
|
|
82
|
+
},
|
|
83
|
+
settlementCode: {
|
|
84
|
+
type: String,
|
|
85
|
+
trim: true,
|
|
86
|
+
},
|
|
87
|
+
isDefaultPaymentOrder: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
required: true,
|
|
90
|
+
},
|
|
91
|
+
__v: { type: Number, select: false },
|
|
92
|
+
}, { timestamps: true });
|
|
93
|
+
exports.LoanProduct = mongoose_1.default.model(_models_1.MODEL_NAMES.loanProducts, LoanProductSchema);
|