gemcap-be-common 1.4.255 → 1.4.257

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.
@@ -47,11 +47,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
47
47
  bbcDateId: mongoose.Types.ObjectId;
48
48
  dataType: string;
49
49
  __v?: number;
50
+ comment?: string;
50
51
  uploadUser?: string;
51
52
  fileHash?: string;
52
53
  fileName?: string;
53
54
  sheetName?: string;
54
- comment?: string;
55
55
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
56
56
  createdAt: NativeDate;
57
57
  updatedAt: NativeDate;
@@ -59,11 +59,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
59
59
  bbcDateId: mongoose.Types.ObjectId;
60
60
  dataType: string;
61
61
  __v?: number;
62
+ comment?: string;
62
63
  uploadUser?: string;
63
64
  fileHash?: string;
64
65
  fileName?: string;
65
66
  sheetName?: string;
66
- comment?: string;
67
67
  }>> & mongoose.FlatRecord<{
68
68
  createdAt: NativeDate;
69
69
  updatedAt: NativeDate;
@@ -71,11 +71,11 @@ export declare const BBCSheetSchema: mongoose.Schema<any, mongoose.Model<any, an
71
71
  bbcDateId: mongoose.Types.ObjectId;
72
72
  dataType: string;
73
73
  __v?: number;
74
+ comment?: string;
74
75
  uploadUser?: string;
75
76
  fileHash?: string;
76
77
  fileName?: string;
77
78
  sheetName?: string;
78
- comment?: string;
79
79
  }> & {
80
80
  _id: mongoose.Types.ObjectId;
81
81
  }>;
@@ -91,13 +91,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
91
91
  user?: string;
92
92
  }>;
93
93
  mainEmails: mongoose.Types.DocumentArray<{
94
- email?: string;
95
94
  title?: string;
95
+ email?: string;
96
96
  isActive?: boolean;
97
97
  }>;
98
98
  financialEmails: mongoose.Types.DocumentArray<{
99
- email?: string;
100
99
  title?: string;
100
+ email?: string;
101
101
  isActive?: boolean;
102
102
  }>;
103
103
  items: mongoose.Types.DocumentArray<{
@@ -105,8 +105,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
105
105
  updatedAt: NativeDate;
106
106
  } & {
107
107
  emailAddresses: mongoose.Types.DocumentArray<{
108
- email?: string;
109
108
  title?: string;
109
+ email?: string;
110
110
  isActive?: boolean;
111
111
  }>;
112
112
  instances: mongoose.Types.DocumentArray<{
@@ -128,6 +128,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
128
128
  startDate?: Date;
129
129
  frequency?: string;
130
130
  }>;
131
+ __v?: number;
131
132
  isVisible?: boolean;
132
133
  email?: string;
133
134
  isEmailingActive?: boolean;
@@ -135,7 +136,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
135
136
  plaidAccessToken?: string;
136
137
  fundingStatus?: string;
137
138
  lastEmailSentAt?: Date;
138
- __v?: number;
139
139
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
140
140
  createdAt: NativeDate;
141
141
  updatedAt: NativeDate;
@@ -152,13 +152,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
152
152
  user?: string;
153
153
  }>;
154
154
  mainEmails: mongoose.Types.DocumentArray<{
155
- email?: string;
156
155
  title?: string;
156
+ email?: string;
157
157
  isActive?: boolean;
158
158
  }>;
159
159
  financialEmails: mongoose.Types.DocumentArray<{
160
- email?: string;
161
160
  title?: string;
161
+ email?: string;
162
162
  isActive?: boolean;
163
163
  }>;
164
164
  items: mongoose.Types.DocumentArray<{
@@ -166,8 +166,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
166
166
  updatedAt: NativeDate;
167
167
  } & {
168
168
  emailAddresses: mongoose.Types.DocumentArray<{
169
- email?: string;
170
169
  title?: string;
170
+ email?: string;
171
171
  isActive?: boolean;
172
172
  }>;
173
173
  instances: mongoose.Types.DocumentArray<{
@@ -189,6 +189,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
189
189
  startDate?: Date;
190
190
  frequency?: string;
191
191
  }>;
192
+ __v?: number;
192
193
  isVisible?: boolean;
193
194
  email?: string;
194
195
  isEmailingActive?: boolean;
@@ -196,7 +197,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
196
197
  plaidAccessToken?: string;
197
198
  fundingStatus?: string;
198
199
  lastEmailSentAt?: Date;
199
- __v?: number;
200
200
  }>> & mongoose.FlatRecord<{
201
201
  createdAt: NativeDate;
202
202
  updatedAt: NativeDate;
@@ -213,13 +213,13 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
213
213
  user?: string;
214
214
  }>;
215
215
  mainEmails: mongoose.Types.DocumentArray<{
216
- email?: string;
217
216
  title?: string;
217
+ email?: string;
218
218
  isActive?: boolean;
219
219
  }>;
220
220
  financialEmails: mongoose.Types.DocumentArray<{
221
- email?: string;
222
221
  title?: string;
222
+ email?: string;
223
223
  isActive?: boolean;
224
224
  }>;
225
225
  items: mongoose.Types.DocumentArray<{
@@ -227,8 +227,8 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
227
227
  updatedAt: NativeDate;
228
228
  } & {
229
229
  emailAddresses: mongoose.Types.DocumentArray<{
230
- email?: string;
231
230
  title?: string;
231
+ email?: string;
232
232
  isActive?: boolean;
233
233
  }>;
234
234
  instances: mongoose.Types.DocumentArray<{
@@ -250,6 +250,7 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
250
250
  startDate?: Date;
251
251
  frequency?: string;
252
252
  }>;
253
+ __v?: number;
253
254
  isVisible?: boolean;
254
255
  email?: string;
255
256
  isEmailingActive?: boolean;
@@ -257,7 +258,6 @@ export declare const BorrowerComplianceSchema: mongoose.Schema<any, mongoose.Mod
257
258
  plaidAccessToken?: string;
258
259
  fundingStatus?: string;
259
260
  lastEmailSentAt?: Date;
260
- __v?: number;
261
261
  }> & {
262
262
  _id: mongoose.Types.ObjectId;
263
263
  }>;
@@ -27,6 +27,7 @@ export interface IBorrowerDataOption {
27
27
  order: number;
28
28
  name: string;
29
29
  type: string;
30
+ isActive: boolean;
30
31
  }
31
32
  interface IBorrowerDataOptionDoc extends IBorrowerDataOption, Document {
32
33
  }
@@ -37,14 +38,17 @@ export declare const BorrowerDataOptionSchema: mongoose.Schema<any, mongoose.Mod
37
38
  type: string;
38
39
  name: string;
39
40
  order: number;
41
+ isActive?: boolean;
40
42
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
41
43
  type: string;
42
44
  name: string;
43
45
  order: number;
46
+ isActive?: boolean;
44
47
  }>> & mongoose.FlatRecord<{
45
48
  type: string;
46
49
  name: string;
47
50
  order: number;
51
+ isActive?: boolean;
48
52
  }> & {
49
53
  _id: mongoose.Types.ObjectId;
50
54
  }>;
@@ -19,12 +19,15 @@ exports.BorrowerDataOptionSchema = new mongoose_1.default.Schema({
19
19
  type: String,
20
20
  required: true,
21
21
  },
22
+ isActive: {
23
+ type: Boolean,
24
+ },
22
25
  }, { timestamps: false, versionKey: false });
23
- exports.BorrowerDataOptionModel = mongoose_1.default.model('borrower_data_option', exports.BorrowerDataOptionSchema);
26
+ exports.BorrowerDataOptionModel = mongoose_1.default.model(_models_1.MODEL_NAMES.borrowerDataOptions, exports.BorrowerDataOptionSchema);
24
27
  exports.BorrowerDataSchema = new mongoose_1.default.Schema({
25
28
  dataOption: {
26
29
  type: mongoose_1.default.Schema.Types.ObjectId,
27
- ref: 'borrower_data_option',
30
+ ref: _models_1.MODEL_NAMES.borrowerDataOptions,
28
31
  required: true,
29
32
  },
30
33
  dataValue: {
@@ -5,6 +5,7 @@ export interface IBorrowerDataOption {
5
5
  order: number;
6
6
  name: string;
7
7
  type: string;
8
+ isActive: boolean;
8
9
  }
9
10
 
10
11
  interface IBorrowerDataOptionDoc extends IBorrowerDataOption, Document {
@@ -24,11 +25,14 @@ export const BorrowerDataOptionSchema = new mongoose.Schema(
24
25
  type: String,
25
26
  required: true,
26
27
  },
28
+ isActive: {
29
+ type: Boolean,
30
+ },
27
31
  },
28
32
  { timestamps: false, versionKey: false },
29
33
  );
30
34
 
31
- export const BorrowerDataOptionModel: mongoose.Model<IBorrowerDataOptionDoc> = mongoose.model<IBorrowerDataOptionDoc>('borrower_data_option', BorrowerDataOptionSchema);
35
+ export const BorrowerDataOptionModel: mongoose.Model<IBorrowerDataOptionDoc> = mongoose.model<IBorrowerDataOptionDoc>(MODEL_NAMES.borrowerDataOptions, BorrowerDataOptionSchema);
32
36
 
33
37
  export interface IBorrowerData {
34
38
  dataOption: mongoose.Types.ObjectId,
@@ -46,7 +50,7 @@ export const BorrowerDataSchema = new mongoose.Schema(
46
50
  {
47
51
  dataOption: {
48
52
  type: mongoose.Schema.Types.ObjectId,
49
- ref: 'borrower_data_option',
53
+ ref: MODEL_NAMES.borrowerDataOptions,
50
54
  required: true,
51
55
  },
52
56
  dataValue: {
@@ -32,25 +32,25 @@ export declare const CustomerGroupSchema: mongoose.Schema<any, mongoose.Model<an
32
32
  createdAt: NativeDate;
33
33
  updatedAt: NativeDate;
34
34
  } & {
35
- groupName: string;
36
35
  borrowerId: mongoose.Types.ObjectId;
37
36
  items: string[];
37
+ groupName: string;
38
38
  __v?: number;
39
39
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
40
40
  createdAt: NativeDate;
41
41
  updatedAt: NativeDate;
42
42
  } & {
43
- groupName: string;
44
43
  borrowerId: mongoose.Types.ObjectId;
45
44
  items: string[];
45
+ groupName: string;
46
46
  __v?: number;
47
47
  }>> & mongoose.FlatRecord<{
48
48
  createdAt: NativeDate;
49
49
  updatedAt: NativeDate;
50
50
  } & {
51
- groupName: string;
52
51
  borrowerId: mongoose.Types.ObjectId;
53
52
  items: string[];
53
+ groupName: string;
54
54
  __v?: number;
55
55
  }> & {
56
56
  _id: mongoose.Types.ObjectId;
@@ -48,8 +48,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
48
48
  createdAt: NativeDate;
49
49
  updatedAt: NativeDate;
50
50
  } & {
51
- unique: boolean;
52
51
  order: number;
52
+ unique: boolean;
53
53
  inventoryAvailabilityId: mongoose.Types.ObjectId;
54
54
  inventoryId: mongoose.Types.ObjectId;
55
55
  matched: boolean;
@@ -64,8 +64,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
64
64
  createdAt: NativeDate;
65
65
  updatedAt: NativeDate;
66
66
  } & {
67
- unique: boolean;
68
67
  order: number;
68
+ unique: boolean;
69
69
  inventoryAvailabilityId: mongoose.Types.ObjectId;
70
70
  inventoryId: mongoose.Types.ObjectId;
71
71
  matched: boolean;
@@ -80,8 +80,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
80
80
  createdAt: NativeDate;
81
81
  updatedAt: NativeDate;
82
82
  } & {
83
- unique: boolean;
84
83
  order: number;
84
+ unique: boolean;
85
85
  inventoryAvailabilityId: mongoose.Types.ObjectId;
86
86
  inventoryId: mongoose.Types.ObjectId;
87
87
  matched: boolean;
@@ -71,16 +71,17 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
71
71
  createdAt: NativeDate;
72
72
  updatedAt: NativeDate;
73
73
  } & {
74
+ bbcSheetId: mongoose.Types.ObjectId;
75
+ order: number;
74
76
  value: number;
75
77
  skuDate: Date;
76
78
  category: string;
77
79
  sku: string;
78
80
  qty: number;
79
- bbcSheetId: mongoose.Types.ObjectId;
80
- order: number;
81
81
  __v?: number;
82
- expiryDate?: Date;
83
82
  location?: string;
83
+ lotNumber?: string;
84
+ expiryDate?: Date;
84
85
  unitCost?: number;
85
86
  skuDescription1?: string;
86
87
  skuDescription2?: string;
@@ -88,21 +89,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
88
89
  detail1?: string;
89
90
  detail2?: string;
90
91
  detail3?: string;
91
- lotNumber?: string;
92
92
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
93
93
  createdAt: NativeDate;
94
94
  updatedAt: NativeDate;
95
95
  } & {
96
+ bbcSheetId: mongoose.Types.ObjectId;
97
+ order: number;
96
98
  value: number;
97
99
  skuDate: Date;
98
100
  category: string;
99
101
  sku: string;
100
102
  qty: number;
101
- bbcSheetId: mongoose.Types.ObjectId;
102
- order: number;
103
103
  __v?: number;
104
- expiryDate?: Date;
105
104
  location?: string;
105
+ lotNumber?: string;
106
+ expiryDate?: Date;
106
107
  unitCost?: number;
107
108
  skuDescription1?: string;
108
109
  skuDescription2?: string;
@@ -110,21 +111,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
110
111
  detail1?: string;
111
112
  detail2?: string;
112
113
  detail3?: string;
113
- lotNumber?: string;
114
114
  }>> & mongoose.FlatRecord<{
115
115
  createdAt: NativeDate;
116
116
  updatedAt: NativeDate;
117
117
  } & {
118
+ bbcSheetId: mongoose.Types.ObjectId;
119
+ order: number;
118
120
  value: number;
119
121
  skuDate: Date;
120
122
  category: string;
121
123
  sku: string;
122
124
  qty: number;
123
- bbcSheetId: mongoose.Types.ObjectId;
124
- order: number;
125
125
  __v?: number;
126
- expiryDate?: Date;
127
126
  location?: string;
127
+ lotNumber?: string;
128
+ expiryDate?: Date;
128
129
  unitCost?: number;
129
130
  skuDescription1?: string;
130
131
  skuDescription2?: string;
@@ -132,7 +133,6 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
132
133
  detail1?: string;
133
134
  detail2?: string;
134
135
  detail3?: string;
135
- lotNumber?: string;
136
136
  }> & {
137
137
  _id: mongoose.Types.ObjectId;
138
138
  }>;
@@ -52,8 +52,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
52
52
  } & {
53
53
  bbcSheetId: mongoose.Types.ObjectId;
54
54
  order: number;
55
- invoiceDate: Date;
56
55
  invoiceNumber: string;
56
+ invoiceDate: Date;
57
57
  customerTitle: string;
58
58
  invoiceAmount: number;
59
59
  __v?: number;
@@ -68,8 +68,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
68
68
  } & {
69
69
  bbcSheetId: mongoose.Types.ObjectId;
70
70
  order: number;
71
- invoiceDate: Date;
72
71
  invoiceNumber: string;
72
+ invoiceDate: Date;
73
73
  customerTitle: string;
74
74
  invoiceAmount: number;
75
75
  __v?: number;
@@ -84,8 +84,8 @@ export declare const ReceivableItemSchema: mongoose.Schema<any, mongoose.Model<a
84
84
  } & {
85
85
  bbcSheetId: mongoose.Types.ObjectId;
86
86
  order: number;
87
- invoiceDate: Date;
88
87
  invoiceNumber: string;
88
+ invoiceDate: Date;
89
89
  customerTitle: string;
90
90
  invoiceAmount: number;
91
91
  __v?: number;
@@ -31,10 +31,10 @@ export declare const allSchemas: {
31
31
  createdAt: NativeDate;
32
32
  updatedAt: NativeDate;
33
33
  } & {
34
- order: number;
35
- amount: number;
36
34
  bbcSheetId: import("mongoose").Types.ObjectId;
35
+ order: number;
37
36
  apDate: Date;
37
+ amount: number;
38
38
  __v?: number;
39
39
  poNumber?: string;
40
40
  customerName?: string;
@@ -45,10 +45,10 @@ export declare const allSchemas: {
45
45
  createdAt: NativeDate;
46
46
  updatedAt: NativeDate;
47
47
  } & {
48
- order: number;
49
- amount: number;
50
48
  bbcSheetId: import("mongoose").Types.ObjectId;
49
+ order: number;
51
50
  apDate: Date;
51
+ amount: number;
52
52
  __v?: number;
53
53
  poNumber?: string;
54
54
  customerName?: string;
@@ -59,10 +59,10 @@ export declare const allSchemas: {
59
59
  createdAt: NativeDate;
60
60
  updatedAt: NativeDate;
61
61
  } & {
62
- order: number;
63
- amount: number;
64
62
  bbcSheetId: import("mongoose").Types.ObjectId;
63
+ order: number;
65
64
  apDate: Date;
65
+ amount: number;
66
66
  __v?: number;
67
67
  poNumber?: string;
68
68
  customerName?: string;
@@ -33,6 +33,7 @@ export declare const MODEL_NAMES: {
33
33
  borrowerDataInsurances: string;
34
34
  borrowerDataInventories: string;
35
35
  borrowerDataLocations: string;
36
+ borrowerDataOptions: string;
36
37
  borrowerDataReceivables: string;
37
38
  borrowerDataTerms: string;
38
39
  borrowerSettings: string;
package/models/_models.js CHANGED
@@ -36,6 +36,7 @@ exports.MODEL_NAMES = {
36
36
  borrowerDataInsurances: 'borrower_data_insurances',
37
37
  borrowerDataInventories: 'borrower_data_inventories',
38
38
  borrowerDataLocations: 'borrower_data_locations',
39
+ borrowerDataOptions: 'borrower_data_options',
39
40
  borrowerDataReceivables: 'borrower_data_receivables',
40
41
  borrowerDataTerms: 'borrower_data_terms',
41
42
  borrowerSettings: 'borrowerSettings',
package/models/_models.ts CHANGED
@@ -33,6 +33,7 @@ export const MODEL_NAMES = {
33
33
  borrowerDataInsurances: 'borrower_data_insurances',
34
34
  borrowerDataInventories: 'borrower_data_inventories',
35
35
  borrowerDataLocations: 'borrower_data_locations',
36
+ borrowerDataOptions: 'borrower_data_options',
36
37
  borrowerDataReceivables: 'borrower_data_receivables',
37
38
  borrowerDataTerms: 'borrower_data_terms',
38
39
  borrowerSettings: 'borrowerSettings',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.255",
3
+ "version": "1.4.257",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -362,7 +362,10 @@ class BankUploadedTransactionsService {
362
362
  await UploadedBankTransaction_model_1.UploadedBankTransaction.updateOne({ _id: new mongoose_1.default.Types.ObjectId(transactionId) }, { splitTransactions: mappedSplitTransactions });
363
363
  }
364
364
  async deleteBankTransaction(transactionIds) {
365
- await UploadedBankTransaction_model_1.UploadedBankTransaction.deleteMany({ _id: { $in: transactionIds }, isConverted: false });
365
+ await UploadedBankTransaction_model_1.UploadedBankTransaction.deleteMany({
366
+ _id: { $in: transactionIds },
367
+ isConverted: { $ne: true },
368
+ });
366
369
  }
367
370
  async revertAllBankTransactions(startDate, endDate, userId) {
368
371
  const transactions = await this.getUploadedBankTransactions(startDate, endDate);
@@ -403,7 +403,10 @@ export class BankUploadedTransactionsService {
403
403
  }
404
404
 
405
405
  async deleteBankTransaction(transactionIds: string[]) {
406
- await UploadedBankTransaction.deleteMany({ _id: { $in: transactionIds }, isConverted: false });
406
+ await UploadedBankTransaction.deleteMany({
407
+ _id: { $in: transactionIds },
408
+ isConverted: { $ne: true },
409
+ });
407
410
  }
408
411
 
409
412
  async revertAllBankTransactions(startDate: Date, endDate: Date, userId: string) {
@@ -143,9 +143,10 @@ class BorrowerService {
143
143
  .populate('data.banks')
144
144
  .populate('data.insurance')
145
145
  .lean();
146
- const options = await BorrowerData_model_1.BorrowerDataOptionModel.find({}).lean();
146
+ const options = await BorrowerData_model_1.BorrowerDataOptionModel.find({ isActive: true }).lean();
147
147
  if (borrowerSettings?.data?.options) {
148
- borrowerSettings.data.options = borrowerSettings.data.options.sort((a, b) => {
148
+ borrowerSettings.data.options = borrowerSettings.data.options
149
+ .sort((a, b) => {
149
150
  const foundA = options.find((option) => option._id.toString() === a.dataOption.toString());
150
151
  const foundB = options.find((option) => option._id.toString() === b.dataOption.toString());
151
152
  if (!foundA || !foundB) {
@@ -162,9 +162,10 @@ export class BorrowerService {
162
162
  .populate('data.banks')
163
163
  .populate('data.insurance')
164
164
  .lean() as unknown as IBorrowerSettingsDocPopulated;
165
- const options = await BorrowerDataOptionModel.find({}).lean();
165
+ const options = await BorrowerDataOptionModel.find({ isActive: true }).lean();
166
166
  if (borrowerSettings?.data?.options) {
167
- borrowerSettings.data.options = borrowerSettings.data.options.sort((a, b) => {
167
+ borrowerSettings.data.options = borrowerSettings.data.options
168
+ .sort((a, b) => {
168
169
  const foundA = options.find((option) => option._id.toString() === a.dataOption.toString());
169
170
  const foundB = options.find((option) => option._id.toString() === b.dataOption.toString());
170
171
  if (!foundA || !foundB) {