gemcap-be-common 1.4.105 → 1.4.107
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/models/FinancialSpreadingIgnore.model.d.ts +50 -0
- package/models/FinancialSpreadingIgnore.model.js +23 -0
- package/models/FinancialSpreadingIgnore.model.ts +49 -0
- package/models/_index.d.ts +3 -3
- package/models/_models.d.ts +1 -0
- package/models/_models.js +1 -0
- package/models/_models.ts +1 -0
- package/package.json +1 -1
- package/services/loan-statement-status.service.js +0 -5
- package/services/loan-statement-status.service.ts +0 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
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, { Model } from 'mongoose';
|
|
26
|
+
export interface IFinancialSpreadingExclusion {
|
|
27
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
28
|
+
text: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IFinancialSpreadingExclusionDoc extends IFinancialSpreadingExclusion, Document {
|
|
31
|
+
_id: mongoose.Types.ObjectId;
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
updatedAt: Date;
|
|
34
|
+
}
|
|
35
|
+
export interface IFinancialSpreadingExclusionLean extends IFinancialSpreadingExclusion {
|
|
36
|
+
_id: mongoose.Types.ObjectId;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
}
|
|
40
|
+
export interface IFinancialSpreadingExclusionPlain extends Omit<IFinancialSpreadingExclusion, 'borrowerId'> {
|
|
41
|
+
_id: string;
|
|
42
|
+
borrowerId: string;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
}
|
|
46
|
+
export type IFinancialSpreadingExclusionModel = Model<IFinancialSpreadingExclusion>;
|
|
47
|
+
export declare const FinancialSpreadingExclusionSchema: mongoose.Schema<IFinancialSpreadingExclusion, IFinancialSpreadingExclusionModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IFinancialSpreadingExclusion, mongoose.Document<unknown, {}, mongoose.FlatRecord<IFinancialSpreadingExclusion>> & mongoose.FlatRecord<IFinancialSpreadingExclusion> & {
|
|
48
|
+
_id: mongoose.Types.ObjectId;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const FinancialSpreadingExclusion: IFinancialSpreadingExclusionModel;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.FinancialSpreadingExclusion = exports.FinancialSpreadingExclusionSchema = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const _models_1 = require("./_models");
|
|
9
|
+
exports.FinancialSpreadingExclusionSchema = new mongoose_1.default.Schema({
|
|
10
|
+
borrowerId: {
|
|
11
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
12
|
+
ref: _models_1.MODEL_NAMES.borrowers,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
text: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
trim: true,
|
|
19
|
+
},
|
|
20
|
+
}, {
|
|
21
|
+
timestamps: { createdAt: true, updatedAt: true },
|
|
22
|
+
});
|
|
23
|
+
exports.FinancialSpreadingExclusion = mongoose_1.default.model(_models_1.MODEL_NAMES.financialSpreadingExclusion, exports.FinancialSpreadingExclusionSchema);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import mongoose, { Model } from 'mongoose';
|
|
2
|
+
|
|
3
|
+
import { MODEL_NAMES } from './_models';
|
|
4
|
+
|
|
5
|
+
export interface IFinancialSpreadingExclusion {
|
|
6
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IFinancialSpreadingExclusionDoc extends IFinancialSpreadingExclusion, Document {
|
|
11
|
+
_id: mongoose.Types.ObjectId;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IFinancialSpreadingExclusionLean extends IFinancialSpreadingExclusion {
|
|
17
|
+
_id: mongoose.Types.ObjectId;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IFinancialSpreadingExclusionPlain extends Omit<IFinancialSpreadingExclusion, 'borrowerId'> {
|
|
23
|
+
_id: string;
|
|
24
|
+
borrowerId: string;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type IFinancialSpreadingExclusionModel = Model<IFinancialSpreadingExclusion>;
|
|
30
|
+
|
|
31
|
+
export const FinancialSpreadingExclusionSchema = new mongoose.Schema<IFinancialSpreadingExclusion, IFinancialSpreadingExclusionModel>(
|
|
32
|
+
{
|
|
33
|
+
borrowerId: {
|
|
34
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
35
|
+
ref: MODEL_NAMES.borrowers,
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
text: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
trim: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
timestamps: { createdAt: true, updatedAt: true },
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const FinancialSpreadingExclusion = mongoose.model<IFinancialSpreadingExclusion, IFinancialSpreadingExclusionModel>(MODEL_NAMES.financialSpreadingExclusion, FinancialSpreadingExclusionSchema);
|
package/models/_index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export declare const allSchemas: {
|
|
|
31
31
|
createdAt: NativeDate;
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
|
-
order: number;
|
|
35
34
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
35
|
+
order: number;
|
|
36
36
|
apDate: Date;
|
|
37
37
|
amount: number;
|
|
38
38
|
__v?: number;
|
|
@@ -45,8 +45,8 @@ export declare const allSchemas: {
|
|
|
45
45
|
createdAt: NativeDate;
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
|
-
order: number;
|
|
49
48
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
49
|
+
order: number;
|
|
50
50
|
apDate: Date;
|
|
51
51
|
amount: number;
|
|
52
52
|
__v?: number;
|
|
@@ -59,8 +59,8 @@ export declare const allSchemas: {
|
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
|
-
order: number;
|
|
63
62
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
63
|
+
order: number;
|
|
64
64
|
apDate: Date;
|
|
65
65
|
amount: number;
|
|
66
66
|
__v?: number;
|
package/models/_models.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare const MODEL_NAMES: {
|
|
|
64
64
|
financialComplianceSettings: string;
|
|
65
65
|
financialIndexes: string;
|
|
66
66
|
financialSpreading: string;
|
|
67
|
+
financialSpreadingExclusion: string;
|
|
67
68
|
financialSpreadingSheets: string;
|
|
68
69
|
globals: string;
|
|
69
70
|
insuranceReportSettings: string;
|
package/models/_models.js
CHANGED
|
@@ -67,6 +67,7 @@ exports.MODEL_NAMES = {
|
|
|
67
67
|
financialComplianceSettings: 'financialComplianceSettings',
|
|
68
68
|
financialIndexes: 'financial_indexes',
|
|
69
69
|
financialSpreading: 'financial_spreadings',
|
|
70
|
+
financialSpreadingExclusion: 'financial_spreading_exclusions',
|
|
70
71
|
financialSpreadingSheets: 'financial_spreading_sheets',
|
|
71
72
|
globals: 'globals',
|
|
72
73
|
insuranceReportSettings: 'insurance_report_settings',
|
package/models/_models.ts
CHANGED
|
@@ -64,6 +64,7 @@ export const MODEL_NAMES = {
|
|
|
64
64
|
financialComplianceSettings: 'financialComplianceSettings',
|
|
65
65
|
financialIndexes: 'financial_indexes',
|
|
66
66
|
financialSpreading: 'financial_spreadings',
|
|
67
|
+
financialSpreadingExclusion: 'financial_spreading_exclusions',
|
|
67
68
|
financialSpreadingSheets: 'financial_spreading_sheets',
|
|
68
69
|
globals: 'globals',
|
|
69
70
|
insuranceReportSettings: 'insurance_report_settings',
|
package/package.json
CHANGED
|
@@ -28,7 +28,6 @@ class LoanStatementStatusService {
|
|
|
28
28
|
let currentDate = (0, dayjs_1.default)(product.startDate).utcOffset(0).startOf('month');
|
|
29
29
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
30
30
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
31
|
-
console.log('initStatementStatuses');
|
|
32
31
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
33
32
|
currentDate = currentDate.add(1, 'month');
|
|
34
33
|
}
|
|
@@ -73,7 +72,6 @@ class LoanStatementStatusService {
|
|
|
73
72
|
return [{ start: startOfMonth, end: endOfMonth }];
|
|
74
73
|
}
|
|
75
74
|
async toggleStatementLock(productId, statementDate) {
|
|
76
|
-
console.log('toggleStatementLock');
|
|
77
75
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
78
76
|
if (statementStatus) {
|
|
79
77
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -81,7 +79,6 @@ class LoanStatementStatusService {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
async updateStatementStatus(productId, statementDate, actual) {
|
|
84
|
-
console.log('updateStatementStatus', { statementDate, actual });
|
|
85
82
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
86
83
|
if (statementStatus && !statementStatus.locked) {
|
|
87
84
|
statementStatus.actual = actual;
|
|
@@ -106,7 +103,6 @@ class LoanStatementStatusService {
|
|
|
106
103
|
}
|
|
107
104
|
async getStatementStatus(productId, date) {
|
|
108
105
|
const statementDate = this.getStatementDateForDate(date);
|
|
109
|
-
console.log('getStatementStatus');
|
|
110
106
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
111
107
|
}
|
|
112
108
|
async getCreateStatementStatus(productId, statementDate) {
|
|
@@ -159,7 +155,6 @@ class LoanStatementStatusService {
|
|
|
159
155
|
const loanChargesService = this.getLoanChargesService();
|
|
160
156
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
161
157
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
162
|
-
console.log('getBorrowerMonthStatus');
|
|
163
158
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
164
159
|
}));
|
|
165
160
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|
|
@@ -34,7 +34,6 @@ export class LoanStatementStatusService {
|
|
|
34
34
|
let currentDate = dayjs(product.startDate).utcOffset(0).startOf('month');
|
|
35
35
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
36
36
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
37
|
-
console.log('initStatementStatuses');
|
|
38
37
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
39
38
|
currentDate = currentDate.add(1, 'month');
|
|
40
39
|
}
|
|
@@ -87,7 +86,6 @@ export class LoanStatementStatusService {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
async toggleStatementLock(productId: string, statementDate: ISelectedMonth) {
|
|
90
|
-
console.log('toggleStatementLock');
|
|
91
89
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
92
90
|
if (statementStatus) {
|
|
93
91
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -96,7 +94,6 @@ export class LoanStatementStatusService {
|
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
async updateStatementStatus(productId: string, statementDate: ISelectedMonth, actual: boolean) {
|
|
99
|
-
console.log('updateStatementStatus', { statementDate, actual });
|
|
100
97
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
101
98
|
if (statementStatus && !statementStatus.locked) {
|
|
102
99
|
statementStatus.actual = actual;
|
|
@@ -123,7 +120,6 @@ export class LoanStatementStatusService {
|
|
|
123
120
|
|
|
124
121
|
async getStatementStatus(productId: string, date: Date) {
|
|
125
122
|
const statementDate = this.getStatementDateForDate(date);
|
|
126
|
-
console.log('getStatementStatus');
|
|
127
123
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
128
124
|
}
|
|
129
125
|
|
|
@@ -177,7 +173,6 @@ export class LoanStatementStatusService {
|
|
|
177
173
|
const loanChargesService = this.getLoanChargesService();
|
|
178
174
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
179
175
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
180
|
-
console.log('getBorrowerMonthStatus');
|
|
181
176
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
182
177
|
}));
|
|
183
178
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|