gemcap-be-common 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/availability.db.d.ts +29 -2
- package/db/availability.db.js +1 -72
- package/db/availability.db.ts +1 -75
- package/interfaces/auth-user.interface.d.ts +7 -0
- package/interfaces/auth-user.interface.ts +8 -0
- package/models/AccountPayableItem.model.d.ts +3 -3
- package/models/AvailabilitySigns.model.d.ts +13 -0
- package/models/AvailabilitySigns.model.ts +15 -0
- package/models/BBCSheet.model.d.ts +4 -4
- package/models/BBCSheet.model.js +1 -2
- package/models/BBCSheet.model.ts +2 -3
- package/models/BorrowerCompliance.model.d.ts +3 -3
- package/models/BorrowerCompliance.model.js +1 -2
- package/models/BorrowerCompliance.model.ts +1 -2
- package/models/Globals.model.d.ts +4 -4
- package/models/Globals.model.js +1 -2
- package/models/Globals.model.ts +2 -3
- package/models/InventoryItem.model.d.ts +3 -3
- package/models/LoanStatementTransaction.model.d.ts +10 -10
- package/models/LoanStatementTransaction.model.js +1 -2
- package/models/LoanStatementTransaction.model.ts +2 -3
- package/models/LoanTransaction.model.d.ts +1 -1
- package/models/LoanTransaction.model.js +1 -2
- package/models/LoanTransaction.model.ts +2 -3
- package/models/MicroserviceTask.model.d.ts +4 -4
- package/models/MicroserviceTask.model.js +1 -2
- package/models/MicroserviceTask.model.ts +2 -3
- package/models/QueryResult.model.d.ts +1 -1
- package/models/QueryResult.model.js +1 -2
- package/models/QueryResult.model.ts +2 -3
- package/models/ReceivableAvailability.model.d.ts +4 -4
- package/models/ReceivableAvailability.model.js +1 -2
- package/models/ReceivableAvailability.model.ts +2 -3
- package/models/TransactionAttachedFile.Model.d.ts +7 -7
- package/models/TransactionAttachedFile.Model.js +1 -2
- package/models/TransactionAttachedFile.Model.ts +2 -3
- package/models/Underwriter.model.d.ts +1 -1
- package/models/Underwriter.model.js +1 -2
- package/models/Underwriter.model.ts +2 -3
- package/models/UploadedFile.model.d.ts +4 -4
- package/models/UploadedFile.model.js +1 -2
- package/models/UploadedFile.model.ts +2 -3
- package/models/UserLog.model.d.ts +1 -1
- package/models/UserLog.model.js +1 -2
- package/models/UserLog.model.ts +2 -3
- package/package.json +1 -1
- package/services/attached-files.service.js +1 -1
- package/services/attached-files.service.ts +1 -1
- package/services/availability.service.js +3 -4
- package/services/availability.service.ts +3 -4
- package/services/brokers.service.d.ts +2 -2
- package/services/compliance-borrowers.service.d.ts +1 -1
- package/services/compliance-borrowers.service.js +4 -4
- package/services/compliance-borrowers.service.ts +5 -5
- package/services/loan-payments.service.js +4 -4
- package/services/loan-payments.service.ts +4 -4
- package/services/loan-statement.service.d.ts +1 -1
- package/services/loan-transactions.service.d.ts +1 -1
- package/services/loan-transactions.service.js +2 -2
- package/services/loan-transactions.service.ts +2 -2
- package/services/signs.service.d.ts +1 -0
- package/services/signs.service.js +19 -2
- package/services/signs.service.ts +20 -2
- package/services/uploads.service.js +1 -1
- package/services/uploads.service.ts +1 -1
- package/services/users.service.d.ts +10 -9
- package/services/users.service.js +10 -3
- package/services/users.service.ts +21 -13
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -28,7 +28,7 @@ import { EMicroserviceTaskStatuses } from '../enums/microservice-task-statuses.e
|
|
|
28
28
|
export interface IMicroserviceTask {
|
|
29
29
|
cmd: EMicroserviceTask;
|
|
30
30
|
params: any;
|
|
31
|
-
userId:
|
|
31
|
+
userId: string;
|
|
32
32
|
status: EMicroserviceTaskStatuses;
|
|
33
33
|
executeAt: Date;
|
|
34
34
|
}
|
|
@@ -42,9 +42,9 @@ export declare const MicroserviceTaskSchema: mongoose.Schema<any, mongoose.Model
|
|
|
42
42
|
} & {
|
|
43
43
|
cmd: string;
|
|
44
44
|
params: any;
|
|
45
|
+
userId?: string;
|
|
45
46
|
__v?: number;
|
|
46
47
|
status?: string;
|
|
47
|
-
userId?: mongoose.Types.ObjectId;
|
|
48
48
|
executeAt?: Date;
|
|
49
49
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
50
50
|
createdAt: NativeDate;
|
|
@@ -52,9 +52,9 @@ export declare const MicroserviceTaskSchema: mongoose.Schema<any, mongoose.Model
|
|
|
52
52
|
} & {
|
|
53
53
|
cmd: string;
|
|
54
54
|
params: any;
|
|
55
|
+
userId?: string;
|
|
55
56
|
__v?: number;
|
|
56
57
|
status?: string;
|
|
57
|
-
userId?: mongoose.Types.ObjectId;
|
|
58
58
|
executeAt?: Date;
|
|
59
59
|
}>> & mongoose.FlatRecord<{
|
|
60
60
|
createdAt: NativeDate;
|
|
@@ -62,9 +62,9 @@ export declare const MicroserviceTaskSchema: mongoose.Schema<any, mongoose.Model
|
|
|
62
62
|
} & {
|
|
63
63
|
cmd: string;
|
|
64
64
|
params: any;
|
|
65
|
+
userId?: string;
|
|
65
66
|
__v?: number;
|
|
66
67
|
status?: string;
|
|
67
|
-
userId?: mongoose.Types.ObjectId;
|
|
68
68
|
executeAt?: Date;
|
|
69
69
|
}> & {
|
|
70
70
|
_id: mongoose.Types.ObjectId;
|
|
@@ -9,7 +9,7 @@ const mongooseLeanId = require('../plugins/id.plugin');
|
|
|
9
9
|
export interface IMicroserviceTask {
|
|
10
10
|
cmd: EMicroserviceTask;
|
|
11
11
|
params: any;
|
|
12
|
-
userId:
|
|
12
|
+
userId: string;
|
|
13
13
|
status: EMicroserviceTaskStatuses;
|
|
14
14
|
executeAt: Date;
|
|
15
15
|
}
|
|
@@ -28,8 +28,7 @@ export const MicroserviceTaskSchema = new mongoose.Schema(
|
|
|
28
28
|
required: true,
|
|
29
29
|
},
|
|
30
30
|
userId: {
|
|
31
|
-
type:
|
|
32
|
-
ref: MODEL_NAMES.users,
|
|
31
|
+
type: String,
|
|
33
32
|
},
|
|
34
33
|
status: {
|
|
35
34
|
type: String,
|
|
@@ -102,7 +102,7 @@ export declare const QUERY_GROUPS: TQueryGroups;
|
|
|
102
102
|
export interface IQueryResult {
|
|
103
103
|
query: string;
|
|
104
104
|
filter: Object;
|
|
105
|
-
userId?:
|
|
105
|
+
userId?: string;
|
|
106
106
|
result: Object;
|
|
107
107
|
}
|
|
108
108
|
export interface IQueryResultDoc extends IQueryResult, Document {
|
|
@@ -187,8 +187,7 @@ exports.QueryResultSchema = new mongoose_1.default.Schema({
|
|
|
187
187
|
},
|
|
188
188
|
filter: mongoose_1.default.Schema.Types.Mixed,
|
|
189
189
|
userId: {
|
|
190
|
-
type:
|
|
191
|
-
ref: _models_1.MODEL_NAMES.users,
|
|
190
|
+
type: String,
|
|
192
191
|
required: false,
|
|
193
192
|
},
|
|
194
193
|
result: mongoose_1.default.Schema.Types.Mixed,
|
|
@@ -215,7 +215,7 @@ export const QUERY_GROUPS: TQueryGroups = {
|
|
|
215
215
|
export interface IQueryResult {
|
|
216
216
|
query: string;
|
|
217
217
|
filter: Object;
|
|
218
|
-
userId?:
|
|
218
|
+
userId?: string;
|
|
219
219
|
result: Object;
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -232,8 +232,7 @@ export const QueryResultSchema = new mongoose.Schema<IQueryResult, TQueryResultM
|
|
|
232
232
|
},
|
|
233
233
|
filter: mongoose.Schema.Types.Mixed,
|
|
234
234
|
userId: {
|
|
235
|
-
type:
|
|
236
|
-
ref: MODEL_NAMES.users,
|
|
235
|
+
type: String,
|
|
237
236
|
required: false,
|
|
238
237
|
},
|
|
239
238
|
result: mongoose.Schema.Types.Mixed,
|
|
@@ -79,7 +79,7 @@ export interface IReceivableManualSummary {
|
|
|
79
79
|
export interface IReceivableAvailability {
|
|
80
80
|
borrowerId: mongoose.Types.ObjectId;
|
|
81
81
|
bbcDateId: mongoose.Types.ObjectId;
|
|
82
|
-
userCalculatedId:
|
|
82
|
+
userCalculatedId: string;
|
|
83
83
|
calculatedAt: Date;
|
|
84
84
|
actual: boolean;
|
|
85
85
|
settings?: IAvailabilitySettings;
|
|
@@ -211,7 +211,7 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
211
211
|
ARAvailability: number;
|
|
212
212
|
};
|
|
213
213
|
actual?: boolean;
|
|
214
|
-
userCalculatedId?:
|
|
214
|
+
userCalculatedId?: string;
|
|
215
215
|
calculatedAt?: Date;
|
|
216
216
|
settings?: {
|
|
217
217
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
@@ -271,7 +271,7 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
271
271
|
ARAvailability: number;
|
|
272
272
|
};
|
|
273
273
|
actual?: boolean;
|
|
274
|
-
userCalculatedId?:
|
|
274
|
+
userCalculatedId?: string;
|
|
275
275
|
calculatedAt?: Date;
|
|
276
276
|
settings?: {
|
|
277
277
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
@@ -331,7 +331,7 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
331
331
|
ARAvailability: number;
|
|
332
332
|
};
|
|
333
333
|
actual?: boolean;
|
|
334
|
-
userCalculatedId?:
|
|
334
|
+
userCalculatedId?: string;
|
|
335
335
|
calculatedAt?: Date;
|
|
336
336
|
settings?: {
|
|
337
337
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
@@ -108,8 +108,7 @@ exports.AvailabilitySchema = new mongoose_1.default.Schema({
|
|
|
108
108
|
required: true,
|
|
109
109
|
},
|
|
110
110
|
userCalculatedId: {
|
|
111
|
-
type:
|
|
112
|
-
ref: _models_1.MODEL_NAMES.users,
|
|
111
|
+
type: String,
|
|
113
112
|
required: false,
|
|
114
113
|
},
|
|
115
114
|
calculatedAt: {
|
|
@@ -66,7 +66,7 @@ export interface IReceivableManualSummary {
|
|
|
66
66
|
export interface IReceivableAvailability {
|
|
67
67
|
borrowerId: mongoose.Types.ObjectId;
|
|
68
68
|
bbcDateId: mongoose.Types.ObjectId;
|
|
69
|
-
userCalculatedId:
|
|
69
|
+
userCalculatedId: string;
|
|
70
70
|
calculatedAt: Date;
|
|
71
71
|
actual: boolean;
|
|
72
72
|
settings?: IAvailabilitySettings;
|
|
@@ -182,8 +182,7 @@ export const AvailabilitySchema = new mongoose.Schema(
|
|
|
182
182
|
required: true,
|
|
183
183
|
},
|
|
184
184
|
userCalculatedId: {
|
|
185
|
-
type:
|
|
186
|
-
ref: MODEL_NAMES.users,
|
|
185
|
+
type: String,
|
|
187
186
|
required: false,
|
|
188
187
|
},
|
|
189
188
|
calculatedAt: {
|
|
@@ -28,7 +28,7 @@ export interface ITransactionAttachedFile {
|
|
|
28
28
|
filename: string;
|
|
29
29
|
originalName: string;
|
|
30
30
|
effectiveDate: string;
|
|
31
|
-
userId:
|
|
31
|
+
userId: string;
|
|
32
32
|
}
|
|
33
33
|
export interface ITransactionAttachedFileDoc extends ITransactionAttachedFile, mongoose.Document {
|
|
34
34
|
}
|
|
@@ -38,32 +38,32 @@ export declare const TransactionAttachedFileSchema: mongoose.Schema<any, mongoos
|
|
|
38
38
|
createdAt: NativeDate;
|
|
39
39
|
updatedAt: NativeDate;
|
|
40
40
|
} & {
|
|
41
|
-
borrowerId: mongoose.Types.ObjectId;
|
|
42
41
|
effectiveDate: string;
|
|
42
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
43
43
|
filename: string;
|
|
44
44
|
originalName: string;
|
|
45
|
+
userId?: string;
|
|
45
46
|
__v?: number;
|
|
46
|
-
userId?: mongoose.Types.ObjectId;
|
|
47
47
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
48
48
|
createdAt: NativeDate;
|
|
49
49
|
updatedAt: NativeDate;
|
|
50
50
|
} & {
|
|
51
|
-
borrowerId: mongoose.Types.ObjectId;
|
|
52
51
|
effectiveDate: string;
|
|
52
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
53
53
|
filename: string;
|
|
54
54
|
originalName: string;
|
|
55
|
+
userId?: string;
|
|
55
56
|
__v?: number;
|
|
56
|
-
userId?: mongoose.Types.ObjectId;
|
|
57
57
|
}>> & mongoose.FlatRecord<{
|
|
58
58
|
createdAt: NativeDate;
|
|
59
59
|
updatedAt: NativeDate;
|
|
60
60
|
} & {
|
|
61
|
-
borrowerId: mongoose.Types.ObjectId;
|
|
62
61
|
effectiveDate: string;
|
|
62
|
+
borrowerId: mongoose.Types.ObjectId;
|
|
63
63
|
filename: string;
|
|
64
64
|
originalName: string;
|
|
65
|
+
userId?: string;
|
|
65
66
|
__v?: number;
|
|
66
|
-
userId?: mongoose.Types.ObjectId;
|
|
67
67
|
}> & {
|
|
68
68
|
_id: mongoose.Types.ObjectId;
|
|
69
69
|
}>;
|
|
@@ -28,8 +28,7 @@ exports.TransactionAttachedFileSchema = new mongoose_1.default.Schema({
|
|
|
28
28
|
trim: true,
|
|
29
29
|
},
|
|
30
30
|
userId: {
|
|
31
|
-
type:
|
|
32
|
-
ref: _models_1.MODEL_NAMES.users,
|
|
31
|
+
type: String,
|
|
33
32
|
required: false,
|
|
34
33
|
},
|
|
35
34
|
__v: { type: Number, select: false },
|
|
@@ -7,7 +7,7 @@ export interface ITransactionAttachedFile {
|
|
|
7
7
|
filename: string;
|
|
8
8
|
originalName: string;
|
|
9
9
|
effectiveDate: string;
|
|
10
|
-
userId:
|
|
10
|
+
userId: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface ITransactionAttachedFileDoc extends ITransactionAttachedFile, mongoose.Document {
|
|
@@ -36,8 +36,7 @@ export const TransactionAttachedFileSchema = new mongoose.Schema(
|
|
|
36
36
|
trim: true,
|
|
37
37
|
},
|
|
38
38
|
userId: {
|
|
39
|
-
type:
|
|
40
|
-
ref: MODEL_NAMES.users,
|
|
39
|
+
type: String,
|
|
41
40
|
required: false,
|
|
42
41
|
},
|
|
43
42
|
__v: { type: Number, select: false },
|
|
@@ -8,7 +8,7 @@ export interface IUnderwriter {
|
|
|
8
8
|
name: string;
|
|
9
9
|
email: string;
|
|
10
10
|
order?: number;
|
|
11
|
-
userId?:
|
|
11
|
+
userId?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface IUnderwriterWithId extends IUnderwriter {
|
|
@@ -47,8 +47,7 @@ export const UnderwriterSchema = new mongoose.Schema<IUnderwriter, UnderwriterMo
|
|
|
47
47
|
type: String,
|
|
48
48
|
},
|
|
49
49
|
userId: {
|
|
50
|
-
type:
|
|
51
|
-
ref: MODEL_NAMES.users,
|
|
50
|
+
type: String,
|
|
52
51
|
required: false,
|
|
53
52
|
},
|
|
54
53
|
},
|
|
@@ -28,7 +28,7 @@ export interface IUploadedFile {
|
|
|
28
28
|
filename: string;
|
|
29
29
|
originalName: string;
|
|
30
30
|
borrowerId: mongoose.Types.ObjectId;
|
|
31
|
-
userId:
|
|
31
|
+
userId: string;
|
|
32
32
|
converted?: boolean;
|
|
33
33
|
type: EUploadTypes;
|
|
34
34
|
}
|
|
@@ -42,9 +42,9 @@ export declare const UploadedFileSchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
42
42
|
} & {
|
|
43
43
|
type: string;
|
|
44
44
|
converted: boolean;
|
|
45
|
+
userId?: string;
|
|
45
46
|
__v?: number;
|
|
46
47
|
borrowerId?: mongoose.Types.ObjectId;
|
|
47
|
-
userId?: mongoose.Types.ObjectId;
|
|
48
48
|
filename?: string;
|
|
49
49
|
originalName?: string;
|
|
50
50
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
@@ -53,9 +53,9 @@ export declare const UploadedFileSchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
53
53
|
} & {
|
|
54
54
|
type: string;
|
|
55
55
|
converted: boolean;
|
|
56
|
+
userId?: string;
|
|
56
57
|
__v?: number;
|
|
57
58
|
borrowerId?: mongoose.Types.ObjectId;
|
|
58
|
-
userId?: mongoose.Types.ObjectId;
|
|
59
59
|
filename?: string;
|
|
60
60
|
originalName?: string;
|
|
61
61
|
}>> & mongoose.FlatRecord<{
|
|
@@ -64,9 +64,9 @@ export declare const UploadedFileSchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
64
64
|
} & {
|
|
65
65
|
type: string;
|
|
66
66
|
converted: boolean;
|
|
67
|
+
userId?: string;
|
|
67
68
|
__v?: number;
|
|
68
69
|
borrowerId?: mongoose.Types.ObjectId;
|
|
69
|
-
userId?: mongoose.Types.ObjectId;
|
|
70
70
|
filename?: string;
|
|
71
71
|
originalName?: string;
|
|
72
72
|
}> & {
|
|
@@ -9,7 +9,7 @@ export interface IUploadedFile {
|
|
|
9
9
|
filename: string;
|
|
10
10
|
originalName: string;
|
|
11
11
|
borrowerId: mongoose.Types.ObjectId;
|
|
12
|
-
userId:
|
|
12
|
+
userId: string;
|
|
13
13
|
converted?: boolean;
|
|
14
14
|
type: EUploadTypes;
|
|
15
15
|
}
|
|
@@ -35,8 +35,7 @@ export const UploadedFileSchema = new mongoose.Schema(
|
|
|
35
35
|
required: false,
|
|
36
36
|
},
|
|
37
37
|
userId: {
|
|
38
|
-
type:
|
|
39
|
-
ref: MODEL_NAMES.users,
|
|
38
|
+
type: String,
|
|
40
39
|
required: false,
|
|
41
40
|
},
|
|
42
41
|
converted: {
|
|
@@ -46,7 +46,7 @@ export declare enum ELogActionType {
|
|
|
46
46
|
export interface IUserLog {
|
|
47
47
|
_id?: mongoose.Types.ObjectId;
|
|
48
48
|
logType: ELogType;
|
|
49
|
-
userId:
|
|
49
|
+
userId: string;
|
|
50
50
|
timestamp: Date;
|
|
51
51
|
action: ELogActionType;
|
|
52
52
|
recordId: mongoose.Types.ObjectId;
|
package/models/UserLog.model.js
CHANGED
package/models/UserLog.model.ts
CHANGED
|
@@ -27,7 +27,7 @@ export enum ELogActionType {
|
|
|
27
27
|
export interface IUserLog {
|
|
28
28
|
_id?: mongoose.Types.ObjectId;
|
|
29
29
|
logType: ELogType;
|
|
30
|
-
userId:
|
|
30
|
+
userId: string;
|
|
31
31
|
timestamp: Date;
|
|
32
32
|
action: ELogActionType;
|
|
33
33
|
recordId: mongoose.Types.ObjectId;
|
|
@@ -49,8 +49,7 @@ export const UserLogSchema = new mongoose.Schema<IUserLog, UserLogModel>(
|
|
|
49
49
|
required: true,
|
|
50
50
|
},
|
|
51
51
|
userId: {
|
|
52
|
-
type:
|
|
53
|
-
ref: MODEL_NAMES.users,
|
|
52
|
+
type: String,
|
|
54
53
|
required: true,
|
|
55
54
|
},
|
|
56
55
|
timestamp: {
|
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@ class AttachedFilesService {
|
|
|
68
68
|
}
|
|
69
69
|
async createAttachedFile(file, userId, effectiveDate, borrowerId) {
|
|
70
70
|
const newFile = {
|
|
71
|
-
userId
|
|
71
|
+
userId,
|
|
72
72
|
filename: file.filename,
|
|
73
73
|
originalName: file.originalName,
|
|
74
74
|
effectiveDate,
|
|
@@ -89,7 +89,7 @@ export class AttachedFilesService {
|
|
|
89
89
|
originalName: string
|
|
90
90
|
}, userId: string, effectiveDate: string, borrowerId: string) {
|
|
91
91
|
const newFile: ITransactionAttachedFile = {
|
|
92
|
-
userId
|
|
92
|
+
userId,
|
|
93
93
|
filename: file.filename,
|
|
94
94
|
originalName: file.originalName,
|
|
95
95
|
effectiveDate,
|
|
@@ -17,7 +17,6 @@ const ReceivableAvailabilityItem_model_1 = require("../models/ReceivableAvailabi
|
|
|
17
17
|
const collaterals_db_1 = require("../db/collaterals.db");
|
|
18
18
|
const _models_1 = require("../models/_models");
|
|
19
19
|
const receivables_db_1 = require("../db/receivables.db");
|
|
20
|
-
const availability_db_1 = require("../db/availability.db");
|
|
21
20
|
const bbcSheets_db_1 = require("../db/bbcSheets.db");
|
|
22
21
|
const CustomerGroup_model_1 = require("../models/CustomerGroup.model");
|
|
23
22
|
const partially_paid_restated_1 = require("../queries/receivable/partially-paid-restated");
|
|
@@ -91,7 +90,7 @@ class AvailabilityService {
|
|
|
91
90
|
const calculation = {
|
|
92
91
|
borrowerId: null,
|
|
93
92
|
bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId),
|
|
94
|
-
userCalculatedId: user?.id ?
|
|
93
|
+
userCalculatedId: user?.id ? user.id : null,
|
|
95
94
|
calculatedAt: new Date(),
|
|
96
95
|
actual: true,
|
|
97
96
|
settings: calculationsSettings,
|
|
@@ -589,7 +588,7 @@ class AvailabilityService {
|
|
|
589
588
|
},
|
|
590
589
|
{
|
|
591
590
|
$lookup: {
|
|
592
|
-
from:
|
|
591
|
+
from: _models_1.MODEL_NAMES.users,
|
|
593
592
|
localField: 'userCalculatedId',
|
|
594
593
|
foreignField: '_id',
|
|
595
594
|
as: 'userCalculated',
|
|
@@ -883,7 +882,7 @@ class AvailabilityService {
|
|
|
883
882
|
};
|
|
884
883
|
}
|
|
885
884
|
async isBBCEditable(bbcDateId) {
|
|
886
|
-
const availabilitiesSigns = await
|
|
885
|
+
const availabilitiesSigns = await this.signsService.getAvailabilitiesSigns([bbcDateId]);
|
|
887
886
|
if (!availabilitiesSigns.length) {
|
|
888
887
|
return true;
|
|
889
888
|
}
|
|
@@ -29,7 +29,6 @@ import { getCollateralDocsByBBC, ITEMS_PAGINATION } from '../db/collaterals.db';
|
|
|
29
29
|
import { IAvailabilitySignView } from '../models/AvailabilitySigns.model';
|
|
30
30
|
import { MODEL_NAMES } from '../models/_models';
|
|
31
31
|
import { setReceivableManualInputsToggle } from '../db/receivables.db';
|
|
32
|
-
import { getAvailabilitySigns } from '../db/availability.db';
|
|
33
32
|
import { IInventoryAvailabilitySummary, InventoryAvailabilityPaginators } from '../models/InventoryAvailability.model';
|
|
34
33
|
import { getBBCSheetsByType } from '../db/bbcSheets.db';
|
|
35
34
|
import { CustomerGroupModel } from '../models/CustomerGroup.model';
|
|
@@ -160,7 +159,7 @@ export class AvailabilityService {
|
|
|
160
159
|
const calculation: IReceivableAvailability = {
|
|
161
160
|
borrowerId: null,
|
|
162
161
|
bbcDateId: new mongoose.Types.ObjectId(bbcDateId),
|
|
163
|
-
userCalculatedId: user?.id ?
|
|
162
|
+
userCalculatedId: user?.id ? user.id : null,
|
|
164
163
|
calculatedAt: new Date(),
|
|
165
164
|
actual: true,
|
|
166
165
|
settings: calculationsSettings,
|
|
@@ -704,7 +703,7 @@ export class AvailabilityService {
|
|
|
704
703
|
},
|
|
705
704
|
{
|
|
706
705
|
$lookup: {
|
|
707
|
-
from:
|
|
706
|
+
from: MODEL_NAMES.users,
|
|
708
707
|
localField: 'userCalculatedId',
|
|
709
708
|
foreignField: '_id',
|
|
710
709
|
as: 'userCalculated',
|
|
@@ -1019,7 +1018,7 @@ export class AvailabilityService {
|
|
|
1019
1018
|
}
|
|
1020
1019
|
|
|
1021
1020
|
async isBBCEditable(bbcDateId: string): Promise<boolean> {
|
|
1022
|
-
const availabilitiesSigns = await
|
|
1021
|
+
const availabilitiesSigns = await this.signsService.getAvailabilitiesSigns([bbcDateId]);
|
|
1023
1022
|
if (!availabilitiesSigns.length) {
|
|
1024
1023
|
return true;
|
|
1025
1024
|
}
|
|
@@ -46,9 +46,9 @@ export declare class BrokersService {
|
|
|
46
46
|
getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
47
47
|
_id: import("mongoose").Types.ObjectId;
|
|
48
48
|
})[]>;
|
|
49
|
-
getBorrowerBrokers(borrowerId: string): Promise<
|
|
49
|
+
getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
50
50
|
_id: import("mongoose").Types.ObjectId;
|
|
51
|
-
})[]>;
|
|
51
|
+
})[] | BrokerView[]>;
|
|
52
52
|
getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
|
|
53
53
|
getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
|
|
54
54
|
getTotals(borrowerId: string): Promise<BrokerTotalView[]>;
|
|
@@ -44,7 +44,7 @@ export declare class ComplianceBorrowersService {
|
|
|
44
44
|
tooltip: string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
getFullComplianceBorrowerById(complianceBorrowerId:
|
|
47
|
+
getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
|
|
48
48
|
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "borrower" | "fundingStatus" | "items"> | {
|
|
49
49
|
items: {
|
|
50
50
|
instances: any[];
|
|
@@ -75,10 +75,10 @@ class ComplianceBorrowersService {
|
|
|
75
75
|
path: 'items',
|
|
76
76
|
populate: { path: 'item', model: 'complianceItems' },
|
|
77
77
|
})
|
|
78
|
-
.populate({
|
|
79
|
-
path: 'items',
|
|
80
|
-
populate: { path: 'instances.files.uploadedBy', model:
|
|
81
|
-
|
|
78
|
+
// .populate({
|
|
79
|
+
// path: 'items',
|
|
80
|
+
// populate: { path: 'instances.files.uploadedBy', model: MODEL_NAMES.users },
|
|
81
|
+
// }) // TODO remove this when we have a better way to handle users
|
|
82
82
|
.transform((borrower) => ({ ...borrower, plaidAccessToken: borrower?.plaidAccessToken ?? false }))
|
|
83
83
|
.lean();
|
|
84
84
|
if (!ourBorrower.borrower) {
|
|
@@ -76,7 +76,7 @@ export class ComplianceBorrowersService {
|
|
|
76
76
|
return { progress, score };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
async getFullComplianceBorrowerById(complianceBorrowerId): Promise<any> {
|
|
79
|
+
async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any> {
|
|
80
80
|
if (!complianceBorrowerId) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
@@ -87,10 +87,10 @@ export class ComplianceBorrowersService {
|
|
|
87
87
|
path: 'items',
|
|
88
88
|
populate: { path: 'item', model: 'complianceItems' },
|
|
89
89
|
})
|
|
90
|
-
.populate({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
})
|
|
90
|
+
// .populate({
|
|
91
|
+
// path: 'items',
|
|
92
|
+
// populate: { path: 'instances.files.uploadedBy', model: MODEL_NAMES.users },
|
|
93
|
+
// }) // TODO remove this when we have a better way to handle users
|
|
94
94
|
.transform((borrower) => ({ ...borrower, plaidAccessToken: borrower?.plaidAccessToken ?? false }))
|
|
95
95
|
.lean() as IComplianceBorrowerDocumentFull;
|
|
96
96
|
if (!ourBorrower.borrower) {
|
|
@@ -214,7 +214,7 @@ class LoanPaymentsService {
|
|
|
214
214
|
productId: new mongoose_1.default.Types.ObjectId(productId),
|
|
215
215
|
reference: `${borrower.code} - STATEMENT PAID`,
|
|
216
216
|
transactionType: LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION,
|
|
217
|
-
userId
|
|
217
|
+
userId,
|
|
218
218
|
};
|
|
219
219
|
transaction.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(transaction);
|
|
220
220
|
const newTransaction = await this.loanTransactionsService.createLoanTransaction(transaction);
|
|
@@ -355,7 +355,7 @@ class LoanPaymentsService {
|
|
|
355
355
|
productId: revolverProduct._id,
|
|
356
356
|
reference: `${product.type} STATEMENT ADDED TO LOAN`,
|
|
357
357
|
transactionType: LoanTransaction_model_1.ELoanTransactionTypes.DISBURSEMENT,
|
|
358
|
-
userId
|
|
358
|
+
userId,
|
|
359
359
|
};
|
|
360
360
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
361
361
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|
|
@@ -373,7 +373,7 @@ class LoanPaymentsService {
|
|
|
373
373
|
productId: revolverProduct._id,
|
|
374
374
|
reference: `OVERPAYMENT OF STATEMENT`,
|
|
375
375
|
transactionType: LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION,
|
|
376
|
-
userId
|
|
376
|
+
userId,
|
|
377
377
|
};
|
|
378
378
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
379
379
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|
|
@@ -388,7 +388,7 @@ class LoanPaymentsService {
|
|
|
388
388
|
productId: new mongoose_1.default.Types.ObjectId(p.productId),
|
|
389
389
|
reference: `EXTRA PAYMENT REF`,
|
|
390
390
|
transactionType: LoanTransaction_model_1.ELoanTransactionTypes.COLLECTION,
|
|
391
|
-
userId
|
|
391
|
+
userId,
|
|
392
392
|
};
|
|
393
393
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
394
394
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|
|
@@ -249,7 +249,7 @@ export class LoanPaymentsService {
|
|
|
249
249
|
productId: new mongoose.Types.ObjectId(productId),
|
|
250
250
|
reference: `${borrower.code} - STATEMENT PAID`,
|
|
251
251
|
transactionType: ELoanTransactionTypes.COLLECTION,
|
|
252
|
-
userId
|
|
252
|
+
userId,
|
|
253
253
|
};
|
|
254
254
|
transaction.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(transaction);
|
|
255
255
|
const newTransaction = await this.loanTransactionsService.createLoanTransaction(transaction);
|
|
@@ -399,7 +399,7 @@ export class LoanPaymentsService {
|
|
|
399
399
|
productId: revolverProduct._id,
|
|
400
400
|
reference: `${product.type} STATEMENT ADDED TO LOAN`,
|
|
401
401
|
transactionType: ELoanTransactionTypes.DISBURSEMENT,
|
|
402
|
-
userId
|
|
402
|
+
userId,
|
|
403
403
|
};
|
|
404
404
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
405
405
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|
|
@@ -418,7 +418,7 @@ export class LoanPaymentsService {
|
|
|
418
418
|
productId: revolverProduct._id,
|
|
419
419
|
reference: `OVERPAYMENT OF STATEMENT`,
|
|
420
420
|
transactionType: ELoanTransactionTypes.COLLECTION,
|
|
421
|
-
userId
|
|
421
|
+
userId,
|
|
422
422
|
};
|
|
423
423
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
424
424
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|
|
@@ -434,7 +434,7 @@ export class LoanPaymentsService {
|
|
|
434
434
|
productId: new mongoose.Types.ObjectId(p.productId),
|
|
435
435
|
reference: `EXTRA PAYMENT REF`,
|
|
436
436
|
transactionType: ELoanTransactionTypes.COLLECTION,
|
|
437
|
-
userId
|
|
437
|
+
userId,
|
|
438
438
|
};
|
|
439
439
|
newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
|
|
440
440
|
await this.loanTransactionsService.createLoanTransaction(newTransactions);
|