gemcap-be-common 1.4.243 → 1.4.245

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.
@@ -22,20 +22,30 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  import Joi from 'joi';
27
27
  export interface IAuditor {
28
28
  isDeleted: boolean;
29
29
  name: string;
30
30
  order?: number;
31
31
  }
32
- export interface IAuditorWithID extends IAuditor {
33
- _id: string;
32
+ export interface IAuditorDoc extends IAuditor, mongoose.Document {
33
+ _id: mongoose.Types.ObjectId;
34
+ createdAt: Date;
35
+ updatedAt: Date;
34
36
  }
35
- export interface IAuditorDoc extends IAuditor, Document {
37
+ export interface IAuditorLean extends IAuditor {
38
+ _id: mongoose.Types.ObjectId;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
42
+ export interface IAuditorPlain extends IAuditor {
43
+ _id: string;
44
+ createdAt: Date;
45
+ updatedAt: Date;
36
46
  }
37
47
  export declare const AuditorValidationSchema: Joi.ObjectSchema<any>;
38
- export type AuditorModel = Model<IAuditor, object, object>;
48
+ export type AuditorModel = mongoose.Model<IAuditor>;
39
49
  export declare const AuditorSchema: mongoose.Schema<IAuditor, AuditorModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditor, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditor>> & mongoose.FlatRecord<IAuditor> & {
40
50
  _id: mongoose.Types.ObjectId;
41
51
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -9,11 +9,22 @@ export interface IAuditor {
9
9
  order?: number;
10
10
  }
11
11
 
12
- export interface IAuditorWithID extends IAuditor {
13
- _id: string;
12
+ export interface IAuditorDoc extends IAuditor, mongoose.Document {
13
+ _id: mongoose.Types.ObjectId;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+
18
+ export interface IAuditorLean extends IAuditor {
19
+ _id: mongoose.Types.ObjectId;
20
+ createdAt: Date;
21
+ updatedAt: Date;
14
22
  }
15
23
 
16
- export interface IAuditorDoc extends IAuditor, Document {
24
+ export interface IAuditorPlain extends IAuditor {
25
+ _id: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
17
28
  }
18
29
 
19
30
  export const AuditorValidationSchema = Joi.object({
@@ -23,7 +34,7 @@ export const AuditorValidationSchema = Joi.object({
23
34
  order: Joi.number().required().allow (null),
24
35
  });
25
36
 
26
- export type AuditorModel = Model<IAuditor, object, object>;
37
+ export type AuditorModel = mongoose.Model<IAuditor>;
27
38
 
28
39
  export const AuditorSchema = new mongoose.Schema<IAuditor, AuditorModel>(
29
40
  {
@@ -22,14 +22,27 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  export interface IAuditorAccess {
27
27
  email: string;
28
28
  hashedPassword: string;
29
29
  }
30
- export interface IAuditorAccessDoc extends IAuditorAccess, Document {
30
+ export interface IAuditorAccessDoc extends IAuditorAccess, mongoose.Document {
31
+ _id: mongoose.Types.ObjectId;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ }
35
+ export interface IAuditorAccessLean extends IAuditorAccess {
36
+ _id: mongoose.Types.ObjectId;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ }
40
+ export interface IAuditorAccessPlain extends IAuditorAccess {
41
+ _id: string;
42
+ createdAt: Date;
43
+ updatedAt: Date;
31
44
  }
32
- export type AuditorAccessModel = Model<IAuditorAccess, object, object>;
45
+ export type AuditorAccessModel = mongoose.Model<IAuditorAccess>;
33
46
  export declare const AuditorAccessSchema: mongoose.Schema<IAuditorAccess, AuditorAccessModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditorAccess, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditorAccess>> & mongoose.FlatRecord<IAuditorAccess> & {
34
47
  _id: mongoose.Types.ObjectId;
35
48
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
 
3
3
  import { MODEL_NAMES } from './_models';
4
4
 
@@ -7,10 +7,25 @@ export interface IAuditorAccess {
7
7
  hashedPassword: string;
8
8
  }
9
9
 
10
- export interface IAuditorAccessDoc extends IAuditorAccess, Document {
10
+ export interface IAuditorAccessDoc extends IAuditorAccess, mongoose.Document {
11
+ _id: mongoose.Types.ObjectId;
12
+ createdAt: Date;
13
+ updatedAt: Date;
11
14
  }
12
15
 
13
- export type AuditorAccessModel = Model<IAuditorAccess, object, object>;
16
+ export interface IAuditorAccessLean extends IAuditorAccess {
17
+ _id: mongoose.Types.ObjectId;
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
21
+
22
+ export interface IAuditorAccessPlain extends IAuditorAccess {
23
+ _id: string;
24
+ createdAt: Date;
25
+ updatedAt: Date;
26
+ }
27
+
28
+ export type AuditorAccessModel = mongoose.Model<IAuditorAccess>;
14
29
 
15
30
  export const AuditorAccessSchema = new mongoose.Schema<IAuditorAccess, AuditorAccessModel>(
16
31
  {
@@ -22,7 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  import Joi from 'joi';
27
27
  export interface IAuditorContact {
28
28
  auditorId: mongoose.Types.ObjectId;
@@ -34,13 +34,24 @@ export interface IAuditorContact {
34
34
  comment?: string;
35
35
  order?: number;
36
36
  }
37
- export interface IAuditorContactWithID extends IAuditorContact {
38
- _id: string;
37
+ export interface IAuditorContactDoc extends IAuditorContact, mongoose.Document {
38
+ _id: mongoose.Types.ObjectId;
39
+ createdAt: Date;
40
+ updatedAt: Date;
39
41
  }
40
- export interface IAuditorContactDoc extends IAuditorContact, Document {
42
+ export interface IAuditorContactLean extends IAuditorContact {
43
+ _id: mongoose.Types.ObjectId;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ }
47
+ export interface IAuditorContactPlain extends Omit<IAuditorContact, 'auditorId'> {
48
+ _id: string;
49
+ auditorId: string;
50
+ createdAt: Date;
51
+ updatedAt: Date;
41
52
  }
42
53
  export declare const AuditorContactValidationSchema: Joi.ObjectSchema<any>;
43
- export type AuditorContactModel = Model<IAuditorContact, object, object>;
54
+ export type AuditorContactModel = mongoose.Model<IAuditorContact>;
44
55
  export declare const AuditorContactSchema: mongoose.Schema<IAuditorContact, AuditorContactModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditorContact, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditorContact>> & mongoose.FlatRecord<IAuditorContact> & {
45
56
  _id: mongoose.Types.ObjectId;
46
57
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -14,11 +14,23 @@ export interface IAuditorContact {
14
14
  order?: number;
15
15
  }
16
16
 
17
- export interface IAuditorContactWithID extends IAuditorContact {
18
- _id: string;
17
+ export interface IAuditorContactDoc extends IAuditorContact, mongoose.Document {
18
+ _id: mongoose.Types.ObjectId;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+
23
+ export interface IAuditorContactLean extends IAuditorContact {
24
+ _id: mongoose.Types.ObjectId;
25
+ createdAt: Date;
26
+ updatedAt: Date;
19
27
  }
20
28
 
21
- export interface IAuditorContactDoc extends IAuditorContact, Document {
29
+ export interface IAuditorContactPlain extends Omit<IAuditorContact, 'auditorId'> {
30
+ _id: string;
31
+ auditorId: string;
32
+ createdAt: Date;
33
+ updatedAt: Date;
22
34
  }
23
35
 
24
36
  export const AuditorContactValidationSchema = Joi.object({
@@ -32,7 +44,7 @@ export const AuditorContactValidationSchema = Joi.object({
32
44
  order: Joi.number().required().allow(null),
33
45
  });
34
46
 
35
- export type AuditorContactModel = Model<IAuditorContact, object, object>;
47
+ export type AuditorContactModel = mongoose.Model<IAuditorContact>;
36
48
 
37
49
  export const AuditorContactSchema = new mongoose.Schema<IAuditorContact, AuditorContactModel>(
38
50
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.243",
3
+ "version": "1.4.245",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -84,10 +84,10 @@ export declare class BorrowerService {
84
84
  getBorrowerCodesMap(): Promise<Map<string, string>>;
85
85
  getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
86
86
  [x: string]: {
87
- SELECTED_PERIOD?: boolean;
88
- ENTIRE_LOAN?: boolean;
89
87
  LAST_MONTH?: boolean;
90
88
  CURRENT_MONTH?: boolean;
89
+ ENTIRE_LOAN?: boolean;
90
+ SELECTED_PERIOD?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;
@@ -45,7 +45,7 @@ export declare class ComplianceBorrowersService {
45
45
  };
46
46
  };
47
47
  getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
48
- getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "items" | "borrower" | "fundingStatus"> | {
48
+ getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items"> | {
49
49
  items: {
50
50
  instances: any[];
51
51
  item: import("../models/ComplianceItem.model").IComplianceItemDocument;
@@ -99,9 +99,7 @@ export declare class ComplianceBorrowersService {
99
99
  markInstanceFilesAsOld(complianceInstanceId: string): Promise<mongoose.Document<unknown, {}, import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc> & import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc & Required<{
100
100
  _id: mongoose.Types.ObjectId;
101
101
  }>>;
102
- getBorrowerWithPlaidToken(): Promise<(mongoose.Document<unknown, {}, import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc> & import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc & Required<{
103
- _id: mongoose.Types.ObjectId;
104
- }>)[]>;
102
+ getBorrowerWithPlaidToken(): Promise<IComplianceBorrowerWithBorrower[]>;
105
103
  getBorrowerEmails(userAccess: IUserAccess): Promise<{
106
104
  borrower: {
107
105
  _id: string;
@@ -386,7 +386,10 @@ class ComplianceBorrowersService {
386
386
  async getBorrowerWithPlaidToken() {
387
387
  return BorrowerCompliance_model_1.BorrowerCompliance
388
388
  .find({ plaidAccessToken: { $exists: true } })
389
- .select('+plaidAccessToken');
389
+ .populate('borrower')
390
+ .select('+plaidAccessToken')
391
+ .lean()
392
+ .exec();
390
393
  }
391
394
  async getBorrowerEmails(userAccess) {
392
395
  const allComplianceBorrower = await BorrowerCompliance_model_1.BorrowerCompliance
@@ -449,7 +452,11 @@ class ComplianceBorrowersService {
449
452
  return;
450
453
  }
451
454
  return {
452
- borrower: { _id: borrower._id.toString(), name: borrower.borrower?.name ?? '', borrowerId: borrower.borrower?._id.toString() ?? '' },
455
+ borrower: {
456
+ _id: borrower._id.toString(),
457
+ name: borrower.borrower?.name ?? '',
458
+ borrowerId: borrower.borrower?._id.toString() ?? '',
459
+ },
453
460
  email: borrower.email,
454
461
  mainEmails: borrower.mainEmails ?? [],
455
462
  financialEmails: borrower.financialEmails ?? [],
@@ -422,7 +422,10 @@ export class ComplianceBorrowersService {
422
422
  async getBorrowerWithPlaidToken() {
423
423
  return BorrowerCompliance
424
424
  .find({ plaidAccessToken: { $exists: true } })
425
- .select('+plaidAccessToken');
425
+ .populate('borrower')
426
+ .select('+plaidAccessToken')
427
+ .lean<IComplianceBorrowerWithBorrower[]>()
428
+ .exec();
426
429
  }
427
430
 
428
431
  async getBorrowerEmails(userAccess: IUserAccess) {
@@ -487,7 +490,11 @@ export class ComplianceBorrowersService {
487
490
  return;
488
491
  }
489
492
  return {
490
- borrower: { _id: borrower._id.toString(), name: borrower.borrower?.name ?? '', borrowerId: borrower.borrower?._id.toString() ?? '' },
493
+ borrower: {
494
+ _id: borrower._id.toString(),
495
+ name: borrower.borrower?.name ?? '',
496
+ borrowerId: borrower.borrower?._id.toString() ?? '',
497
+ },
491
498
  email: borrower.email,
492
499
  mainEmails: borrower.mainEmails ?? [],
493
500
  financialEmails: borrower.financialEmails ?? [],
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
155
155
  getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
156
156
  transactionIdsToMark: string[];
157
157
  transactions: {
158
- [x: string]: (string | number | Date | string[])[];
158
+ [x: string]: (string | number | string[] | Date)[];
159
159
  }[];
160
160
  }>;
161
161
  getBorrowerIdsForFile(transactionFileId: string): Promise<{