gemcap-be-common 1.0.6 → 1.0.7
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.
- package/package.json +4 -2
- package/src/enums/collaterals.enum.ts +8 -0
- package/src/enums/data-types.enum.ts +5 -0
- package/src/enums/equipment-types.enum.ts +6 -0
- package/src/enums/item-progress-status.enum.ts +5 -0
- package/src/enums/loan-charge-type.enum.ts +8 -0
- package/src/enums/loan-types.enum.ts +21 -0
- package/src/enums/modules.enum.ts +12 -0
- package/src/enums/reserve-types.enum.ts +10 -0
- package/src/enums/upload-types.enum.ts +4 -0
- package/src/enums/user-types.enum.ts +7 -0
- package/src/enums/validators.enums.ts +7 -0
- package/src/interfaces/custom-row.interface.ts +13 -0
- package/src/interfaces/cync-loan-data.interface.ts +23 -0
- package/src/interfaces/email-addresses.interface.ts +11 -0
- package/src/interfaces/email.interface.ts +6 -0
- package/src/interfaces/group.interface.ts +11 -0
- package/src/interfaces/keycloak-role.interface.ts +16 -0
- package/src/interfaces/keycloak-user.interface.ts +29 -0
- package/src/interfaces/multer.interface.ts +19 -0
- package/src/interfaces/plaid-data.interface.ts +62 -0
- package/src/interfaces/query.interface.ts +12 -0
- package/src/interfaces/result.interface.ts +4 -0
- package/src/interfaces/upload-data.interface.ts +16 -0
- package/src/models/ComplianceItem.model.ts +81 -0
- package/src/models/InventoryAvailability.model.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/db/inventory-availability.d.ts +0 -2
- package/src/db/inventory-availability.js +0 -51
- package/src/enum/inventory-availability-results.enum.d.ts +0 -5
- package/src/enum/inventory-availability-results.enum.js +0 -9
- package/src/interfaces/collaterals.interface.d.ts +0 -24
- package/src/interfaces/collaterals.interface.js +0 -7
- package/src/models/AccountPayableItem.model.d.ts +0 -17
- package/src/models/AccountPayableItem.model.js +0 -60
- package/src/models/BBCDate.model.d.ts +0 -9
- package/src/models/BBCDate.model.js +0 -21
- package/src/models/BBCSheet.model.d.ts +0 -18
- package/src/models/BBCSheet.model.js +0 -51
- package/src/models/InventoryAvailability.model.d.ts +0 -53
- package/src/models/InventoryAvailability.model.js +0 -107
- package/src/models/InventoryItem.model.d.ts +0 -35
- package/src/models/InventoryItem.model.js +0 -100
- package/src/models/ReceiavableItem.model.d.ts +0 -24
- package/src/models/ReceiavableItem.model.js +0 -71
- package/src/plugins/id.plugin.d.ts +0 -2
- package/src/plugins/id.plugin.js +0 -53
- /package/src/{enum → enums}/inventory-availability-results.enum.ts +0 -0
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gemcap-be-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lib:build": "npx tsc",
|
|
8
8
|
"lib:publish": "npm publish"
|
|
9
9
|
},
|
|
10
|
-
"author": "",
|
|
10
|
+
"author": "Nick Elovsky",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"express": "^4.18.2",
|
|
13
14
|
"mongoose": "^6.10.5"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
17
|
+
"@types/express": "^4.17.17",
|
|
16
18
|
"typescript": "^5.1.6"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export enum ELoanTypes {
|
|
2
|
+
REVOLVER = 'REVOLVER',
|
|
3
|
+
TERM = 'TERM',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export enum EChargeFrequencies {
|
|
8
|
+
DAILY = 'DAILY',
|
|
9
|
+
MONTHLY = 'MONTHLY',
|
|
10
|
+
ANNUAL = 'ANNUAL',
|
|
11
|
+
DISBURSEMENT = 'DISBURSEMENT',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum EChargeCalculationBasis {
|
|
15
|
+
DAILY_BALANCE = 'DAILY_BALANCE',
|
|
16
|
+
AVERAGE_MONTHLY_BALANCE = 'AVERAGE_MONTHLY_BALANCE',
|
|
17
|
+
UNUSED_AMOUNT = 'UNUSED_AMOUNT',
|
|
18
|
+
COMMITMENT = 'COMMITMENT',
|
|
19
|
+
DISBURSEMENT_AMOUNT = 'DISBURSEMENT_AMOUNT',
|
|
20
|
+
ONE_TIME = 'ONE_TIME',
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum EModules {
|
|
2
|
+
ACCOUNTING = 'accounting',
|
|
3
|
+
ADMIN = 'admin',
|
|
4
|
+
ANALYSIS = 'analysis',
|
|
5
|
+
AUTH = 'auth',
|
|
6
|
+
AVAILABILITY = 'availability',
|
|
7
|
+
BBC = 'bbc',
|
|
8
|
+
BORROWERS = 'borrowers',
|
|
9
|
+
COMPLIANCE = 'compliance',
|
|
10
|
+
LOAN_CHARGES = 'loan-charges',
|
|
11
|
+
LOAN_DETAILS = 'loan-details',
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EValidators } from '../enums/validators.enums';
|
|
2
|
+
import { EDataTypes } from '../enums/data-types.enum';
|
|
3
|
+
|
|
4
|
+
export interface ICustomRow {
|
|
5
|
+
db_title: string;
|
|
6
|
+
title: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
items: Array<string | number>;
|
|
10
|
+
validators?: EValidators[];
|
|
11
|
+
isDate?: boolean;
|
|
12
|
+
dataType?: EDataTypes;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ILoanData {
|
|
2
|
+
clientId: string;
|
|
3
|
+
clientName: string;
|
|
4
|
+
loanSignedDate: string;
|
|
5
|
+
creditCeilingMax: number;
|
|
6
|
+
outstandingLoanBalance: number;
|
|
7
|
+
interestBalance: number;
|
|
8
|
+
feeBalance: number;
|
|
9
|
+
interestAccrued: number;
|
|
10
|
+
feeAccrued: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IInquiryData {
|
|
14
|
+
clientId: string;
|
|
15
|
+
loanId: string;
|
|
16
|
+
date: string;
|
|
17
|
+
disbursement: number;
|
|
18
|
+
collections: string;
|
|
19
|
+
revolverBalance: number;
|
|
20
|
+
termBalance: number;
|
|
21
|
+
collateralName: string;
|
|
22
|
+
collateralBalance: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IEmailRecipient, IEmailRecipientDocument } from '../models/ComplianceItem.model';
|
|
2
|
+
|
|
3
|
+
export interface IGroupedEmailsUpdate {
|
|
4
|
+
_id: string;
|
|
5
|
+
isEmailingActive: boolean;
|
|
6
|
+
mainEmails: IEmailRecipient[];
|
|
7
|
+
financialEmails: IEmailRecipient[];
|
|
8
|
+
groupedEmails: {
|
|
9
|
+
[itemId: string]: IEmailRecipientDocument[]
|
|
10
|
+
},
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface IKeycloakRole {
|
|
2
|
+
clientRole: boolean;
|
|
3
|
+
composite: boolean;
|
|
4
|
+
containerId: string;
|
|
5
|
+
description: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IKeycloakRoleWithRepresentation extends IKeycloakRole {
|
|
11
|
+
representation: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IGroupedKeycloakRoles {
|
|
15
|
+
[module: string]: IKeycloakRoleWithRepresentation[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IGroupedKeycloakRoles } from './keycloak-role.interface';
|
|
2
|
+
|
|
3
|
+
export interface IKeycloakUser {
|
|
4
|
+
id: string;
|
|
5
|
+
username: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
email: string;
|
|
10
|
+
emailVerified: boolean;
|
|
11
|
+
access: {
|
|
12
|
+
manageGroupMembership: boolean;
|
|
13
|
+
view: boolean;
|
|
14
|
+
mapRoles: boolean;
|
|
15
|
+
impersonate: boolean,
|
|
16
|
+
manage: boolean
|
|
17
|
+
};
|
|
18
|
+
impersonate: boolean;
|
|
19
|
+
manage: boolean;
|
|
20
|
+
manageGroupMembership: boolean;
|
|
21
|
+
mapRoles: boolean;
|
|
22
|
+
view: boolean;
|
|
23
|
+
createdTimestamp: number;
|
|
24
|
+
disableableCredentialTypes: any[];
|
|
25
|
+
notBefore: number;
|
|
26
|
+
requiredActions: any[];
|
|
27
|
+
totp: boolean;
|
|
28
|
+
roles?: IGroupedKeycloakRoles;
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
|
|
3
|
+
export interface IMulterFile {
|
|
4
|
+
fieldname: string;
|
|
5
|
+
originalname: string;
|
|
6
|
+
encoding: string;
|
|
7
|
+
mimetype: string;
|
|
8
|
+
buffer?: Buffer;
|
|
9
|
+
filename?: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IRequestForMulter extends Request {
|
|
15
|
+
files: IMulterFile[];
|
|
16
|
+
uuid: string;
|
|
17
|
+
folder: string;
|
|
18
|
+
params: any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface IPlaidBalance {
|
|
2
|
+
available: number;
|
|
3
|
+
current: number;
|
|
4
|
+
iso_currency_code: string;
|
|
5
|
+
limit: number;
|
|
6
|
+
unofficial_currency_code: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IPlaidAccount {
|
|
10
|
+
account_id: string;
|
|
11
|
+
mask: string;
|
|
12
|
+
name: string;
|
|
13
|
+
official_name: string;
|
|
14
|
+
subtype: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type PlaidAccount = IPlaidAccount & { balances: IPlaidBalance };
|
|
19
|
+
|
|
20
|
+
export interface IPlaidTransaction {
|
|
21
|
+
account_id: string;
|
|
22
|
+
account_owner: any;
|
|
23
|
+
amount: number;
|
|
24
|
+
authorized_date: string;
|
|
25
|
+
authorized_datetime: string;
|
|
26
|
+
category: string[];
|
|
27
|
+
category_id: string;
|
|
28
|
+
check_number: any;
|
|
29
|
+
date: string;
|
|
30
|
+
datetime: string;
|
|
31
|
+
iso_currency_code: string;
|
|
32
|
+
location: {
|
|
33
|
+
address: string,
|
|
34
|
+
city: string,
|
|
35
|
+
country: string,
|
|
36
|
+
lat: number,
|
|
37
|
+
lon: number,
|
|
38
|
+
postal_code: string,
|
|
39
|
+
region: string;
|
|
40
|
+
store_number: string;
|
|
41
|
+
};
|
|
42
|
+
merchant_name: string;
|
|
43
|
+
name: string;
|
|
44
|
+
payment_channel: string;
|
|
45
|
+
payment_meta: {
|
|
46
|
+
by_order_of: any;
|
|
47
|
+
payee: any;
|
|
48
|
+
payer: any;
|
|
49
|
+
payment_method: any;
|
|
50
|
+
payment_processor: any;
|
|
51
|
+
ppd_id: any;
|
|
52
|
+
reason: any;
|
|
53
|
+
reference_number: any;
|
|
54
|
+
};
|
|
55
|
+
pending: boolean;
|
|
56
|
+
pending_transaction_id: any;
|
|
57
|
+
personal_finance_category: any;
|
|
58
|
+
transaction_code: any;
|
|
59
|
+
transaction_id: string;
|
|
60
|
+
transaction_type: string;
|
|
61
|
+
unofficial_currency_code: string;
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IPaginatorOptions } from './collaterals.interface';
|
|
2
|
+
|
|
3
|
+
export interface IUploadData {
|
|
4
|
+
borrowerId: string;
|
|
5
|
+
bbcDate: Date;
|
|
6
|
+
uploadUser: string;
|
|
7
|
+
fileHash: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
sheetName: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IUploadedDataView {
|
|
13
|
+
totalItems: number;
|
|
14
|
+
items: {}[];
|
|
15
|
+
paginatorOptions: IPaginatorOptions;
|
|
16
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import mongoose, { Document } from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const mongooseLeanId = require('../plugins/id.plugin');
|
|
4
|
+
|
|
5
|
+
export interface IEmailRecipient {
|
|
6
|
+
email: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IEmailRecipientDocument extends IEmailRecipient, Document {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IComplianceItem {
|
|
15
|
+
name: string;
|
|
16
|
+
importanceScore: number;
|
|
17
|
+
notificationDays: number;
|
|
18
|
+
multiplier: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IBorrowerItem {
|
|
22
|
+
item: IComplianceItemDocument;
|
|
23
|
+
startDate: Date;
|
|
24
|
+
frequency: string;
|
|
25
|
+
instances: IBorrowerItemInstanceDocument[];
|
|
26
|
+
emailAddresses: IEmailRecipientDocument[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IComplianceFile {
|
|
30
|
+
_id?: string;
|
|
31
|
+
fileId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
isFileNew?: boolean;
|
|
34
|
+
uploadedAt?: Date;
|
|
35
|
+
uploadedBy?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IBorrowerItemInstance {
|
|
39
|
+
nextDate: Date;
|
|
40
|
+
submittedDate: Date;
|
|
41
|
+
status: string;
|
|
42
|
+
files?: IComplianceFile[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export interface IBorrowerItemInstanceDocument extends IBorrowerItemInstance, Document {
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IComplianceItemDocument extends IComplianceItem, Document {
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IBorrowerItemDocument extends IBorrowerItem, Document {
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ComplianceItemSchema = new mongoose.Schema(
|
|
56
|
+
{
|
|
57
|
+
name: {
|
|
58
|
+
type: String,
|
|
59
|
+
trim: true,
|
|
60
|
+
required: true,
|
|
61
|
+
},
|
|
62
|
+
importanceScore: {
|
|
63
|
+
type: Number,
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
notificationDays: {
|
|
67
|
+
type: Number,
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
multiplier: {
|
|
71
|
+
type: Number,
|
|
72
|
+
required: true,
|
|
73
|
+
},
|
|
74
|
+
__v: { type: Number, select: false },
|
|
75
|
+
},
|
|
76
|
+
{ timestamps: true }
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
ComplianceItemSchema.plugin(mongooseLeanId);
|
|
80
|
+
|
|
81
|
+
export default mongoose.model<IComplianceItemDocument>('complianceItems', ComplianceItemSchema);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { IInventoryItemDocWithCalculation } from './InventoryItem.model';
|
|
4
|
-
import { EInventoryAvailabilityResults } from '../
|
|
4
|
+
import { EInventoryAvailabilityResults } from '../enums/inventory-availability-results.enum';
|
|
5
5
|
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
6
6
|
|
|
7
7
|
const mongooseLeanId = require('../plugins/id.plugin');
|