gemcap-be-common 1.4.208 → 1.4.210

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
+ }>)[]>;
@@ -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 } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  import Joi from 'joi';
27
27
  import { ILoanBrokerWithId } from './LoanBroker.model';
28
28
  export declare const ProductBrokerValidationSchema: Joi.ObjectSchema<any>;
@@ -38,15 +38,27 @@ 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 {
45
- loanBroker: ILoanBrokerWithId;
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;
46
56
  }
47
- export type IProductBrokerView = Omit<IProductBrokerWithId, 'borrowerId' | 'order'>;
48
- export interface IProductBrokerDoc extends IProductBroker, Document {
57
+ export interface IProductBrokerDocWithBroker extends IProductBrokerDoc {
58
+ loanBroker: ILoanBrokerWithId;
49
59
  }
60
+ export type IProductBrokerView = Omit<IProductBrokerLean, 'borrowerId' | 'order'>;
61
+ export type TProductBrokerModel = mongoose.Model<IProductBroker>;
50
62
  export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
51
63
  timestamps: true;
52
64
  }, {
@@ -54,12 +66,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
54
66
  updatedAt: NativeDate;
55
67
  } & {
56
68
  order: number;
57
- active: boolean;
58
69
  borrowerId: mongoose.Types.ObjectId;
59
- productId: mongoose.Types.ObjectId;
60
- PLCode: string;
70
+ active: boolean;
61
71
  loanBrokerId: mongoose.Types.ObjectId;
62
72
  BSCode: string;
73
+ PLCode: string;
74
+ productId: mongoose.Types.ObjectId;
63
75
  interestShare: number;
64
76
  adminShare: number;
65
77
  otherShare: number;
@@ -69,12 +81,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
69
81
  updatedAt: NativeDate;
70
82
  } & {
71
83
  order: number;
72
- active: boolean;
73
84
  borrowerId: mongoose.Types.ObjectId;
74
- productId: mongoose.Types.ObjectId;
75
- PLCode: string;
85
+ active: boolean;
76
86
  loanBrokerId: mongoose.Types.ObjectId;
77
87
  BSCode: string;
88
+ PLCode: string;
89
+ productId: mongoose.Types.ObjectId;
78
90
  interestShare: number;
79
91
  adminShare: number;
80
92
  otherShare: number;
@@ -84,12 +96,12 @@ export declare const ProductBrokerSchema: mongoose.Schema<any, mongoose.Model<an
84
96
  updatedAt: NativeDate;
85
97
  } & {
86
98
  order: number;
87
- active: boolean;
88
99
  borrowerId: mongoose.Types.ObjectId;
89
- productId: mongoose.Types.ObjectId;
90
- PLCode: string;
100
+ active: boolean;
91
101
  loanBrokerId: mongoose.Types.ObjectId;
92
102
  BSCode: string;
103
+ PLCode: string;
104
+ productId: mongoose.Types.ObjectId;
93
105
  interestShare: number;
94
106
  adminShare: number;
95
107
  otherShare: number;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -31,19 +31,33 @@ export interface IProductBroker {
31
31
  otherShare: number;
32
32
  }
33
33
 
34
- export interface IProductBrokerWithId extends IProductBroker {
34
+ export interface IProductBrokerDoc extends IProductBroker, mongoose.Document {
35
35
  _id: mongoose.Types.ObjectId;
36
+ createdAt: Date;
37
+ updatedAt: Date;
36
38
  }
37
39
 
38
- export interface IProductBrokerDocWithBroker extends IProductBrokerWithId {
39
- loanBroker: ILoanBrokerWithId;
40
+ export interface IProductBrokerLean extends IProductBroker {
41
+ _id: mongoose.Types.ObjectId;
42
+ createdAt: Date;
43
+ updatedAt: Date;
40
44
  }
41
45
 
42
- export type IProductBrokerView = Omit<IProductBrokerWithId, 'borrowerId' | 'order'>
46
+ export interface IProductBrokerPlain extends Omit<IProductBroker, 'borrowerId' | 'loanBrokerId' | 'productId'> {
47
+ _id: string;
48
+ borrowerId: string;
49
+ loanBrokerId: string;
50
+ productId: string;
51
+ }
43
52
 
44
- export interface IProductBrokerDoc extends IProductBroker, Document {
53
+ export interface IProductBrokerDocWithBroker extends IProductBrokerDoc {
54
+ loanBroker: ILoanBrokerWithId;
45
55
  }
46
56
 
57
+ export type IProductBrokerView = Omit<IProductBrokerLean, 'borrowerId' | 'order'>
58
+
59
+ export type TProductBrokerModel = mongoose.Model<IProductBroker>;
60
+
47
61
  export const ProductBrokerSchema = new mongoose.Schema(
48
62
  {
49
63
  borrowerId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.208",
3
+ "version": "1.4.210",
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<{