gemcap-be-common 1.5.68 → 1.5.70

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,12 +22,7 @@ export interface IExcelJsCell {
22
22
  t?: string;
23
23
  z?: string;
24
24
  hyperlink?: string;
25
- s?: {
26
- font?: Partial<ExcelJS.Font>;
27
- alignment?: Partial<ExcelJS.Alignment>;
28
- fill?: Partial<ExcelJS.FillPattern>;
29
- border?: Partial<ExcelJS.Borders>;
30
- };
25
+ s?: Partial<ExcelJS.Style>;
31
26
  }
32
27
  export declare const cellStyles: {
33
28
  title: {
@@ -199,11 +199,16 @@ const convertDataToFileWithStyle = async (dataToConvert, options) => {
199
199
  };
200
200
  }
201
201
  if (cell.s.fill) {
202
- excelCell.fill = {
203
- type: 'pattern',
204
- pattern: 'solid',
205
- ...cell.s.fill,
206
- };
202
+ if (cell.s.fill.type === 'pattern') {
203
+ excelCell.fill = {
204
+ type: 'pattern',
205
+ pattern: cell.s.fill.pattern ?? 'solid',
206
+ ...cell.s.fill,
207
+ };
208
+ }
209
+ else {
210
+ excelCell.fill = cell.s.fill;
211
+ }
207
212
  }
208
213
  if (cell.s.border) {
209
214
  excelCell.border = cell.s.border;
@@ -26,12 +26,13 @@ export interface IExcelJsCell {
26
26
  t?: string;
27
27
  z?: string;
28
28
  hyperlink?: string;
29
- s?: {
30
- font?: Partial<ExcelJS.Font>;
31
- alignment?: Partial<ExcelJS.Alignment>;
32
- fill?: Partial<ExcelJS.FillPattern>;
33
- border?: Partial<ExcelJS.Borders>;
34
- };
29
+ // s?: {
30
+ // font?: Partial<ExcelJS.Font>;
31
+ // alignment?: Partial<ExcelJS.Alignment>;
32
+ // fill?: Partial<ExcelJS.FillPattern>;
33
+ // border?: Partial<ExcelJS.Borders>;
34
+ // };
35
+ s?: Partial<ExcelJS.Style>;
35
36
  }
36
37
 
37
38
  export const cellStyles = {
@@ -234,11 +235,15 @@ export const convertDataToFileWithStyle = async (
234
235
  };
235
236
  }
236
237
  if (cell.s.fill) {
237
- excelCell.fill = {
238
- type: 'pattern',
239
- pattern: 'solid',
240
- ...cell.s.fill,
241
- };
238
+ if (cell.s.fill.type === 'pattern') {
239
+ excelCell.fill = {
240
+ type: 'pattern',
241
+ pattern: cell.s.fill.pattern ?? 'solid',
242
+ ...cell.s.fill,
243
+ };
244
+ } else {
245
+ excelCell.fill = cell.s.fill;
246
+ }
242
247
  }
243
248
  if (cell.s.border) {
244
249
  excelCell.border = cell.s.border;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.68",
3
+ "version": "1.5.70",
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
  }>;
@@ -23,27 +23,28 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- import { IEmailRecipient } from '../models/ComplianceItem.model';
26
+ import { IBorrowerItemDocument, IBorrowerItemInstanceDocument, IEmailRecipient } from '../models/ComplianceItem.model';
27
27
  import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
28
28
  import { IComplianceBorrowerWithBorrower, IComplianceBorrowerDocumentFull, IComplianceBorrowerWithPlaidToken } from '../models/BorrowerCompliance.model';
29
29
  import { IUserAccess } from '../interfaces/auth-user.interface';
30
30
  import { FileManagerService } from './file-manager.service';
31
31
  import { UploadsService } from './uploads.service';
32
+ export interface IInstanceStatus {
33
+ progress: {
34
+ text: string;
35
+ status: string;
36
+ };
37
+ score: {
38
+ value: number;
39
+ tooltip: string;
40
+ };
41
+ }
32
42
  export declare class ComplianceBorrowersService {
33
43
  private readonly _fileManagerService;
34
44
  private readonly _uploadsService;
35
45
  constructor(_fileManagerService: FileManagerService, _uploadsService: UploadsService);
36
46
  isComplianceBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
37
- calculateInstanceStatuses(instance: any, item: any): {
38
- progress: {
39
- text: string;
40
- status: string;
41
- };
42
- score: {
43
- value: number;
44
- tooltip: string;
45
- };
46
- };
47
+ calculateInstanceStatuses(instance: IBorrowerItemInstanceDocument, item: IBorrowerItemDocument): IInstanceStatus;
47
48
  getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
48
49
  getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items"> | {
49
50
  items: {
@@ -2,7 +2,12 @@ import dayjs, { ManipulateType } from 'dayjs';
2
2
  import _ from 'lodash';
3
3
  import mongoose from 'mongoose';
4
4
 
5
- import { IBorrowerItemDocument, IEmailRecipient } from '../models/ComplianceItem.model';
5
+ import {
6
+ IBorrowerItemDocument,
7
+ IBorrowerItemInstanceDocument,
8
+ IComplianceFile,
9
+ IEmailRecipient,
10
+ } from '../models/ComplianceItem.model';
6
11
  import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
7
12
  import { EItemProgressStatus } from '../enums/item-progress-status.enum';
8
13
  import {
@@ -35,6 +40,17 @@ const dueDifference = (date) => {
35
40
  return currentDate.diff(nextDate, 'day');
36
41
  };
37
42
 
43
+ export interface IInstanceStatus {
44
+ progress: {
45
+ text: string;
46
+ status: string;
47
+ };
48
+ score: {
49
+ value: number;
50
+ tooltip: string;
51
+ };
52
+ }
53
+
38
54
  export class ComplianceBorrowersService {
39
55
 
40
56
  constructor(
@@ -51,7 +67,7 @@ export class ComplianceBorrowersService {
51
67
  return true;
52
68
  }
53
69
 
54
- calculateInstanceStatuses(instance, item) {
70
+ calculateInstanceStatuses(instance: IBorrowerItemInstanceDocument, item: IBorrowerItemDocument): IInstanceStatus {
55
71
  let progress: { text: string, status: string };
56
72
  let score: { value: number, tooltip: string } = null;
57
73
  if (instance.submittedDate) {
@@ -77,7 +93,7 @@ export class ComplianceBorrowersService {
77
93
  return { progress, score };
78
94
  }
79
95
 
80
- async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any> {
96
+ async getFullComplianceBorrowerById(complianceBorrowerId: string) {
81
97
  if (!complianceBorrowerId) {
82
98
  return null;
83
99
  }
@@ -109,7 +125,7 @@ export class ComplianceBorrowersService {
109
125
  return Promise.resolve(null);
110
126
  }
111
127
 
112
- const items = { items: [], ...ourBorrower }.items.map((item) => {
128
+ const items = { items: [] as IBorrowerItemDocument[], ...ourBorrower }.items.map((item) => {
113
129
  return {
114
130
  ...item,
115
131
  instances: item.instances.reduce((acc, instance) => {
@@ -124,7 +140,10 @@ export class ComplianceBorrowersService {
124
140
  console.error({ e });
125
141
  return acc;
126
142
  }
127
- }, []),
143
+ }, <(IBorrowerItemInstanceDocument & IInstanceStatus & {
144
+ itemId: mongoose.Types.ObjectId,
145
+ files: IComplianceFile[]
146
+ })[]>[]),
128
147
  };
129
148
  });
130
149
  return Promise.resolve({ ...ourBorrower, items });
@@ -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<{