gemcap-be-common 1.5.129 → 1.5.131
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/brokers.db.d.ts +10 -166
- package/db/brokers.db.js +5 -5
- package/db/brokers.db.ts +15 -15
- package/models/LoanBroker.model.d.ts +23 -49
- package/models/LoanBroker.model.js +17 -4
- package/models/LoanBroker.model.ts +40 -10
- package/models/ProductBroker.model.d.ts +19 -19
- package/models/ProductBroker.model.js +9 -3
- package/models/ProductBroker.model.ts +13 -10
- package/package.json +1 -1
- package/services/borrowers.service.d.ts +2 -2
- package/services/brokers.service.d.ts +12 -166
- package/services/brokers.service.js +12 -18
- package/services/brokers.service.ts +23 -25
- package/services/compliance-borrowers.service.d.ts +1 -1
- package/services/quickbooks.service.js +13 -13
- package/services/quickbooks.service.ts +18 -18
- package/tsconfig.tsbuildinfo +1 -1
package/db/brokers.db.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
/// <reference types="mongoose/types/types" />
|
|
2
|
-
/// <reference types="mongoose/types/document" />
|
|
3
|
-
/// <reference types="mongoose/types/models" />
|
|
4
|
-
/// <reference types="mongoose/types/collection" />
|
|
5
|
-
/// <reference types="mongoose/types/connection" />
|
|
6
|
-
/// <reference types="mongoose/types/query" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/populate" />
|
|
9
|
-
/// <reference types="mongoose/types/utility" />
|
|
10
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
11
2
|
/// <reference types="mongoose/types/aggregate" />
|
|
12
3
|
/// <reference types="mongoose/types/callback" />
|
|
13
4
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -35,166 +26,19 @@
|
|
|
35
26
|
import mongoose from 'mongoose';
|
|
36
27
|
import { ILedgerDataRow } from './reports.db';
|
|
37
28
|
import { ILoanProductDoc } from '../models/LoanProducts.model';
|
|
38
|
-
import {
|
|
39
|
-
export declare const getProductBrokers: (productId: string) => Promise<
|
|
29
|
+
import { IProductBrokerDocWithLoanBroker, IProductBrokerLean } from '../models/ProductBroker.model';
|
|
30
|
+
export declare const getProductBrokers: (productId: string) => Promise<IProductBrokerDocWithLoanBroker[]>;
|
|
40
31
|
export declare const enrichWithBrokers: (transactions: ILedgerDataRow[], product: ILoanProductDoc) => Promise<ILedgerDataRow[]>;
|
|
41
|
-
export declare const getBorrowerBrokers: (borrowerId: string) => Promise<
|
|
42
|
-
|
|
43
|
-
}>)[]>;
|
|
44
|
-
export declare const getAllProductBrokers: () => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
45
|
-
_id: mongoose.Types.ObjectId;
|
|
46
|
-
}>)[]>;
|
|
32
|
+
export declare const getBorrowerBrokers: (borrowerId: string) => Promise<IProductBrokerLean[]>;
|
|
33
|
+
export declare const getAllProductBrokers: () => Promise<IProductBrokerLean[]>;
|
|
47
34
|
export declare const getAllLoanBrokers: () => Promise<{
|
|
48
|
-
emails:
|
|
35
|
+
emails: import("../models/LoanBroker.model").ILoanBrokerEmail[];
|
|
36
|
+
_id: mongoose.Types.ObjectId;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
uiId: string;
|
|
49
40
|
order: number;
|
|
50
41
|
active: boolean;
|
|
51
42
|
name: string;
|
|
52
|
-
_id: any;
|
|
53
|
-
__v?: any;
|
|
54
|
-
$assertPopulated: <Paths = {}>(path: string | string[], values?: Partial<Paths>) => Omit<import("../models/LoanBroker.model").ILoanBrokerDoc, keyof Paths> & Paths;
|
|
55
|
-
$clone: () => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
56
|
-
$getAllSubdocs: () => mongoose.Document<any, any, any>[];
|
|
57
|
-
$ignore: (path: string) => void;
|
|
58
|
-
$isDefault: (path: string) => boolean;
|
|
59
|
-
$isDeleted: (val?: boolean) => boolean;
|
|
60
|
-
$getPopulatedDocs: () => mongoose.Document<any, any, any>[];
|
|
61
|
-
$inc: (path: string | string[], val?: number) => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
62
|
-
$isEmpty: (path: string) => boolean;
|
|
63
|
-
$isValid: (path: string) => boolean;
|
|
64
|
-
$locals: mongoose.FlattenMaps<Record<string, unknown>>;
|
|
65
|
-
$markValid: (path: string) => void;
|
|
66
|
-
$model: {
|
|
67
|
-
<ModelType = mongoose.Model<unknown, {}, {}, {}, mongoose.Document<unknown, {}, unknown> & Required<{
|
|
68
|
-
_id: unknown;
|
|
69
|
-
}>, any>>(name: string): ModelType;
|
|
70
|
-
<ModelType_1 = mongoose.Model<any, {}, {}, {}, any, any>>(): ModelType_1;
|
|
71
|
-
};
|
|
72
|
-
$op: "save" | "validate" | "remove";
|
|
73
|
-
$session: (session?: mongoose.mongo.ClientSession) => mongoose.mongo.ClientSession;
|
|
74
|
-
$set: {
|
|
75
|
-
(path: string | Record<string, any>, val: any, type: any, options?: mongoose.DocumentSetOptions): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
76
|
-
(path: string | Record<string, any>, val: any, options?: mongoose.DocumentSetOptions): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
77
|
-
(value: string | Record<string, any>): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
78
|
-
};
|
|
79
|
-
$where: mongoose.FlattenMaps<Record<string, unknown>>;
|
|
80
|
-
baseModelName?: string;
|
|
81
|
-
collection: mongoose.Collection<mongoose.mongo.BSON.Document>;
|
|
82
|
-
db: mongoose.FlattenMaps<mongoose.Connection>;
|
|
83
|
-
deleteOne: (options?: mongoose.QueryOptions<unknown>) => any;
|
|
84
|
-
depopulate: (path?: string | string[]) => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
85
|
-
directModifiedPaths: () => string[];
|
|
86
|
-
equals: (doc: mongoose.Document<any, any, any>) => boolean;
|
|
87
|
-
errors?: mongoose.Error.ValidationError;
|
|
88
|
-
get: {
|
|
89
|
-
<T extends string | number | symbol>(path: T, type?: any, options?: any): any;
|
|
90
|
-
(path: string, type?: any, options?: any): any;
|
|
91
|
-
};
|
|
92
|
-
getChanges: () => mongoose.UpdateQuery<import("../models/LoanBroker.model").ILoanBrokerDoc>;
|
|
93
|
-
id?: any;
|
|
94
|
-
increment: () => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
95
|
-
init: (obj: mongoose.AnyObject, opts?: mongoose.AnyObject) => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
96
|
-
invalidate: {
|
|
97
|
-
<T_1 extends string | number | symbol>(path: T_1, errorMsg: string | NativeError, value?: any, kind?: string): NativeError;
|
|
98
|
-
(path: string, errorMsg: string | NativeError, value?: any, kind?: string): NativeError;
|
|
99
|
-
};
|
|
100
|
-
isDirectModified: {
|
|
101
|
-
<T_2 extends string | number | symbol>(path: T_2 | T_2[]): boolean;
|
|
102
|
-
(path: string | string[]): boolean;
|
|
103
|
-
};
|
|
104
|
-
isDirectSelected: {
|
|
105
|
-
<T_3 extends string | number | symbol>(path: T_3): boolean;
|
|
106
|
-
(path: string): boolean;
|
|
107
|
-
};
|
|
108
|
-
isInit: {
|
|
109
|
-
<T_4 extends string | number | symbol>(path: T_4): boolean;
|
|
110
|
-
(path: string): boolean;
|
|
111
|
-
};
|
|
112
|
-
isModified: {
|
|
113
|
-
<T_5 extends string | number | symbol>(path?: T_5 | T_5[], options?: {
|
|
114
|
-
ignoreAtomics?: boolean;
|
|
115
|
-
}): boolean;
|
|
116
|
-
(path?: string | string[], options?: {
|
|
117
|
-
ignoreAtomics?: boolean;
|
|
118
|
-
}): boolean;
|
|
119
|
-
};
|
|
120
|
-
isNew: boolean;
|
|
121
|
-
isSelected: {
|
|
122
|
-
<T_6 extends string | number | symbol>(path: T_6): boolean;
|
|
123
|
-
(path: string): boolean;
|
|
124
|
-
};
|
|
125
|
-
markModified: {
|
|
126
|
-
<T_7 extends string | number | symbol>(path: T_7, scope?: any): void;
|
|
127
|
-
(path: string, scope?: any): void;
|
|
128
|
-
};
|
|
129
|
-
model: {
|
|
130
|
-
<ModelType_2 = mongoose.Model<unknown, {}, {}, {}, mongoose.Document<unknown, {}, unknown> & Required<{
|
|
131
|
-
_id: unknown;
|
|
132
|
-
}>, any>>(name: string): ModelType_2;
|
|
133
|
-
<ModelType_3 = mongoose.Model<any, {}, {}, {}, any, any>>(): ModelType_3;
|
|
134
|
-
};
|
|
135
|
-
modifiedPaths: (options?: {
|
|
136
|
-
includeChildren?: boolean;
|
|
137
|
-
}) => string[];
|
|
138
|
-
overwrite: (obj: mongoose.AnyObject) => import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
139
|
-
$parent: () => mongoose.Document<any, any, any>;
|
|
140
|
-
populate: {
|
|
141
|
-
<Paths_1 = {}>(path: string | mongoose.PopulateOptions | (string | mongoose.PopulateOptions)[]): Promise<mongoose.MergeType<import("../models/LoanBroker.model").ILoanBrokerDoc, Paths_1>>;
|
|
142
|
-
<Paths_2 = {}>(path: string, select?: string | mongoose.AnyObject, model?: mongoose.Model<any, {}, {}, {}, any, any>, match?: mongoose.AnyObject, options?: mongoose.PopulateOptions): Promise<mongoose.MergeType<import("../models/LoanBroker.model").ILoanBrokerDoc, Paths_2>>;
|
|
143
|
-
};
|
|
144
|
-
populated: (path: string) => any;
|
|
145
|
-
replaceOne: (replacement?: mongoose.AnyObject, options?: mongoose.QueryOptions<unknown>) => mongoose.Query<any, import("../models/LoanBroker.model").ILoanBrokerDoc, {}, import("../models/LoanBroker.model").ILoanBrokerDoc, "find">;
|
|
146
|
-
save: (options?: mongoose.SaveOptions) => Promise<import("../models/LoanBroker.model").ILoanBrokerDoc>;
|
|
147
|
-
schema: mongoose.FlattenMaps<mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
|
|
148
|
-
[x: string]: unknown;
|
|
149
|
-
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
150
|
-
[x: string]: unknown;
|
|
151
|
-
}>> & mongoose.FlatRecord<{
|
|
152
|
-
[x: string]: unknown;
|
|
153
|
-
}> & Required<{
|
|
154
|
-
_id: unknown;
|
|
155
|
-
}>>>;
|
|
156
|
-
set: {
|
|
157
|
-
<T_8 extends string | number | symbol>(path: T_8, val: any, type: any, options?: mongoose.DocumentSetOptions): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
158
|
-
(path: string | Record<string, any>, val: any, type: any, options?: mongoose.DocumentSetOptions): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
159
|
-
(path: string | Record<string, any>, val: any, options?: mongoose.DocumentSetOptions): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
160
|
-
(value: string | Record<string, any>): import("../models/LoanBroker.model").ILoanBrokerDoc;
|
|
161
|
-
};
|
|
162
|
-
toJSON: {
|
|
163
|
-
<T_9 = any>(options?: mongoose.ToObjectOptions<mongoose.Document<unknown, {}, unknown> & Required<{
|
|
164
|
-
_id: unknown;
|
|
165
|
-
}>> & {
|
|
166
|
-
flattenMaps?: true;
|
|
167
|
-
}): mongoose.FlattenMaps<T_9>;
|
|
168
|
-
<T_10 = any>(options: mongoose.ToObjectOptions<mongoose.Document<unknown, {}, unknown> & Required<{
|
|
169
|
-
_id: unknown;
|
|
170
|
-
}>> & {
|
|
171
|
-
flattenMaps: false;
|
|
172
|
-
}): T_10;
|
|
173
|
-
};
|
|
174
|
-
toObject: <T_11 = any>(options?: mongoose.ToObjectOptions<mongoose.Document<unknown, {}, unknown> & Required<{
|
|
175
|
-
_id: unknown;
|
|
176
|
-
}>>) => mongoose.Require_id<T_11>;
|
|
177
|
-
unmarkModified: {
|
|
178
|
-
<T_12 extends string | number | symbol>(path: T_12): void;
|
|
179
|
-
(path: string): void;
|
|
180
|
-
};
|
|
181
|
-
updateOne: (update?: mongoose.UpdateWithAggregationPipeline | mongoose.UpdateQuery<import("../models/LoanBroker.model").ILoanBrokerDoc>, options?: mongoose.QueryOptions<unknown>) => mongoose.Query<any, import("../models/LoanBroker.model").ILoanBrokerDoc, {}, import("../models/LoanBroker.model").ILoanBrokerDoc, "find">;
|
|
182
|
-
validate: {
|
|
183
|
-
<T_13 extends string | number | symbol>(pathsToValidate?: T_13 | T_13[], options?: mongoose.AnyObject): Promise<void>;
|
|
184
|
-
(pathsToValidate?: mongoose.PathsToValidate, options?: mongoose.AnyObject): Promise<void>;
|
|
185
|
-
(options: {
|
|
186
|
-
pathsToSkip?: mongoose.pathsToSkip;
|
|
187
|
-
}): Promise<void>;
|
|
188
|
-
};
|
|
189
|
-
validateSync: {
|
|
190
|
-
(options: {
|
|
191
|
-
[k: string]: any;
|
|
192
|
-
pathsToSkip?: mongoose.pathsToSkip;
|
|
193
|
-
}): mongoose.Error.ValidationError;
|
|
194
|
-
<T_14 extends string | number | symbol>(pathsToValidate?: T_14 | T_14[], options?: mongoose.AnyObject): mongoose.Error.ValidationError;
|
|
195
|
-
(pathsToValidate?: mongoose.PathsToValidate, options?: mongoose.AnyObject): mongoose.Error.ValidationError;
|
|
196
|
-
};
|
|
197
43
|
}[]>;
|
|
198
|
-
export declare const getBrokerProducts: (loanBrokerId: string) => Promise<
|
|
199
|
-
_id: mongoose.Types.ObjectId;
|
|
200
|
-
}>)[]>;
|
|
44
|
+
export declare const getBrokerProducts: (loanBrokerId: string) => Promise<IProductBrokerLean[]>;
|
package/db/brokers.db.js
CHANGED
|
@@ -11,7 +11,7 @@ const reports_db_1 = require("./reports.db");
|
|
|
11
11
|
const ProductBroker_model_1 = require("../models/ProductBroker.model");
|
|
12
12
|
const LoanBroker_model_1 = require("../models/LoanBroker.model");
|
|
13
13
|
const getProductBrokers = async (productId) => {
|
|
14
|
-
return ProductBroker_model_1.
|
|
14
|
+
return ProductBroker_model_1.ProductBroker.aggregate([
|
|
15
15
|
{
|
|
16
16
|
'$match': {
|
|
17
17
|
'productId': new mongoose_1.default.Types.ObjectId(productId),
|
|
@@ -63,21 +63,21 @@ const enrichWithBrokers = async (transactions, product) => {
|
|
|
63
63
|
};
|
|
64
64
|
exports.enrichWithBrokers = enrichWithBrokers;
|
|
65
65
|
const getBorrowerBrokers = async (borrowerId) => {
|
|
66
|
-
return ProductBroker_model_1.
|
|
66
|
+
return ProductBroker_model_1.ProductBroker
|
|
67
67
|
.find({ borrowerId }, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
68
68
|
.sort({ order: 1 })
|
|
69
69
|
.lean();
|
|
70
70
|
};
|
|
71
71
|
exports.getBorrowerBrokers = getBorrowerBrokers;
|
|
72
72
|
const getAllProductBrokers = async () => {
|
|
73
|
-
return ProductBroker_model_1.
|
|
73
|
+
return ProductBroker_model_1.ProductBroker
|
|
74
74
|
.find({}, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
75
75
|
.sort({ order: 1 })
|
|
76
76
|
.lean();
|
|
77
77
|
};
|
|
78
78
|
exports.getAllProductBrokers = getAllProductBrokers;
|
|
79
79
|
const getAllLoanBrokers = async () => {
|
|
80
|
-
const results = await LoanBroker_model_1.
|
|
80
|
+
const results = await LoanBroker_model_1.LoanBroker
|
|
81
81
|
.find({}, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
82
82
|
.sort({ order: 1 })
|
|
83
83
|
.lean();
|
|
@@ -88,7 +88,7 @@ const getAllLoanBrokers = async () => {
|
|
|
88
88
|
};
|
|
89
89
|
exports.getAllLoanBrokers = getAllLoanBrokers;
|
|
90
90
|
const getBrokerProducts = async (loanBrokerId) => {
|
|
91
|
-
return ProductBroker_model_1.
|
|
91
|
+
return ProductBroker_model_1.ProductBroker
|
|
92
92
|
.find({ loanBrokerId }, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
93
93
|
.sort({ order: 1, BSCode: 1, PLCode: 1 })
|
|
94
94
|
.lean();
|
package/db/brokers.db.ts
CHANGED
|
@@ -4,11 +4,11 @@ import mongoose from 'mongoose';
|
|
|
4
4
|
import { MODEL_NAMES } from '../models/_models';
|
|
5
5
|
import { EChargeType, ILedgerDataRow } from './reports.db';
|
|
6
6
|
import { ILoanProductDoc } from '../models/LoanProducts.model';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { IProductBrokerDocWithLoanBroker, IProductBrokerLean, ProductBroker } from '../models/ProductBroker.model';
|
|
8
|
+
import { ILoanBrokerLean, LoanBroker } from '../models/LoanBroker.model';
|
|
9
9
|
|
|
10
10
|
export const getProductBrokers = async (productId: string) => {
|
|
11
|
-
return
|
|
11
|
+
return ProductBroker.aggregate<IProductBrokerDocWithLoanBroker>([
|
|
12
12
|
{
|
|
13
13
|
'$match': {
|
|
14
14
|
'productId': new mongoose.Types.ObjectId(productId),
|
|
@@ -38,7 +38,7 @@ export const enrichWithBrokers = async (transactions: ILedgerDataRow[], product:
|
|
|
38
38
|
if (productBrokers.length === 0) {
|
|
39
39
|
return transactions;
|
|
40
40
|
}
|
|
41
|
-
const handleFee = (t: ILedgerDataRow, broker:
|
|
41
|
+
const handleFee = (t: ILedgerDataRow, broker: IProductBrokerDocWithLoanBroker, shareName: 'adminShare' | 'interestShare' | 'otherShare'): ILedgerDataRow => {
|
|
42
42
|
return {
|
|
43
43
|
...t,
|
|
44
44
|
statementAmount: new Decimal(-t.statementAmount).mul(broker[shareName]).toDP(2).toNumber(),
|
|
@@ -50,9 +50,9 @@ export const enrichWithBrokers = async (transactions: ILedgerDataRow[], product:
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const handlers = {
|
|
53
|
-
[EChargeType.ADMIN_FEE]: (t: ILedgerDataRow, broker:
|
|
54
|
-
[EChargeType.INTEREST_FEE]: (t: ILedgerDataRow, broker:
|
|
55
|
-
[EChargeType.OTHER]: (t: ILedgerDataRow, broker:
|
|
53
|
+
[EChargeType.ADMIN_FEE]: (t: ILedgerDataRow, broker: IProductBrokerDocWithLoanBroker) => handleFee(t, broker, 'adminShare'),
|
|
54
|
+
[EChargeType.INTEREST_FEE]: (t: ILedgerDataRow, broker: IProductBrokerDocWithLoanBroker) => handleFee(t, broker, 'interestShare'),
|
|
55
|
+
[EChargeType.OTHER]: (t: ILedgerDataRow, broker: IProductBrokerDocWithLoanBroker) => handleFee(t, broker, 'otherShare'),
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
return transactions.reduce((acc, t) => {
|
|
@@ -62,24 +62,24 @@ export const enrichWithBrokers = async (transactions: ILedgerDataRow[], product:
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export const getBorrowerBrokers = async (borrowerId: string) => {
|
|
65
|
-
return
|
|
65
|
+
return ProductBroker
|
|
66
66
|
.find({ borrowerId }, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
67
67
|
.sort({ order: 1 })
|
|
68
|
-
.lean();
|
|
68
|
+
.lean<IProductBrokerLean[]>();
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export const getAllProductBrokers = async () => {
|
|
72
|
-
return
|
|
72
|
+
return ProductBroker
|
|
73
73
|
.find({}, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
74
74
|
.sort({ order: 1 })
|
|
75
|
-
.lean();
|
|
75
|
+
.lean<IProductBrokerLean[]>();
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export const getAllLoanBrokers = async () => {
|
|
79
|
-
const results = await
|
|
79
|
+
const results = await LoanBroker
|
|
80
80
|
.find({}, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
81
81
|
.sort({ order: 1 })
|
|
82
|
-
.lean();
|
|
82
|
+
.lean<ILoanBrokerLean[]>();
|
|
83
83
|
return results.map((result) => ({
|
|
84
84
|
...result,
|
|
85
85
|
emails: result.emails ?? [],
|
|
@@ -87,8 +87,8 @@ export const getAllLoanBrokers = async () => {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
export const getBrokerProducts = async (loanBrokerId: string) => {
|
|
90
|
-
return
|
|
90
|
+
return ProductBroker
|
|
91
91
|
.find({ loanBrokerId }, { createdAt: 0, updatedAt: 0, __v: 0 })
|
|
92
92
|
.sort({ order: 1, BSCode: 1, PLCode: 1 })
|
|
93
|
-
.lean();
|
|
93
|
+
.lean<IProductBrokerLean[]>();
|
|
94
94
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="mongoose/types/types" />
|
|
2
|
-
/// <reference types="mongoose/types/document" />
|
|
3
2
|
/// <reference types="mongoose/types/models" />
|
|
3
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
4
4
|
/// <reference types="mongoose/types/utility" />
|
|
5
|
+
/// <reference types="mongoose/types/document" />
|
|
5
6
|
/// <reference types="mongoose/types/aggregate" />
|
|
6
7
|
/// <reference types="mongoose/types/callback" />
|
|
7
8
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -26,69 +27,42 @@
|
|
|
26
27
|
/// <reference types="mongoose/types/validation" />
|
|
27
28
|
/// <reference types="mongoose/types/virtuals" />
|
|
28
29
|
/// <reference types="mongoose/types/inferschematype" />
|
|
29
|
-
import mongoose
|
|
30
|
+
import mongoose from 'mongoose';
|
|
30
31
|
import Joi from 'joi';
|
|
31
32
|
export declare const LoanBrokerValidationSchema: Joi.ObjectSchema<any>;
|
|
32
33
|
export interface ILoanBrokerEmail {
|
|
33
|
-
|
|
34
|
+
uiId: string;
|
|
34
35
|
email: string;
|
|
35
36
|
title: string;
|
|
36
37
|
isActive: boolean;
|
|
37
38
|
}
|
|
39
|
+
export interface ILoanBrokerEmailLean extends ILoanBrokerEmail {
|
|
40
|
+
_id: mongoose.Types.ObjectId;
|
|
41
|
+
}
|
|
42
|
+
export interface ILoanBrokerEmailPlain extends ILoanBrokerEmail {
|
|
43
|
+
_id: string;
|
|
44
|
+
}
|
|
38
45
|
export interface ILoanBroker {
|
|
46
|
+
uiId: string;
|
|
39
47
|
order: number;
|
|
40
48
|
active: boolean;
|
|
41
49
|
name: string;
|
|
42
50
|
emails: ILoanBrokerEmail[];
|
|
43
51
|
}
|
|
44
|
-
export interface
|
|
52
|
+
export interface ILoanBrokerLean extends ILoanBroker {
|
|
45
53
|
_id: mongoose.Types.ObjectId;
|
|
54
|
+
createdAt: Date;
|
|
55
|
+
updatedAt: Date;
|
|
46
56
|
}
|
|
47
|
-
export
|
|
48
|
-
|
|
57
|
+
export interface ILoanBrokerPlain extends Omit<ILoanBroker, 'emails'> {
|
|
58
|
+
_id: string;
|
|
59
|
+
emails: ILoanBrokerEmailPlain[];
|
|
60
|
+
createdAt: Date;
|
|
61
|
+
updatedAt: Date;
|
|
49
62
|
}
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
}, {
|
|
53
|
-
createdAt: NativeDate;
|
|
54
|
-
updatedAt: NativeDate;
|
|
55
|
-
} & {
|
|
56
|
-
name: string;
|
|
57
|
-
order: number;
|
|
58
|
-
active: boolean;
|
|
59
|
-
emails: mongoose.Types.DocumentArray<{
|
|
60
|
-
email: string;
|
|
61
|
-
title: string;
|
|
62
|
-
isActive: boolean;
|
|
63
|
-
}>;
|
|
64
|
-
__v?: number;
|
|
65
|
-
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
66
|
-
createdAt: NativeDate;
|
|
67
|
-
updatedAt: NativeDate;
|
|
68
|
-
} & {
|
|
69
|
-
name: string;
|
|
70
|
-
order: number;
|
|
71
|
-
active: boolean;
|
|
72
|
-
emails: mongoose.Types.DocumentArray<{
|
|
73
|
-
email: string;
|
|
74
|
-
title: string;
|
|
75
|
-
isActive: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
__v?: number;
|
|
78
|
-
}>> & mongoose.FlatRecord<{
|
|
79
|
-
createdAt: NativeDate;
|
|
80
|
-
updatedAt: NativeDate;
|
|
81
|
-
} & {
|
|
82
|
-
name: string;
|
|
83
|
-
order: number;
|
|
84
|
-
active: boolean;
|
|
85
|
-
emails: mongoose.Types.DocumentArray<{
|
|
86
|
-
email: string;
|
|
87
|
-
title: string;
|
|
88
|
-
isActive: boolean;
|
|
89
|
-
}>;
|
|
90
|
-
__v?: number;
|
|
91
|
-
}> & {
|
|
63
|
+
export type TLoanBrokerDoc = mongoose.HydratedDocument<ILoanBroker>;
|
|
64
|
+
export type LoanBrokerModel = mongoose.Model<ILoanBroker>;
|
|
65
|
+
export declare const LoanBrokerSchema: mongoose.Schema<ILoanBroker, LoanBrokerModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ILoanBroker, mongoose.Document<unknown, {}, mongoose.FlatRecord<ILoanBroker>> & mongoose.FlatRecord<ILoanBroker> & {
|
|
92
66
|
_id: mongoose.Types.ObjectId;
|
|
93
67
|
}>;
|
|
94
|
-
export declare const
|
|
68
|
+
export declare const LoanBroker: LoanBrokerModel;
|
|
@@ -3,18 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.LoanBroker = exports.LoanBrokerSchema = exports.LoanBrokerValidationSchema = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const joi_1 = __importDefault(require("joi"));
|
|
9
9
|
const _models_1 = require("./_models");
|
|
10
10
|
exports.LoanBrokerValidationSchema = joi_1.default.object({
|
|
11
11
|
_id: joi_1.default.string().allow(null),
|
|
12
|
+
uiId: joi_1.default.string(),
|
|
12
13
|
order: joi_1.default.number(),
|
|
13
14
|
active: joi_1.default.boolean().required(),
|
|
14
15
|
name: joi_1.default.string().required(),
|
|
15
16
|
emails: joi_1.default.array(),
|
|
16
17
|
});
|
|
17
18
|
exports.LoanBrokerSchema = new mongoose_1.default.Schema({
|
|
19
|
+
uiId: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
trim: true,
|
|
23
|
+
},
|
|
18
24
|
order: {
|
|
19
25
|
type: Number,
|
|
20
26
|
required: true,
|
|
@@ -29,6 +35,11 @@ exports.LoanBrokerSchema = new mongoose_1.default.Schema({
|
|
|
29
35
|
trim: true,
|
|
30
36
|
},
|
|
31
37
|
emails: [{
|
|
38
|
+
uiId: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
trim: true,
|
|
42
|
+
},
|
|
32
43
|
email: {
|
|
33
44
|
type: String,
|
|
34
45
|
required: true,
|
|
@@ -44,6 +55,8 @@ exports.LoanBrokerSchema = new mongoose_1.default.Schema({
|
|
|
44
55
|
required: true,
|
|
45
56
|
},
|
|
46
57
|
}],
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
}, {
|
|
59
|
+
timestamps: { createdAt: true, updatedAt: true },
|
|
60
|
+
versionKey: false,
|
|
61
|
+
});
|
|
62
|
+
exports.LoanBroker = mongoose_1.default.model(_models_1.MODEL_NAMES.loanBrokers, exports.LoanBrokerSchema);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import mongoose
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
2
|
import Joi from 'joi';
|
|
3
3
|
|
|
4
4
|
import { MODEL_NAMES } from './_models';
|
|
5
5
|
|
|
6
6
|
export const LoanBrokerValidationSchema = Joi.object({
|
|
7
7
|
_id: Joi.string().allow(null),
|
|
8
|
+
uiId: Joi.string(),
|
|
8
9
|
order: Joi.number(),
|
|
9
10
|
active: Joi.boolean().required(),
|
|
10
11
|
name: Joi.string().required(),
|
|
@@ -12,30 +13,52 @@ export const LoanBrokerValidationSchema = Joi.object({
|
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
export interface ILoanBrokerEmail {
|
|
15
|
-
|
|
16
|
+
uiId: string;
|
|
16
17
|
email: string,
|
|
17
18
|
title: string,
|
|
18
19
|
isActive: boolean
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
export interface ILoanBrokerEmailLean extends ILoanBrokerEmail {
|
|
23
|
+
_id: mongoose.Types.ObjectId;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ILoanBrokerEmailPlain extends ILoanBrokerEmail {
|
|
27
|
+
_id: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
export interface ILoanBroker {
|
|
31
|
+
uiId: string;
|
|
22
32
|
order: number;
|
|
23
33
|
active: boolean;
|
|
24
34
|
name: string;
|
|
25
35
|
emails: ILoanBrokerEmail[];
|
|
26
36
|
}
|
|
27
37
|
|
|
28
|
-
export interface
|
|
38
|
+
export interface ILoanBrokerLean extends ILoanBroker {
|
|
29
39
|
_id: mongoose.Types.ObjectId;
|
|
40
|
+
createdAt: Date;
|
|
41
|
+
updatedAt: Date;
|
|
30
42
|
}
|
|
31
43
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
export interface ILoanBrokerPlain extends Omit<ILoanBroker, 'emails'> {
|
|
45
|
+
_id: string;
|
|
46
|
+
emails: ILoanBrokerEmailPlain[];
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
updatedAt: Date;
|
|
35
49
|
}
|
|
36
50
|
|
|
37
|
-
export
|
|
51
|
+
export type TLoanBrokerDoc = mongoose.HydratedDocument<ILoanBroker>
|
|
52
|
+
|
|
53
|
+
export type LoanBrokerModel = mongoose.Model<ILoanBroker>;
|
|
54
|
+
|
|
55
|
+
export const LoanBrokerSchema = new mongoose.Schema<ILoanBroker, LoanBrokerModel>(
|
|
38
56
|
{
|
|
57
|
+
uiId: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
trim: true,
|
|
61
|
+
},
|
|
39
62
|
order: {
|
|
40
63
|
type: Number,
|
|
41
64
|
required: true,
|
|
@@ -50,6 +73,11 @@ export const LoanBrokerSchema = new mongoose.Schema(
|
|
|
50
73
|
trim: true,
|
|
51
74
|
},
|
|
52
75
|
emails: [{
|
|
76
|
+
uiId: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: true,
|
|
79
|
+
trim: true,
|
|
80
|
+
},
|
|
53
81
|
email: {
|
|
54
82
|
type: String,
|
|
55
83
|
required: true,
|
|
@@ -65,9 +93,11 @@ export const LoanBrokerSchema = new mongoose.Schema(
|
|
|
65
93
|
required: true,
|
|
66
94
|
},
|
|
67
95
|
}],
|
|
68
|
-
__v: { type: Number, select: false },
|
|
69
96
|
},
|
|
70
|
-
{
|
|
97
|
+
{
|
|
98
|
+
timestamps: { createdAt: true, updatedAt: true },
|
|
99
|
+
versionKey: false,
|
|
100
|
+
},
|
|
71
101
|
);
|
|
72
102
|
|
|
73
|
-
export const
|
|
103
|
+
export const LoanBroker = mongoose.model<ILoanBroker, LoanBrokerModel>(MODEL_NAMES.loanBrokers, LoanBrokerSchema);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="mongoose/types/types" />
|
|
2
|
-
/// <reference types="mongoose/types/document" />
|
|
3
2
|
/// <reference types="mongoose/types/models" />
|
|
4
3
|
/// <reference types="mongoose/types/utility" />
|
|
4
|
+
/// <reference types="mongoose/types/document" />
|
|
5
5
|
/// <reference types="mongoose/types/aggregate" />
|
|
6
6
|
/// <reference types="mongoose/types/callback" />
|
|
7
7
|
/// <reference types="mongoose/types/collection" />
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
/// <reference types="mongoose/types/inferschematype" />
|
|
29
29
|
import mongoose from 'mongoose';
|
|
30
30
|
import Joi from 'joi';
|
|
31
|
-
import {
|
|
31
|
+
import { ILoanBrokerLean } from './LoanBroker.model';
|
|
32
32
|
export declare const ProductBrokerValidationSchema: Joi.ObjectSchema<any>;
|
|
33
33
|
export interface IProductBroker {
|
|
34
|
+
uiId: string;
|
|
34
35
|
order: number;
|
|
35
36
|
borrowerId: mongoose.Types.ObjectId;
|
|
36
37
|
active: boolean;
|
|
@@ -42,11 +43,7 @@ export interface IProductBroker {
|
|
|
42
43
|
adminShare: number;
|
|
43
44
|
otherShare: number;
|
|
44
45
|
}
|
|
45
|
-
export
|
|
46
|
-
_id: mongoose.Types.ObjectId;
|
|
47
|
-
createdAt: Date;
|
|
48
|
-
updatedAt: Date;
|
|
49
|
-
}
|
|
46
|
+
export type TProductBrokerDoc = mongoose.HydratedDocument<IProductBroker>;
|
|
50
47
|
export interface IProductBrokerLean extends IProductBroker {
|
|
51
48
|
_id: mongoose.Types.ObjectId;
|
|
52
49
|
createdAt: Date;
|
|
@@ -58,8 +55,8 @@ export interface IProductBrokerPlain extends Omit<IProductBroker, 'borrowerId' |
|
|
|
58
55
|
loanBrokerId: string;
|
|
59
56
|
productId: string;
|
|
60
57
|
}
|
|
61
|
-
export interface
|
|
62
|
-
loanBroker:
|
|
58
|
+
export interface IProductBrokerDocWithLoanBroker extends TProductBrokerDoc {
|
|
59
|
+
loanBroker: ILoanBrokerLean;
|
|
63
60
|
}
|
|
64
61
|
export type IProductBrokerView = Omit<IProductBrokerLean, 'borrowerId' | 'order'>;
|
|
65
62
|
export type TProductBrokerModel = mongoose.Model<IProductBroker>;
|
|
@@ -69,13 +66,14 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
69
66
|
createdAt: NativeDate;
|
|
70
67
|
updatedAt: NativeDate;
|
|
71
68
|
} & {
|
|
72
|
-
|
|
73
|
-
productId: mongoose.Types.ObjectId;
|
|
69
|
+
uiId: string;
|
|
74
70
|
order: number;
|
|
71
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
75
72
|
active: boolean;
|
|
76
|
-
PLCode: string;
|
|
77
73
|
loanBrokerId: mongoose.Types.ObjectId;
|
|
78
74
|
BSCode: string;
|
|
75
|
+
PLCode: string;
|
|
76
|
+
productId: mongoose.Types.ObjectId;
|
|
79
77
|
interestShare: number;
|
|
80
78
|
adminShare: number;
|
|
81
79
|
otherShare: number;
|
|
@@ -84,13 +82,14 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
84
82
|
createdAt: NativeDate;
|
|
85
83
|
updatedAt: NativeDate;
|
|
86
84
|
} & {
|
|
87
|
-
|
|
88
|
-
productId: mongoose.Types.ObjectId;
|
|
85
|
+
uiId: string;
|
|
89
86
|
order: number;
|
|
87
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
90
88
|
active: boolean;
|
|
91
|
-
PLCode: string;
|
|
92
89
|
loanBrokerId: mongoose.Types.ObjectId;
|
|
93
90
|
BSCode: string;
|
|
91
|
+
PLCode: string;
|
|
92
|
+
productId: mongoose.Types.ObjectId;
|
|
94
93
|
interestShare: number;
|
|
95
94
|
adminShare: number;
|
|
96
95
|
otherShare: number;
|
|
@@ -99,13 +98,14 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
99
98
|
createdAt: NativeDate;
|
|
100
99
|
updatedAt: NativeDate;
|
|
101
100
|
} & {
|
|
102
|
-
|
|
103
|
-
productId: mongoose.Types.ObjectId;
|
|
101
|
+
uiId: string;
|
|
104
102
|
order: number;
|
|
103
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
105
104
|
active: boolean;
|
|
106
|
-
PLCode: string;
|
|
107
105
|
loanBrokerId: mongoose.Types.ObjectId;
|
|
108
106
|
BSCode: string;
|
|
107
|
+
PLCode: string;
|
|
108
|
+
productId: mongoose.Types.ObjectId;
|
|
109
109
|
interestShare: number;
|
|
110
110
|
adminShare: number;
|
|
111
111
|
otherShare: number;
|
|
@@ -113,4 +113,4 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
113
113
|
}> & {
|
|
114
114
|
_id: mongoose.Types.ObjectId;
|
|
115
115
|
}>;
|
|
116
|
-
export declare const
|
|
116
|
+
export declare const ProductBroker: TProductBrokerModel;
|