gemcap-be-common 1.5.71 → 1.5.73
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/BorrowerCompliance.model.d.ts +19 -15
- package/models/BorrowerCompliance.model.ts +3 -3
- package/models/ComplianceItem.model.d.ts +19 -0
- package/models/ComplianceItem.model.ts +20 -1
- package/models/FinancialCompliance.model.d.ts +17 -12
- package/models/FinancialComplianceBorrower.model.d.ts +11 -6
- package/models/_index.d.ts +9 -9
- package/package.json +1 -1
- package/services/compliance-borrowers.service.d.ts +15 -42
- package/services/compliance-borrowers.service.js +2 -2
- package/services/compliance-borrowers.service.ts +22 -14
- package/services/file-manager.service.d.ts +1 -1
- package/services/loan-transactions.service.d.ts +1 -1
- package/services/quickbooks.service.d.ts +1 -1
- package/services/users.service.d.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/types" />
|
|
2
|
+
/// <reference types="mongoose/types/document" />
|
|
3
|
+
/// <reference types="mongoose/types/models" />
|
|
4
|
+
/// <reference types="mongoose/types/utility" />
|
|
1
5
|
/// <reference types="mongoose/types/aggregate" />
|
|
2
6
|
/// <reference types="mongoose/types/callback" />
|
|
3
7
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -23,7 +27,7 @@
|
|
|
23
27
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
28
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
29
|
import mongoose, { Model } from 'mongoose';
|
|
26
|
-
import {
|
|
30
|
+
import { IBorrowerItemLean, IEmailRecipient } from './ComplianceItem.model';
|
|
27
31
|
import { IBorrowerDoc } from './Borrower.model';
|
|
28
32
|
export interface IComplianceNote {
|
|
29
33
|
note: string;
|
|
@@ -43,7 +47,7 @@ export interface IComplianceBorrower {
|
|
|
43
47
|
plaidAccessToken?: string;
|
|
44
48
|
fundingStatus?: string;
|
|
45
49
|
lastEmailSentAt?: Date;
|
|
46
|
-
items?:
|
|
50
|
+
items?: IBorrowerItemLean[];
|
|
47
51
|
}
|
|
48
52
|
export interface IComplianceBorrowerDoc extends IComplianceBorrower, mongoose.Document {
|
|
49
53
|
_id: mongoose.Types.ObjectId;
|
|
@@ -71,7 +75,7 @@ export interface IComplianceBorrowerWithBorrower extends Omit<IComplianceBorrowe
|
|
|
71
75
|
}
|
|
72
76
|
export type ComplianceBorrowerModel = Model<IComplianceBorrowerDoc>;
|
|
73
77
|
export interface IComplianceBorrowerDocumentFull extends Omit<IComplianceBorrowerWithBorrower, 'items'> {
|
|
74
|
-
items:
|
|
78
|
+
items: IBorrowerItemLean[];
|
|
75
79
|
}
|
|
76
80
|
export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
77
81
|
timestamps: true;
|
|
@@ -91,13 +95,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
91
95
|
user?: string;
|
|
92
96
|
}>;
|
|
93
97
|
mainEmails: mongoose.Types.DocumentArray<{
|
|
94
|
-
title?: string;
|
|
95
98
|
email?: string;
|
|
99
|
+
title?: string;
|
|
96
100
|
isActive?: boolean;
|
|
97
101
|
}>;
|
|
98
102
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
99
|
-
title?: string;
|
|
100
103
|
email?: string;
|
|
104
|
+
title?: string;
|
|
101
105
|
isActive?: boolean;
|
|
102
106
|
}>;
|
|
103
107
|
items: mongoose.Types.DocumentArray<{
|
|
@@ -105,8 +109,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
105
109
|
updatedAt: NativeDate;
|
|
106
110
|
} & {
|
|
107
111
|
emailAddresses: mongoose.Types.DocumentArray<{
|
|
108
|
-
title?: string;
|
|
109
112
|
email?: string;
|
|
113
|
+
title?: string;
|
|
110
114
|
isActive?: boolean;
|
|
111
115
|
}>;
|
|
112
116
|
instances: mongoose.Types.DocumentArray<{
|
|
@@ -128,7 +132,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
128
132
|
startDate?: Date;
|
|
129
133
|
frequency?: string;
|
|
130
134
|
}>;
|
|
131
|
-
__v?: number;
|
|
132
135
|
isVisible?: boolean;
|
|
133
136
|
email?: string;
|
|
134
137
|
isEmailingActive?: boolean;
|
|
@@ -136,6 +139,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
136
139
|
plaidAccessToken?: string;
|
|
137
140
|
fundingStatus?: string;
|
|
138
141
|
lastEmailSentAt?: Date;
|
|
142
|
+
__v?: number;
|
|
139
143
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
140
144
|
createdAt: NativeDate;
|
|
141
145
|
updatedAt: NativeDate;
|
|
@@ -152,13 +156,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
152
156
|
user?: string;
|
|
153
157
|
}>;
|
|
154
158
|
mainEmails: mongoose.Types.DocumentArray<{
|
|
155
|
-
title?: string;
|
|
156
159
|
email?: string;
|
|
160
|
+
title?: string;
|
|
157
161
|
isActive?: boolean;
|
|
158
162
|
}>;
|
|
159
163
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
160
|
-
title?: string;
|
|
161
164
|
email?: string;
|
|
165
|
+
title?: string;
|
|
162
166
|
isActive?: boolean;
|
|
163
167
|
}>;
|
|
164
168
|
items: mongoose.Types.DocumentArray<{
|
|
@@ -166,8 +170,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
166
170
|
updatedAt: NativeDate;
|
|
167
171
|
} & {
|
|
168
172
|
emailAddresses: mongoose.Types.DocumentArray<{
|
|
169
|
-
title?: string;
|
|
170
173
|
email?: string;
|
|
174
|
+
title?: string;
|
|
171
175
|
isActive?: boolean;
|
|
172
176
|
}>;
|
|
173
177
|
instances: mongoose.Types.DocumentArray<{
|
|
@@ -189,7 +193,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
189
193
|
startDate?: Date;
|
|
190
194
|
frequency?: string;
|
|
191
195
|
}>;
|
|
192
|
-
__v?: number;
|
|
193
196
|
isVisible?: boolean;
|
|
194
197
|
email?: string;
|
|
195
198
|
isEmailingActive?: boolean;
|
|
@@ -197,6 +200,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
197
200
|
plaidAccessToken?: string;
|
|
198
201
|
fundingStatus?: string;
|
|
199
202
|
lastEmailSentAt?: Date;
|
|
203
|
+
__v?: number;
|
|
200
204
|
}>> & mongoose.FlatRecord<{
|
|
201
205
|
createdAt: NativeDate;
|
|
202
206
|
updatedAt: NativeDate;
|
|
@@ -213,13 +217,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
213
217
|
user?: string;
|
|
214
218
|
}>;
|
|
215
219
|
mainEmails: mongoose.Types.DocumentArray<{
|
|
216
|
-
title?: string;
|
|
217
220
|
email?: string;
|
|
221
|
+
title?: string;
|
|
218
222
|
isActive?: boolean;
|
|
219
223
|
}>;
|
|
220
224
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
221
|
-
title?: string;
|
|
222
225
|
email?: string;
|
|
226
|
+
title?: string;
|
|
223
227
|
isActive?: boolean;
|
|
224
228
|
}>;
|
|
225
229
|
items: mongoose.Types.DocumentArray<{
|
|
@@ -227,8 +231,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
227
231
|
updatedAt: NativeDate;
|
|
228
232
|
} & {
|
|
229
233
|
emailAddresses: mongoose.Types.DocumentArray<{
|
|
230
|
-
title?: string;
|
|
231
234
|
email?: string;
|
|
235
|
+
title?: string;
|
|
232
236
|
isActive?: boolean;
|
|
233
237
|
}>;
|
|
234
238
|
instances: mongoose.Types.DocumentArray<{
|
|
@@ -250,7 +254,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
250
254
|
startDate?: Date;
|
|
251
255
|
frequency?: string;
|
|
252
256
|
}>;
|
|
253
|
-
__v?: number;
|
|
254
257
|
isVisible?: boolean;
|
|
255
258
|
email?: string;
|
|
256
259
|
isEmailingActive?: boolean;
|
|
@@ -258,6 +261,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
|
|
|
258
261
|
plaidAccessToken?: string;
|
|
259
262
|
fundingStatus?: string;
|
|
260
263
|
lastEmailSentAt?: Date;
|
|
264
|
+
__v?: number;
|
|
261
265
|
}> & {
|
|
262
266
|
_id: mongoose.Types.ObjectId;
|
|
263
267
|
}>;
|
|
@@ -2,7 +2,7 @@ import mongoose, { Model } from 'mongoose';
|
|
|
2
2
|
|
|
3
3
|
import { MODEL_NAMES } from './_models';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
IBorrowerItemLean,
|
|
6
6
|
IEmailRecipient,
|
|
7
7
|
} from './ComplianceItem.model';
|
|
8
8
|
import { IBorrowerDoc } from './Borrower.model';
|
|
@@ -26,7 +26,7 @@ export interface IComplianceBorrower {
|
|
|
26
26
|
plaidAccessToken?: string;
|
|
27
27
|
fundingStatus?: string;
|
|
28
28
|
lastEmailSentAt?: Date;
|
|
29
|
-
items?:
|
|
29
|
+
items?: IBorrowerItemLean[];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface IComplianceBorrowerDoc extends IComplianceBorrower, mongoose.Document {
|
|
@@ -61,7 +61,7 @@ export interface IComplianceBorrowerWithBorrower extends Omit<IComplianceBorrowe
|
|
|
61
61
|
export type ComplianceBorrowerModel = Model<IComplianceBorrowerDoc>;
|
|
62
62
|
|
|
63
63
|
export interface IComplianceBorrowerDocumentFull extends Omit<IComplianceBorrowerWithBorrower, 'items'> {
|
|
64
|
-
items:
|
|
64
|
+
items: IBorrowerItemLean[];
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const BorrowerComplianceInstanceSchema = new mongoose.Schema({
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/types" />
|
|
2
|
+
/// <reference types="mongoose/types/document" />
|
|
3
|
+
/// <reference types="mongoose/types/models" />
|
|
4
|
+
/// <reference types="mongoose/types/utility" />
|
|
1
5
|
/// <reference types="mongoose/types/aggregate" />
|
|
2
6
|
/// <reference types="mongoose/types/callback" />
|
|
3
7
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -34,6 +38,9 @@ export interface IEmailRecipient {
|
|
|
34
38
|
title?: string;
|
|
35
39
|
isActive: boolean;
|
|
36
40
|
}
|
|
41
|
+
export interface IEmailRecipientLean extends IEmailRecipient {
|
|
42
|
+
_id?: mongoose.Types.ObjectId;
|
|
43
|
+
}
|
|
37
44
|
export interface IEmailRecipientDocument extends IEmailRecipient, Document {
|
|
38
45
|
}
|
|
39
46
|
export interface IComplianceItem {
|
|
@@ -63,12 +70,24 @@ export interface IBorrowerItemInstance {
|
|
|
63
70
|
status: EComplianceItemStatus;
|
|
64
71
|
files?: IComplianceFile[];
|
|
65
72
|
}
|
|
73
|
+
export interface IBorrowerItemInstanceLean extends IBorrowerItemInstance {
|
|
74
|
+
_id: mongoose.Types.ObjectId;
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
updatedAt: Date;
|
|
77
|
+
}
|
|
66
78
|
export interface IBorrowerItemInstanceDocument extends IBorrowerItemInstance, Document {
|
|
67
79
|
}
|
|
68
80
|
export interface IComplianceItemDocument extends IComplianceItem, Document {
|
|
69
81
|
}
|
|
70
82
|
export interface IBorrowerItemDocument extends IBorrowerItem, Document {
|
|
71
83
|
}
|
|
84
|
+
export interface IBorrowerItemLean extends Omit<IBorrowerItem, 'instances' | 'emailAddresses'> {
|
|
85
|
+
_id: mongoose.Types.ObjectId;
|
|
86
|
+
createdAt: Date;
|
|
87
|
+
updatedAt: Date;
|
|
88
|
+
instances: IBorrowerItemInstanceLean[];
|
|
89
|
+
emailAddresses: IEmailRecipientLean[];
|
|
90
|
+
}
|
|
72
91
|
export declare const ComplianceItemSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
73
92
|
timestamps: true;
|
|
74
93
|
}, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mongoose, { Document } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { MODEL_NAMES } from './_models';
|
|
4
|
+
import { IComplianceBorrower } from './BorrowerCompliance.model';
|
|
4
5
|
|
|
5
6
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
6
7
|
|
|
@@ -17,6 +18,10 @@ export interface IEmailRecipient {
|
|
|
17
18
|
isActive: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
export interface IEmailRecipientLean extends IEmailRecipient {
|
|
22
|
+
_id?: mongoose.Types.ObjectId;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
export interface IEmailRecipientDocument extends IEmailRecipient, Document {
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -51,6 +56,12 @@ export interface IBorrowerItemInstance {
|
|
|
51
56
|
files?: IComplianceFile[];
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
export interface IBorrowerItemInstanceLean extends IBorrowerItemInstance {
|
|
60
|
+
_id: mongoose.Types.ObjectId;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
export interface IBorrowerItemInstanceDocument extends IBorrowerItemInstance, Document {
|
|
55
66
|
}
|
|
56
67
|
|
|
@@ -60,6 +71,14 @@ export interface IComplianceItemDocument extends IComplianceItem, Document {
|
|
|
60
71
|
export interface IBorrowerItemDocument extends IBorrowerItem, Document {
|
|
61
72
|
}
|
|
62
73
|
|
|
74
|
+
export interface IBorrowerItemLean extends Omit<IBorrowerItem, 'instances' | 'emailAddresses'> {
|
|
75
|
+
_id: mongoose.Types.ObjectId;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt: Date;
|
|
78
|
+
instances: IBorrowerItemInstanceLean[];
|
|
79
|
+
emailAddresses: IEmailRecipientLean[];
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
export const ComplianceItemSchema = new mongoose.Schema(
|
|
64
83
|
{
|
|
65
84
|
name: {
|
|
@@ -81,7 +100,7 @@ export const ComplianceItemSchema = new mongoose.Schema(
|
|
|
81
100
|
},
|
|
82
101
|
__v: { type: Number, select: false },
|
|
83
102
|
},
|
|
84
|
-
{ timestamps: true }
|
|
103
|
+
{ timestamps: true },
|
|
85
104
|
);
|
|
86
105
|
|
|
87
106
|
ComplianceItemSchema.plugin(mongooseLeanId);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/document" />
|
|
2
|
+
/// <reference types="mongoose/types/models" />
|
|
3
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
4
|
+
/// <reference types="mongoose/types/utility" />
|
|
5
|
+
/// <reference types="mongoose/types/types" />
|
|
1
6
|
/// <reference types="mongoose/types/aggregate" />
|
|
2
7
|
/// <reference types="mongoose/types/callback" />
|
|
3
8
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -34,52 +39,52 @@ export interface IFinancialComplianceSettings {
|
|
|
34
39
|
export interface IFinancialComplianceSettingsDocument extends IFinancialComplianceSettings, Document {
|
|
35
40
|
}
|
|
36
41
|
export declare const FinancialComplianceSettingsSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
|
|
37
|
-
isDeleted: boolean;
|
|
38
42
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
39
|
-
title?: string;
|
|
40
43
|
email?: string;
|
|
44
|
+
title?: string;
|
|
41
45
|
isActive?: boolean;
|
|
42
46
|
}>;
|
|
47
|
+
isDeleted: boolean;
|
|
43
48
|
managementEmails: mongoose.Types.DocumentArray<{
|
|
44
|
-
title?: string;
|
|
45
49
|
email?: string;
|
|
50
|
+
title?: string;
|
|
46
51
|
isActive?: boolean;
|
|
47
52
|
}>;
|
|
48
53
|
__v?: number;
|
|
49
|
-
invoiceSentDate?: Date;
|
|
50
54
|
dueDate?: Date;
|
|
55
|
+
invoiceSentDate?: Date;
|
|
51
56
|
stopFundingDate?: Date;
|
|
52
57
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
53
|
-
isDeleted: boolean;
|
|
54
58
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
55
|
-
title?: string;
|
|
56
59
|
email?: string;
|
|
60
|
+
title?: string;
|
|
57
61
|
isActive?: boolean;
|
|
58
62
|
}>;
|
|
63
|
+
isDeleted: boolean;
|
|
59
64
|
managementEmails: mongoose.Types.DocumentArray<{
|
|
60
|
-
title?: string;
|
|
61
65
|
email?: string;
|
|
66
|
+
title?: string;
|
|
62
67
|
isActive?: boolean;
|
|
63
68
|
}>;
|
|
64
69
|
__v?: number;
|
|
65
|
-
invoiceSentDate?: Date;
|
|
66
70
|
dueDate?: Date;
|
|
71
|
+
invoiceSentDate?: Date;
|
|
67
72
|
stopFundingDate?: Date;
|
|
68
73
|
}>> & mongoose.FlatRecord<{
|
|
69
|
-
isDeleted: boolean;
|
|
70
74
|
financialEmails: mongoose.Types.DocumentArray<{
|
|
71
|
-
title?: string;
|
|
72
75
|
email?: string;
|
|
76
|
+
title?: string;
|
|
73
77
|
isActive?: boolean;
|
|
74
78
|
}>;
|
|
79
|
+
isDeleted: boolean;
|
|
75
80
|
managementEmails: mongoose.Types.DocumentArray<{
|
|
76
|
-
title?: string;
|
|
77
81
|
email?: string;
|
|
82
|
+
title?: string;
|
|
78
83
|
isActive?: boolean;
|
|
79
84
|
}>;
|
|
80
85
|
__v?: number;
|
|
81
|
-
invoiceSentDate?: Date;
|
|
82
86
|
dueDate?: Date;
|
|
87
|
+
invoiceSentDate?: Date;
|
|
83
88
|
stopFundingDate?: Date;
|
|
84
89
|
}> & {
|
|
85
90
|
_id: mongoose.Types.ObjectId;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/document" />
|
|
2
|
+
/// <reference types="mongoose/types/models" />
|
|
3
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
4
|
+
/// <reference types="mongoose/types/types" />
|
|
5
|
+
/// <reference types="mongoose/types/utility" />
|
|
1
6
|
/// <reference types="mongoose/types/aggregate" />
|
|
2
7
|
/// <reference types="mongoose/types/callback" />
|
|
3
8
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -53,11 +58,11 @@ export interface IFinancialComplianceBorrowerDocumentWithMails extends IFinancia
|
|
|
53
58
|
financialEmails: IEmailRecipient[];
|
|
54
59
|
}
|
|
55
60
|
export declare const FinancialComplianceBorrowerSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
|
|
56
|
-
isDeleted: boolean;
|
|
57
61
|
borrower: mongoose.Types.ObjectId;
|
|
62
|
+
isDeleted: boolean;
|
|
58
63
|
__v?: number;
|
|
59
|
-
invoiceSentDate?: Date;
|
|
60
64
|
dueDate?: Date;
|
|
65
|
+
invoiceSentDate?: Date;
|
|
61
66
|
stopFundingDate?: Date;
|
|
62
67
|
lastReminderSentAt?: Date;
|
|
63
68
|
accountClearedDate?: Date;
|
|
@@ -69,11 +74,11 @@ export declare const FinancialComplianceBorrowerSchema: mongoose.Schema<any, mon
|
|
|
69
74
|
balanceOutstanding?: number;
|
|
70
75
|
reminderCounter?: number;
|
|
71
76
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
72
|
-
isDeleted: boolean;
|
|
73
77
|
borrower: mongoose.Types.ObjectId;
|
|
78
|
+
isDeleted: boolean;
|
|
74
79
|
__v?: number;
|
|
75
|
-
invoiceSentDate?: Date;
|
|
76
80
|
dueDate?: Date;
|
|
81
|
+
invoiceSentDate?: Date;
|
|
77
82
|
stopFundingDate?: Date;
|
|
78
83
|
lastReminderSentAt?: Date;
|
|
79
84
|
accountClearedDate?: Date;
|
|
@@ -85,11 +90,11 @@ export declare const FinancialComplianceBorrowerSchema: mongoose.Schema<any, mon
|
|
|
85
90
|
balanceOutstanding?: number;
|
|
86
91
|
reminderCounter?: number;
|
|
87
92
|
}>> & mongoose.FlatRecord<{
|
|
88
|
-
isDeleted: boolean;
|
|
89
93
|
borrower: mongoose.Types.ObjectId;
|
|
94
|
+
isDeleted: boolean;
|
|
90
95
|
__v?: number;
|
|
91
|
-
invoiceSentDate?: Date;
|
|
92
96
|
dueDate?: Date;
|
|
97
|
+
invoiceSentDate?: Date;
|
|
93
98
|
stopFundingDate?: Date;
|
|
94
99
|
lastReminderSentAt?: Date;
|
|
95
100
|
accountClearedDate?: Date;
|
package/models/_index.d.ts
CHANGED
|
@@ -35,44 +35,44 @@ export declare const allSchemas: {
|
|
|
35
35
|
createdAt: NativeDate;
|
|
36
36
|
updatedAt: NativeDate;
|
|
37
37
|
} & {
|
|
38
|
-
|
|
38
|
+
order: number;
|
|
39
39
|
amount: number;
|
|
40
40
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
41
|
-
|
|
41
|
+
apDate: Date;
|
|
42
|
+
__v?: number;
|
|
42
43
|
poNumber?: string;
|
|
43
44
|
customerName?: string;
|
|
44
45
|
otherInformation1?: string;
|
|
45
46
|
otherInformation2?: string;
|
|
46
47
|
otherInformation3?: string;
|
|
47
|
-
__v?: number;
|
|
48
48
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
49
49
|
createdAt: NativeDate;
|
|
50
50
|
updatedAt: NativeDate;
|
|
51
51
|
} & {
|
|
52
|
-
|
|
52
|
+
order: number;
|
|
53
53
|
amount: number;
|
|
54
54
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
55
|
-
|
|
55
|
+
apDate: Date;
|
|
56
|
+
__v?: number;
|
|
56
57
|
poNumber?: string;
|
|
57
58
|
customerName?: string;
|
|
58
59
|
otherInformation1?: string;
|
|
59
60
|
otherInformation2?: string;
|
|
60
61
|
otherInformation3?: string;
|
|
61
|
-
__v?: number;
|
|
62
62
|
}>> & import("mongoose").FlatRecord<{
|
|
63
63
|
createdAt: NativeDate;
|
|
64
64
|
updatedAt: NativeDate;
|
|
65
65
|
} & {
|
|
66
|
-
|
|
66
|
+
order: number;
|
|
67
67
|
amount: number;
|
|
68
68
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
69
|
-
|
|
69
|
+
apDate: Date;
|
|
70
|
+
__v?: number;
|
|
70
71
|
poNumber?: string;
|
|
71
72
|
customerName?: string;
|
|
72
73
|
otherInformation1?: string;
|
|
73
74
|
otherInformation2?: string;
|
|
74
75
|
otherInformation3?: string;
|
|
75
|
-
__v?: number;
|
|
76
76
|
}> & {
|
|
77
77
|
_id: import("mongoose").Types.ObjectId;
|
|
78
78
|
}>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/collection" />
|
|
2
|
-
/// <reference types="mongoose/types/connection" />
|
|
3
|
-
/// <reference types="mongoose/types/error" />
|
|
4
|
-
/// <reference types="mongoose/types/models" />
|
|
5
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
6
|
-
/// <reference types="mongoose/types/utility" />
|
|
7
|
-
/// <reference types="mongoose/types/document" />
|
|
8
1
|
/// <reference types="mongoose/types/types" />
|
|
2
|
+
/// <reference types="mongoose/types/document" />
|
|
9
3
|
/// <reference types="mongoose/types/aggregate" />
|
|
10
4
|
/// <reference types="mongoose/types/callback" />
|
|
11
5
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -31,7 +25,7 @@
|
|
|
31
25
|
/// <reference types="mongoose/types/virtuals" />
|
|
32
26
|
/// <reference types="mongoose/types/inferschematype" />
|
|
33
27
|
import mongoose from 'mongoose';
|
|
34
|
-
import {
|
|
28
|
+
import { IBorrowerItemLean, IBorrowerItemInstance, IComplianceFile, IEmailRecipient, IBorrowerItemInstanceLean } from '../models/ComplianceItem.model';
|
|
35
29
|
import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
|
|
36
30
|
import { IComplianceBorrowerWithBorrower, IComplianceBorrowerDocumentFull, IComplianceBorrowerWithPlaidToken } from '../models/BorrowerCompliance.model';
|
|
37
31
|
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
@@ -47,48 +41,27 @@ export interface IInstanceStatus {
|
|
|
47
41
|
tooltip: string;
|
|
48
42
|
};
|
|
49
43
|
}
|
|
44
|
+
export interface IBorrowerItemInstanceWithStatusesLean extends IBorrowerItemInstanceLean, IInstanceStatus {
|
|
45
|
+
itemId: mongoose.Types.ObjectId;
|
|
46
|
+
files: (IComplianceFile & {
|
|
47
|
+
uploadedByUser: string | null;
|
|
48
|
+
})[];
|
|
49
|
+
}
|
|
50
|
+
export interface IBorrowerItemWithStatusesLean extends Omit<IBorrowerItemLean, 'instances'> {
|
|
51
|
+
instances: IBorrowerItemInstanceWithStatusesLean[];
|
|
52
|
+
}
|
|
50
53
|
export declare class ComplianceBorrowersService {
|
|
51
54
|
private readonly _fileManagerService;
|
|
52
55
|
private readonly _uploadsService;
|
|
53
56
|
constructor(_fileManagerService: FileManagerService, _uploadsService: UploadsService);
|
|
54
57
|
isComplianceBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
|
|
55
|
-
calculateInstanceStatuses(instance:
|
|
58
|
+
calculateInstanceStatuses(instance: IBorrowerItemInstance, item: IBorrowerItemLean): IInstanceStatus;
|
|
56
59
|
getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<IComplianceBorrowerDocumentFull & {
|
|
57
|
-
items:
|
|
60
|
+
items: IBorrowerItemWithStatusesLean[];
|
|
58
61
|
}>;
|
|
59
|
-
getAllBorrowersShortened(userAccess: IUserAccess): Promise<
|
|
60
|
-
items: {
|
|
61
|
-
instances: any[];
|
|
62
|
-
item: import("../models/ComplianceItem.model").IComplianceItemDocument;
|
|
63
|
-
startDate: Date;
|
|
64
|
-
frequency: string;
|
|
65
|
-
emailAddresses: import("../models/ComplianceItem.model").IEmailRecipientDocument[];
|
|
66
|
-
_id?: any;
|
|
67
|
-
__v?: any;
|
|
68
|
-
$locals: Record<string, unknown>;
|
|
69
|
-
$op: "save" | "validate" | "remove";
|
|
70
|
-
$where: Record<string, unknown>;
|
|
71
|
-
baseModelName?: string;
|
|
72
|
-
collection: mongoose.Collection<mongoose.mongo.BSON.Document>;
|
|
73
|
-
db: mongoose.Connection;
|
|
74
|
-
errors?: mongoose.Error.ValidationError;
|
|
75
|
-
id?: any;
|
|
76
|
-
isNew: boolean;
|
|
77
|
-
schema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
|
|
78
|
-
[x: string]: unknown;
|
|
79
|
-
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
80
|
-
[x: string]: unknown;
|
|
81
|
-
}>> & mongoose.FlatRecord<{
|
|
82
|
-
[x: string]: unknown;
|
|
83
|
-
}> & Required<{
|
|
84
|
-
_id: unknown;
|
|
85
|
-
}>>;
|
|
86
|
-
}[];
|
|
87
|
-
borrower: import("../models/Borrower.model").IBorrowerDoc;
|
|
88
|
-
fundingStatus?: string;
|
|
89
|
-
})[]>;
|
|
62
|
+
getAllBorrowersShortened(userAccess: IUserAccess): Promise<Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items">[]>;
|
|
90
63
|
generateInstances(complianceBorrowerId: any): Promise<IComplianceBorrowerDocumentFull & {
|
|
91
|
-
items:
|
|
64
|
+
items: IBorrowerItemWithStatusesLean[];
|
|
92
65
|
}>;
|
|
93
66
|
calculateAndUpdateFundingStatus(complianceBorrowerId: string): Promise<void>;
|
|
94
67
|
calculateFundingStatus(complianceBorrower: IComplianceBorrowerDocumentFull): string;
|
|
@@ -82,7 +82,7 @@ class ComplianceBorrowersService {
|
|
|
82
82
|
.transform((borrower) => ({ ...borrower, plaidAccessToken: borrower?.plaidAccessToken ?? false }))
|
|
83
83
|
.lean();
|
|
84
84
|
if (!ourBorrower.borrower) {
|
|
85
|
-
return Promise.resolve({ ...ourBorrower });
|
|
85
|
+
return Promise.resolve({ ...ourBorrower, items: [] });
|
|
86
86
|
}
|
|
87
87
|
const financeBorrower = await FinancialComplianceBorrower_model_1.default.findOne({ borrower: ourBorrower.borrower?._id });
|
|
88
88
|
if (financeBorrower) {
|
|
@@ -114,7 +114,7 @@ class ComplianceBorrowersService {
|
|
|
114
114
|
}, []),
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
|
-
return Promise.resolve({ ...ourBorrower,
|
|
117
|
+
return Promise.resolve({ ...ourBorrower, items });
|
|
118
118
|
}
|
|
119
119
|
async getAllBorrowersShortened(userAccess) {
|
|
120
120
|
const allComplianceBorrower = await BorrowerCompliance_model_1.BorrowerCompliance
|
|
@@ -3,10 +3,10 @@ import _ from 'lodash';
|
|
|
3
3
|
import mongoose from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
IBorrowerItemLean,
|
|
7
|
+
IBorrowerItemInstance,
|
|
8
8
|
IComplianceFile,
|
|
9
|
-
IEmailRecipient,
|
|
9
|
+
IEmailRecipient, IBorrowerItemInstanceLean,
|
|
10
10
|
} from '../models/ComplianceItem.model';
|
|
11
11
|
import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
|
|
12
12
|
import { EItemProgressStatus } from '../enums/item-progress-status.enum';
|
|
@@ -51,6 +51,15 @@ export interface IInstanceStatus {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
export interface IBorrowerItemInstanceWithStatusesLean extends IBorrowerItemInstanceLean, IInstanceStatus {
|
|
55
|
+
itemId: mongoose.Types.ObjectId;
|
|
56
|
+
files: (IComplianceFile & { uploadedByUser: string | null; })[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IBorrowerItemWithStatusesLean extends Omit<IBorrowerItemLean, 'instances'> {
|
|
60
|
+
instances: IBorrowerItemInstanceWithStatusesLean[];
|
|
61
|
+
}
|
|
62
|
+
|
|
54
63
|
export class ComplianceBorrowersService {
|
|
55
64
|
|
|
56
65
|
constructor(
|
|
@@ -67,7 +76,7 @@ export class ComplianceBorrowersService {
|
|
|
67
76
|
return true;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
|
-
calculateInstanceStatuses(instance:
|
|
79
|
+
calculateInstanceStatuses(instance: IBorrowerItemInstance, item: IBorrowerItemLean): IInstanceStatus {
|
|
71
80
|
let progress: { text: string, status: string };
|
|
72
81
|
let score: { value: number, tooltip: string } = null;
|
|
73
82
|
if (instance.submittedDate) {
|
|
@@ -93,7 +102,9 @@ export class ComplianceBorrowersService {
|
|
|
93
102
|
return { progress, score };
|
|
94
103
|
}
|
|
95
104
|
|
|
96
|
-
async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<IComplianceBorrowerDocumentFull & {
|
|
105
|
+
async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<IComplianceBorrowerDocumentFull & {
|
|
106
|
+
items: IBorrowerItemWithStatusesLean[];
|
|
107
|
+
}> {
|
|
97
108
|
if (!complianceBorrowerId) {
|
|
98
109
|
return null;
|
|
99
110
|
}
|
|
@@ -111,7 +122,7 @@ export class ComplianceBorrowersService {
|
|
|
111
122
|
.transform((borrower) => ({ ...borrower, plaidAccessToken: borrower?.plaidAccessToken ?? false }))
|
|
112
123
|
.lean<IComplianceBorrowerDocumentFull>();
|
|
113
124
|
if (!ourBorrower.borrower) {
|
|
114
|
-
return Promise.resolve({ ...ourBorrower });
|
|
125
|
+
return Promise.resolve({ ...ourBorrower, items: [] });
|
|
115
126
|
}
|
|
116
127
|
const financeBorrower = await FinancialComplianceBorrower.findOne({ borrower: ourBorrower.borrower?._id });
|
|
117
128
|
if (financeBorrower) {
|
|
@@ -125,7 +136,7 @@ export class ComplianceBorrowersService {
|
|
|
125
136
|
return Promise.resolve(null);
|
|
126
137
|
}
|
|
127
138
|
|
|
128
|
-
const items = { items: [] as
|
|
139
|
+
const items = { items: [] as IBorrowerItemLean[], ...ourBorrower }.items.map((item) => {
|
|
129
140
|
return {
|
|
130
141
|
...item,
|
|
131
142
|
instances: item.instances.reduce((acc, instance) => {
|
|
@@ -140,13 +151,10 @@ export class ComplianceBorrowersService {
|
|
|
140
151
|
console.error({ e });
|
|
141
152
|
return acc;
|
|
142
153
|
}
|
|
143
|
-
},
|
|
144
|
-
itemId: mongoose.Types.ObjectId,
|
|
145
|
-
files: IComplianceFile[]
|
|
146
|
-
})[]>[]),
|
|
154
|
+
}, [] as IBorrowerItemInstanceWithStatusesLean[]),
|
|
147
155
|
};
|
|
148
156
|
});
|
|
149
|
-
return Promise.resolve({ ...ourBorrower,
|
|
157
|
+
return Promise.resolve({ ...ourBorrower, items });
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
async getAllBorrowersShortened(userAccess: IUserAccess) {
|
|
@@ -190,7 +198,7 @@ export class ComplianceBorrowersService {
|
|
|
190
198
|
} catch (e) {
|
|
191
199
|
return acc;
|
|
192
200
|
}
|
|
193
|
-
}, []),
|
|
201
|
+
}, [] as IBorrowerItemInstanceWithStatusesLean[]),
|
|
194
202
|
};
|
|
195
203
|
});
|
|
196
204
|
|
|
@@ -204,7 +212,7 @@ export class ComplianceBorrowersService {
|
|
|
204
212
|
async generateInstances(complianceBorrowerId) {
|
|
205
213
|
const complianceBorrower = await this.getFullComplianceBorrowerById(complianceBorrowerId);
|
|
206
214
|
|
|
207
|
-
const getLatestInstanceDate = (item:
|
|
215
|
+
const getLatestInstanceDate = (item: IBorrowerItemLean) => {
|
|
208
216
|
if (!item.instances || !item.instances.length) {
|
|
209
217
|
return null;
|
|
210
218
|
}
|