gemcap-be-common 1.4.210 → 1.4.212

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,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 dayjs from 'dayjs';
27
27
  import { ILoanChargeDoc } from './LoanCharges.model';
28
28
  export interface IStatementPeriod {
@@ -43,6 +43,20 @@ export interface ILoanStatementTransaction {
43
43
  userId?: string;
44
44
  isEditable?: boolean;
45
45
  }
46
+ export interface ILoanStatementTransactionDoc extends ILoanStatementTransaction, mongoose.Document {
47
+ _id: mongoose.Types.ObjectId;
48
+ createdAt: Date;
49
+ updatedAt: Date;
50
+ }
51
+ export interface ILoanStatementTransactionLean extends ILoanStatementTransaction {
52
+ _id: mongoose.Types.ObjectId;
53
+ createdAt: Date;
54
+ updatedAt: Date;
55
+ }
56
+ export interface ILoanStatementTransactionPlain extends Omit<ILoanStatementTransaction, 'chargeId'> {
57
+ _id: string;
58
+ chargeId: string;
59
+ }
46
60
  export interface ILoanStatementTransactionWithId extends ILoanStatementTransaction {
47
61
  _id: mongoose.Types.ObjectId;
48
62
  }
@@ -50,55 +64,54 @@ export interface ILoanStatementTransactionDocWithCharge extends ILoanStatementTr
50
64
  charge: ILoanChargeDoc;
51
65
  }
52
66
  export type ILoanStatementTransactionView = Omit<ILoanStatementTransactionWithId, 'order'>;
53
- export interface ILoanStatementTransactionDoc extends ILoanStatementTransaction, Document {
54
- }
67
+ export type TLoanStatementTransactionModel = mongoose.Model<ILoanStatementTransaction>;
55
68
  export declare const LoanStatementSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
56
69
  timestamps: true;
57
70
  }, {
58
71
  createdAt: NativeDate;
59
72
  updatedAt: NativeDate;
60
73
  } & {
61
- order: number;
62
74
  date: Date;
63
- amount: number;
64
75
  chargeId: mongoose.Types.ObjectId;
76
+ amount: number;
65
77
  isSystem: boolean;
66
- settlementCode?: string;
67
- __v?: number;
68
- memo?: string;
78
+ order: number;
69
79
  amountPaid?: number;
70
80
  balance?: number;
81
+ memo?: string;
71
82
  userId?: string;
83
+ settlementCode?: string;
84
+ __v?: number;
72
85
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
73
86
  createdAt: NativeDate;
74
87
  updatedAt: NativeDate;
75
88
  } & {
76
- order: number;
77
89
  date: Date;
78
- amount: number;
79
90
  chargeId: mongoose.Types.ObjectId;
91
+ amount: number;
80
92
  isSystem: boolean;
81
- settlementCode?: string;
82
- __v?: number;
83
- memo?: string;
93
+ order: number;
84
94
  amountPaid?: number;
85
95
  balance?: number;
96
+ memo?: string;
86
97
  userId?: string;
98
+ settlementCode?: string;
99
+ __v?: number;
87
100
  }>> & mongoose.FlatRecord<{
88
101
  createdAt: NativeDate;
89
102
  updatedAt: NativeDate;
90
103
  } & {
91
- order: number;
92
104
  date: Date;
93
- amount: number;
94
105
  chargeId: mongoose.Types.ObjectId;
106
+ amount: number;
95
107
  isSystem: boolean;
96
- settlementCode?: string;
97
- __v?: number;
98
- memo?: string;
108
+ order: number;
99
109
  amountPaid?: number;
100
110
  balance?: number;
111
+ memo?: string;
101
112
  userId?: string;
113
+ settlementCode?: string;
114
+ __v?: number;
102
115
  }> & {
103
116
  _id: mongoose.Types.ObjectId;
104
117
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import dayjs from 'dayjs';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -35,6 +35,23 @@ export interface ILoanStatementTransaction {
35
35
  isEditable?: boolean;
36
36
  }
37
37
 
38
+ export interface ILoanStatementTransactionDoc extends ILoanStatementTransaction, mongoose.Document {
39
+ _id: mongoose.Types.ObjectId;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
43
+
44
+ export interface ILoanStatementTransactionLean extends ILoanStatementTransaction {
45
+ _id: mongoose.Types.ObjectId;
46
+ createdAt: Date;
47
+ updatedAt: Date;
48
+ }
49
+
50
+ export interface ILoanStatementTransactionPlain extends Omit<ILoanStatementTransaction, 'chargeId'> {
51
+ _id: string;
52
+ chargeId: string;
53
+ }
54
+
38
55
  export interface ILoanStatementTransactionWithId extends ILoanStatementTransaction {
39
56
  _id: mongoose.Types.ObjectId;
40
57
  }
@@ -45,8 +62,7 @@ export interface ILoanStatementTransactionDocWithCharge extends ILoanStatementTr
45
62
 
46
63
  export type ILoanStatementTransactionView = Omit<ILoanStatementTransactionWithId, 'order'>
47
64
 
48
- export interface ILoanStatementTransactionDoc extends ILoanStatementTransaction, Document {
49
- }
65
+ export type TLoanStatementTransactionModel = mongoose.Model<ILoanStatementTransaction>;
50
66
 
51
67
  export const LoanStatementSchema = new mongoose.Schema(
52
68
  {
@@ -38,43 +38,11 @@ export declare enum ETotalType {
38
38
  APR_GROSS = "APR_GROSS",
39
39
  APR_LIFE_GROSS = "APR_LIFE_GROSS"
40
40
  }
41
- export declare const YIELD_TOTALS_MAP: {
42
- AVERAGE_BALANCE: {
43
- order: number;
44
- title: string;
45
- class: string;
46
- };
47
- AVERAGE_LIFE_BALANCE: {
48
- order: number;
49
- title: string;
50
- class: string;
51
- };
52
- GROSS: {
53
- order: number;
54
- title: string;
55
- class: string;
56
- };
57
- BROKER: {
58
- order: number;
59
- title: string;
60
- class: string;
61
- };
62
- NET: {
63
- order: number;
64
- title: string;
65
- class: string;
66
- };
67
- APR_GROSS: {
68
- order: number;
69
- title: string;
70
- class: string;
71
- };
72
- APR_LIFE_GROSS: {
73
- order: number;
74
- title: string;
75
- class: string;
76
- };
77
- };
41
+ export declare const YIELD_TOTALS_MAP: Record<ETotalType, {
42
+ order: number;
43
+ title: string;
44
+ class: string;
45
+ }>;
78
46
  export interface IYieldParams {
79
47
  periodStart?: ISelectedMonth;
80
48
  periodEnd?: ISelectedMonth;
@@ -36,6 +36,7 @@ exports.YIELD_TOTALS_MAP = {
36
36
  [ETotalType.GROSS]: { order: 1, title: 'Gross income $', class: 'whiteOnGray' },
37
37
  [ETotalType.BROKER]: { order: 2, title: 'Broker Fees $', class: 'whiteOnGray' },
38
38
  [ETotalType.NET]: { order: 3, title: 'Net income $', class: 'whiteOnGray' },
39
+ [ETotalType.APR]: { order: 5, title: 'Yield APR', class: 'whiteOnGray' },
39
40
  [ETotalType.APR_GROSS]: { order: 6, title: 'Yield in month', class: 'whiteOnBlack' },
40
41
  [ETotalType.APR_LIFE_GROSS]: { order: 7, title: 'Yield since inception', class: 'whiteOnBlack' },
41
42
  };
@@ -30,12 +30,20 @@ export enum ETotalType {
30
30
  APR_LIFE_GROSS = 'APR_LIFE_GROSS',
31
31
  }
32
32
 
33
- export const YIELD_TOTALS_MAP = {
33
+ export const YIELD_TOTALS_MAP: Record<
34
+ ETotalType,
35
+ {
36
+ order: number;
37
+ title: string;
38
+ class: string;
39
+ }
40
+ > = {
34
41
  [ETotalType.AVERAGE_BALANCE]: { order: -2, title: 'Average Balance in Month $', class: 'whiteOnOrange' },
35
42
  [ETotalType.AVERAGE_LIFE_BALANCE]: { order: -1, title: 'Average loan life balance $', class: 'whiteOnOrange' },
36
43
  [ETotalType.GROSS]: { order: 1, title: 'Gross income $', class: 'whiteOnGray' },
37
44
  [ETotalType.BROKER]: { order: 2, title: 'Broker Fees $', class: 'whiteOnGray' },
38
45
  [ETotalType.NET]: { order: 3, title: 'Net income $', class: 'whiteOnGray' },
46
+ [ETotalType.APR]: { order: 5, title: 'Yield APR', class: 'whiteOnGray' },
39
47
  [ETotalType.APR_GROSS]: { order: 6, title: 'Yield in month', class: 'whiteOnBlack' },
40
48
  [ETotalType.APR_LIFE_GROSS]: { order: 7, title: 'Yield since inception', class: 'whiteOnBlack' },
41
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.210",
3
+ "version": "1.4.212",
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
+ LAST_MONTH?: boolean;
88
+ CURRENT_MONTH?: boolean;
87
89
  ENTIRE_LOAN?: boolean;
88
90
  SELECTED_PERIOD?: boolean;
89
- CURRENT_MONTH?: boolean;
90
- LAST_MONTH?: boolean;
91
91
  TERM_LOAN?: boolean;
92
92
  };
93
93
  }>;
@@ -46,9 +46,9 @@ export declare class BrokersService {
46
46
  getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
47
47
  _id: import("mongoose").Types.ObjectId;
48
48
  }>)[]>;
49
- getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
49
+ getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
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[]>;
@@ -52,9 +52,9 @@ export declare class LoanStatementService {
52
52
  private readonly getLoanStatementEffectsService;
53
53
  constructor(financialIndexesService: FinancialIndexesService, loanChargesService: LoanChargesService, loanPaymentsService: LoanPaymentsService, loanStatementBalanceService: LoanStatementBalanceService, loanStatementStatusService: LoanStatementStatusService, loanTransactionsService: LoanTransactionsService, termLoanService: TermLoanService, uploadsService: UploadsService, getLoanStatementEffectsService: () => LoanStatementEffectsService);
54
54
  private getGroupedData;
55
- getTransactionById(transactionId: string): Promise<import("mongoose").FlattenMaps<ILoanStatementTransactionDoc> & {
55
+ getTransactionById(transactionId: string): Promise<import("mongoose").FlattenMaps<ILoanStatementTransactionDoc> & Required<{
56
56
  _id: import("mongoose").Types.ObjectId;
57
- }>;
57
+ }>>;
58
58
  getFirstStatementTransaction(productId: string): Promise<ILoanStatementTransactionDoc>;
59
59
  getBorrowerWithPeriods(borrowerId: string, period: {
60
60
  selectedPeriod: string;
@@ -103,6 +103,9 @@ export declare class LoanStatementService {
103
103
  deleteStatementTransaction(transactionId: string): Promise<void>;
104
104
  addBalancesToStatements(transactionDocs: ILoanStatementTransactionDoc[]): Promise<{
105
105
  floatedBalance: number;
106
+ _id: import("mongoose").Types.ObjectId;
107
+ createdAt: Date;
108
+ updatedAt: Date;
106
109
  order: number;
107
110
  date: Date;
108
111
  chargeId: import("mongoose").Types.ObjectId;
@@ -114,7 +117,6 @@ export declare class LoanStatementService {
114
117
  settlementCode?: string;
115
118
  userId?: string;
116
119
  isEditable?: boolean;
117
- _id?: any;
118
120
  __v?: any;
119
121
  $locals: Record<string, unknown>;
120
122
  $op: "save" | "validate" | "remove";
@@ -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<{
@@ -4,7 +4,8 @@ import mongoose from 'mongoose';
4
4
  import { convertSelectedMonthToDate, getStartOfMonthsBetweenDates, ISelectedMonth } from '../helpers/date.helper';
5
5
  import {
6
6
  ETotalType,
7
- IYieldParams, IYieldViewData,
7
+ IYieldParams,
8
+ IYieldViewData,
8
9
  YIELD_TOTALS_MAP,
9
10
  YieldData,
10
11
  yieldParamsValidationSchema,