gemcap-be-common 1.4.207 → 1.4.209

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.
@@ -28,12 +28,12 @@ import { ILoanProductDoc } from '../models/LoanProducts.model';
28
28
  import { IProductBrokerDocWithBroker } from '../models/ProductBroker.model';
29
29
  export declare const getProductBrokers: (productId: string) => Promise<IProductBrokerDocWithBroker[]>;
30
30
  export declare const enrichWithBrokers: (transactions: ILedgerDataRow[], product: ILoanProductDoc) => Promise<ILedgerDataRow[]>;
31
- export declare const getBorrowerBrokers: (borrowerId: string) => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
31
+ export declare const getBorrowerBrokers: (borrowerId: string) => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
32
32
  _id: mongoose.Types.ObjectId;
33
- })[]>;
34
- export declare const getAllProductBrokers: () => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
33
+ }>)[]>;
34
+ export declare const getAllProductBrokers: () => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
35
35
  _id: mongoose.Types.ObjectId;
36
- })[]>;
36
+ }>)[]>;
37
37
  export declare const getAllLoanBrokers: () => Promise<{
38
38
  emails: mongoose.FlattenMaps<import("../models/LoanBroker.model").ILoanBrokerEmail>[];
39
39
  order: number;
@@ -185,6 +185,6 @@ export declare const getAllLoanBrokers: () => Promise<{
185
185
  (pathsToValidate?: mongoose.PathsToValidate, options?: mongoose.AnyObject): mongoose.Error.ValidationError;
186
186
  };
187
187
  }[]>;
188
- export declare const getBrokerProducts: (loanBrokerId: string) => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
188
+ export declare const getBrokerProducts: (loanBrokerId: string) => Promise<(mongoose.FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
189
189
  _id: mongoose.Types.ObjectId;
190
- })[]>;
190
+ }>)[]>;
@@ -38,13 +38,26 @@ export interface IProductBroker {
38
38
  adminShare: number;
39
39
  otherShare: number;
40
40
  }
41
- export interface IProductBrokerWithId extends IProductBroker {
41
+ export interface IProductBrokerDoc extends IProductBroker, mongoose.Document {
42
42
  _id: mongoose.Types.ObjectId;
43
+ createdAt: Date;
44
+ updatedAt: Date;
43
45
  }
44
- export interface IProductBrokerDocWithBroker extends IProductBrokerWithId {
46
+ export interface IProductBrokerLean extends IProductBroker {
47
+ _id: mongoose.Types.ObjectId;
48
+ createdAt: Date;
49
+ updatedAt: Date;
50
+ }
51
+ export interface IProductBrokerPlain extends Omit<IProductBroker, 'borrowerId' | 'loanBrokerId' | 'productId'> {
52
+ _id: string;
53
+ borrowerId: string;
54
+ loanBrokerId: string;
55
+ productId: string;
56
+ }
57
+ export interface IProductBrokerDocWithBroker extends IProductBrokerDoc {
45
58
  loanBroker: ILoanBrokerWithId;
46
59
  }
47
- export type IProductBrokerView = Omit<IProductBrokerWithId, 'borrowerId' | 'order'>;
60
+ export type IProductBrokerView = Omit<IProductBrokerLean, 'borrowerId' | 'order'>;
48
61
  export interface IProductBrokerDoc extends IProductBroker, Document {
49
62
  }
50
63
  export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
@@ -54,12 +67,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
54
67
  updatedAt: NativeDate;
55
68
  } & {
56
69
  order: number;
57
- active: boolean;
58
70
  borrowerId: mongoose.Types.ObjectId;
59
- productId: mongoose.Types.ObjectId;
60
- PLCode: string;
71
+ active: boolean;
61
72
  loanBrokerId: mongoose.Types.ObjectId;
62
73
  BSCode: string;
74
+ PLCode: string;
75
+ productId: mongoose.Types.ObjectId;
63
76
  interestShare: number;
64
77
  adminShare: number;
65
78
  otherShare: number;
@@ -69,12 +82,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
69
82
  updatedAt: NativeDate;
70
83
  } & {
71
84
  order: number;
72
- active: boolean;
73
85
  borrowerId: mongoose.Types.ObjectId;
74
- productId: mongoose.Types.ObjectId;
75
- PLCode: string;
86
+ active: boolean;
76
87
  loanBrokerId: mongoose.Types.ObjectId;
77
88
  BSCode: string;
89
+ PLCode: string;
90
+ productId: mongoose.Types.ObjectId;
78
91
  interestShare: number;
79
92
  adminShare: number;
80
93
  otherShare: number;
@@ -84,12 +97,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
84
97
  updatedAt: NativeDate;
85
98
  } & {
86
99
  order: number;
87
- active: boolean;
88
100
  borrowerId: mongoose.Types.ObjectId;
89
- productId: mongoose.Types.ObjectId;
90
- PLCode: string;
101
+ active: boolean;
91
102
  loanBrokerId: mongoose.Types.ObjectId;
92
103
  BSCode: string;
104
+ PLCode: string;
105
+ productId: mongoose.Types.ObjectId;
93
106
  interestShare: number;
94
107
  adminShare: number;
95
108
  otherShare: number;
@@ -3,6 +3,7 @@ import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
5
5
  import { ILoanBrokerWithId } from './LoanBroker.model';
6
+ import { ILoanProduct } from './LoanProducts.model';
6
7
 
7
8
  export const ProductBrokerValidationSchema = Joi.object({
8
9
  _id: Joi.string().required(),
@@ -31,15 +32,30 @@ export interface IProductBroker {
31
32
  otherShare: number;
32
33
  }
33
34
 
34
- export interface IProductBrokerWithId extends IProductBroker {
35
+ export interface IProductBrokerDoc extends IProductBroker, mongoose.Document {
35
36
  _id: mongoose.Types.ObjectId;
37
+ createdAt: Date;
38
+ updatedAt: Date;
36
39
  }
37
40
 
38
- export interface IProductBrokerDocWithBroker extends IProductBrokerWithId {
41
+ export interface IProductBrokerLean extends IProductBroker {
42
+ _id: mongoose.Types.ObjectId;
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ }
46
+
47
+ export interface IProductBrokerPlain extends Omit<IProductBroker, 'borrowerId' | 'loanBrokerId' | 'productId'> {
48
+ _id: string;
49
+ borrowerId: string;
50
+ loanBrokerId: string;
51
+ productId: string;
52
+ }
53
+
54
+ export interface IProductBrokerDocWithBroker extends IProductBrokerDoc {
39
55
  loanBroker: ILoanBrokerWithId;
40
56
  }
41
57
 
42
- export type IProductBrokerView = Omit<IProductBrokerWithId, 'borrowerId' | 'order'>
58
+ export type IProductBrokerView = Omit<IProductBrokerLean, 'borrowerId' | 'order'>
43
59
 
44
60
  export interface IProductBrokerDoc extends IProductBroker, Document {
45
61
  }
@@ -34,6 +34,7 @@ export declare enum ETotalType {
34
34
  BROKER = "BROKER",
35
35
  GROSS = "GROSS",
36
36
  NET = "NET",
37
+ APR = "APR",
37
38
  APR_GROSS = "APR_GROSS",
38
39
  APR_LIFE_GROSS = "APR_LIFE_GROSS"
39
40
  }
@@ -26,6 +26,7 @@ var ETotalType;
26
26
  ETotalType["BROKER"] = "BROKER";
27
27
  ETotalType["GROSS"] = "GROSS";
28
28
  ETotalType["NET"] = "NET";
29
+ ETotalType["APR"] = "APR";
29
30
  ETotalType["APR_GROSS"] = "APR_GROSS";
30
31
  ETotalType["APR_LIFE_GROSS"] = "APR_LIFE_GROSS";
31
32
  })(ETotalType || (exports.ETotalType = ETotalType = {}));
@@ -25,6 +25,7 @@ export enum ETotalType {
25
25
  BROKER = 'BROKER',
26
26
  GROSS = 'GROSS',
27
27
  NET = 'NET',
28
+ APR = 'APR',
28
29
  APR_GROSS = 'APR_GROSS',
29
30
  APR_LIFE_GROSS = 'APR_LIFE_GROSS',
30
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.207",
3
+ "version": "1.4.209",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -43,12 +43,12 @@ export declare class BrokersService {
43
43
  private readonly loanChargesService;
44
44
  constructor(loanChargesService: LoanChargesService);
45
45
  normalizeObjects(): Promise<void>;
46
- getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
46
+ getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
47
47
  _id: import("mongoose").Types.ObjectId;
48
- })[]>;
49
- getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
48
+ }>)[]>;
49
+ getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
50
50
  _id: import("mongoose").Types.ObjectId;
51
- })[] | BrokerView[]>;
51
+ }>)[]>;
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[]>;
@@ -21,6 +21,8 @@ const defaultBrokerList = [
21
21
  adminShare: 0,
22
22
  interestShare: 0,
23
23
  otherShare: 0,
24
+ createdAt: null,
25
+ updatedAt: null,
24
26
  },
25
27
  ];
26
28
  class BrokersService {
@@ -25,6 +25,8 @@ const defaultBrokerList: BrokerView[] = [
25
25
  adminShare: 0,
26
26
  interestShare: 0,
27
27
  otherShare: 0,
28
+ createdAt: null,
29
+ updatedAt: null,
28
30
  },
29
31
  ];
30
32
 
@@ -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 | string[] | Date)[];
158
+ [x: string]: (string | number | Date | string[])[];
159
159
  }[];
160
160
  }>;
161
161
  getBorrowerIdsForFile(transactionFileId: string): Promise<{