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.
Files changed (69) hide show
  1. package/db/availability.db.d.ts +29 -2
  2. package/db/availability.db.js +1 -72
  3. package/db/availability.db.ts +1 -75
  4. package/interfaces/auth-user.interface.d.ts +7 -0
  5. package/interfaces/auth-user.interface.ts +8 -0
  6. package/models/AccountPayableItem.model.d.ts +3 -3
  7. package/models/AvailabilitySigns.model.d.ts +13 -0
  8. package/models/AvailabilitySigns.model.ts +15 -0
  9. package/models/BBCSheet.model.d.ts +4 -4
  10. package/models/BBCSheet.model.js +1 -2
  11. package/models/BBCSheet.model.ts +2 -3
  12. package/models/BorrowerCompliance.model.d.ts +3 -3
  13. package/models/BorrowerCompliance.model.js +1 -2
  14. package/models/BorrowerCompliance.model.ts +1 -2
  15. package/models/Globals.model.d.ts +4 -4
  16. package/models/Globals.model.js +1 -2
  17. package/models/Globals.model.ts +2 -3
  18. package/models/InventoryItem.model.d.ts +3 -3
  19. package/models/LoanStatementTransaction.model.d.ts +10 -10
  20. package/models/LoanStatementTransaction.model.js +1 -2
  21. package/models/LoanStatementTransaction.model.ts +2 -3
  22. package/models/LoanTransaction.model.d.ts +1 -1
  23. package/models/LoanTransaction.model.js +1 -2
  24. package/models/LoanTransaction.model.ts +2 -3
  25. package/models/MicroserviceTask.model.d.ts +4 -4
  26. package/models/MicroserviceTask.model.js +1 -2
  27. package/models/MicroserviceTask.model.ts +2 -3
  28. package/models/QueryResult.model.d.ts +1 -1
  29. package/models/QueryResult.model.js +1 -2
  30. package/models/QueryResult.model.ts +2 -3
  31. package/models/ReceivableAvailability.model.d.ts +4 -4
  32. package/models/ReceivableAvailability.model.js +1 -2
  33. package/models/ReceivableAvailability.model.ts +2 -3
  34. package/models/TransactionAttachedFile.Model.d.ts +7 -7
  35. package/models/TransactionAttachedFile.Model.js +1 -2
  36. package/models/TransactionAttachedFile.Model.ts +2 -3
  37. package/models/Underwriter.model.d.ts +1 -1
  38. package/models/Underwriter.model.js +1 -2
  39. package/models/Underwriter.model.ts +2 -3
  40. package/models/UploadedFile.model.d.ts +4 -4
  41. package/models/UploadedFile.model.js +1 -2
  42. package/models/UploadedFile.model.ts +2 -3
  43. package/models/UserLog.model.d.ts +1 -1
  44. package/models/UserLog.model.js +1 -2
  45. package/models/UserLog.model.ts +2 -3
  46. package/package.json +1 -1
  47. package/services/attached-files.service.js +1 -1
  48. package/services/attached-files.service.ts +1 -1
  49. package/services/availability.service.js +3 -4
  50. package/services/availability.service.ts +3 -4
  51. package/services/brokers.service.d.ts +2 -2
  52. package/services/compliance-borrowers.service.d.ts +1 -1
  53. package/services/compliance-borrowers.service.js +4 -4
  54. package/services/compliance-borrowers.service.ts +5 -5
  55. package/services/loan-payments.service.js +4 -4
  56. package/services/loan-payments.service.ts +4 -4
  57. package/services/loan-statement.service.d.ts +1 -1
  58. package/services/loan-transactions.service.d.ts +1 -1
  59. package/services/loan-transactions.service.js +2 -2
  60. package/services/loan-transactions.service.ts +2 -2
  61. package/services/signs.service.d.ts +1 -0
  62. package/services/signs.service.js +19 -2
  63. package/services/signs.service.ts +20 -2
  64. package/services/uploads.service.js +1 -1
  65. package/services/uploads.service.ts +1 -1
  66. package/services/users.service.d.ts +10 -9
  67. package/services/users.service.js +10 -3
  68. package/services/users.service.ts +21 -13
  69. 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: mongoose.Types.ObjectId;
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;
@@ -17,8 +17,7 @@ exports.MicroserviceTaskSchema = new mongoose_1.default.Schema({
17
17
  required: true,
18
18
  },
19
19
  userId: {
20
- type: mongoose_1.default.Schema.Types.ObjectId,
21
- ref: _models_1.MODEL_NAMES.users,
20
+ type: String,
22
21
  },
23
22
  status: {
24
23
  type: String,
@@ -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: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
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?: mongoose.Types.ObjectId;
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: mongoose_1.default.Schema.Types.ObjectId,
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?: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
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?: mongoose.Types.ObjectId;
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?: mongoose.Types.ObjectId;
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?: mongoose.Types.ObjectId;
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: mongoose_1.default.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
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: mongoose_1.default.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
40
- ref: MODEL_NAMES.users,
39
+ type: String,
41
40
  required: false,
42
41
  },
43
42
  __v: { type: Number, select: false },
@@ -29,7 +29,7 @@ export interface IUnderwriter {
29
29
  name: string;
30
30
  email: string;
31
31
  order?: number;
32
- userId?: mongoose.Types.ObjectId;
32
+ userId?: string;
33
33
  }
34
34
  export interface IUnderwriterWithId extends IUnderwriter {
35
35
  _id: string;
@@ -32,8 +32,7 @@ exports.UnderwriterSchema = new mongoose_1.default.Schema({
32
32
  type: String,
33
33
  },
34
34
  userId: {
35
- type: mongoose_1.default.Schema.Types.ObjectId,
36
- ref: _models_1.MODEL_NAMES.users,
35
+ type: String,
37
36
  required: false,
38
37
  },
39
38
  }, {
@@ -8,7 +8,7 @@ export interface IUnderwriter {
8
8
  name: string;
9
9
  email: string;
10
10
  order?: number;
11
- userId?: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
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
  }> & {
@@ -24,8 +24,7 @@ exports.UploadedFileSchema = new mongoose_1.default.Schema({
24
24
  required: false,
25
25
  },
26
26
  userId: {
27
- type: mongoose_1.default.Schema.Types.ObjectId,
28
- ref: _models_1.MODEL_NAMES.users,
27
+ type: String,
29
28
  required: false,
30
29
  },
31
30
  converted: {
@@ -9,7 +9,7 @@ export interface IUploadedFile {
9
9
  filename: string;
10
10
  originalName: string;
11
11
  borrowerId: mongoose.Types.ObjectId;
12
- userId: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
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: mongoose.Types.ObjectId;
49
+ userId: string;
50
50
  timestamp: Date;
51
51
  action: ELogActionType;
52
52
  recordId: mongoose.Types.ObjectId;
@@ -35,8 +35,7 @@ exports.UserLogSchema = new mongoose_1.default.Schema({
35
35
  required: true,
36
36
  },
37
37
  userId: {
38
- type: mongoose_1.default.Schema.Types.ObjectId,
39
- ref: _models_1.MODEL_NAMES.users,
38
+ type: String,
40
39
  required: true,
41
40
  },
42
41
  timestamp: {
@@ -27,7 +27,7 @@ export enum ELogActionType {
27
27
  export interface IUserLog {
28
28
  _id?: mongoose.Types.ObjectId;
29
29
  logType: ELogType;
30
- userId: mongoose.Types.ObjectId;
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: mongoose.Schema.Types.ObjectId,
53
- ref: MODEL_NAMES.users,
52
+ type: String,
54
53
  required: true,
55
54
  },
56
55
  timestamp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -68,7 +68,7 @@ class AttachedFilesService {
68
68
  }
69
69
  async createAttachedFile(file, userId, effectiveDate, borrowerId) {
70
70
  const newFile = {
71
- userId: new mongoose_1.default.Types.ObjectId(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: new mongoose.Types.ObjectId(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 ? new mongoose_1.default.Types.ObjectId(String(user.id)) : null,
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: 'users',
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 (0, availability_db_1.getAvailabilitySigns)([bbcDateId]);
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 ? new mongoose.Types.ObjectId(String(user.id)) : null,
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: 'users',
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 getAvailabilitySigns([bbcDateId]);
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<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
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: any): Promise<any>;
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: 'users' },
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
- path: 'items',
92
- populate: { path: 'instances.files.uploadedBy', model: 'users' },
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: new mongoose_1.default.Types.ObjectId(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: new mongoose_1.default.Types.ObjectId(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: new mongoose_1.default.Types.ObjectId(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: new mongoose_1.default.Types.ObjectId(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: new mongoose.Types.ObjectId(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: new mongoose.Types.ObjectId(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: new mongoose.Types.ObjectId(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: new mongoose.Types.ObjectId(userId),
437
+ userId,
438
438
  };
439
439
  newTransactions.effectiveDate = await this.loanTransactionsService.calculateEffectiveDate(newTransactions);
440
440
  await this.loanTransactionsService.createLoanTransaction(newTransactions);
@@ -112,7 +112,7 @@ export declare class LoanStatementService {
112
112
  isSystem: boolean;
113
113
  memo: string;
114
114
  settlementCode?: string;
115
- userId?: import("mongoose").Types.ObjectId;
115
+ userId?: string;
116
116
  isEditable?: boolean;
117
117
  _id?: any;
118
118
  __v?: any;