gemcap-be-common 1.5.126 → 1.5.128
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/helpers/main.helper.d.ts +1 -0
- package/helpers/main.helper.js +9 -1
- package/helpers/main.helper.ts +10 -0
- package/models/Appraiser.model.js +1 -0
- package/models/Appraiser.model.ts +1 -0
- package/models/AppraiserContact.model.js +1 -0
- package/models/AppraiserContact.model.ts +1 -0
- package/models/Auditor.model.js +1 -0
- package/models/Auditor.model.ts +1 -0
- package/models/AuditorContact.model.js +1 -0
- package/models/AuditorContact.model.ts +1 -0
- package/package.json +1 -1
- package/services/brokers.service.d.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/helpers/main.helper.d.ts
CHANGED
|
@@ -27,5 +27,6 @@ import Joi from 'joi';
|
|
|
27
27
|
export type TDictionary = Record<string, string | object>;
|
|
28
28
|
export declare const fieldsToUnset: string[];
|
|
29
29
|
export declare const removeFields: <T>(document: mongoose.Document, fieldsToUnset: string[]) => T;
|
|
30
|
+
export declare const sanitizePlainObject: <T extends object>(object: T, fieldsToUnset?: string[]) => T;
|
|
30
31
|
export declare const replaceErrors: (error: Joi.ValidationError, dictionary: TDictionary) => string;
|
|
31
32
|
export declare const getUUID: () => string;
|
package/helpers/main.helper.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getUUID = exports.replaceErrors = exports.removeFields = exports.fieldsToUnset = void 0;
|
|
6
|
+
exports.getUUID = exports.replaceErrors = exports.sanitizePlainObject = exports.removeFields = exports.fieldsToUnset = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
9
|
exports.fieldsToUnset = ['__v', 'createdAt', 'updatedAt'];
|
|
@@ -41,6 +41,14 @@ const removeFields = (document, fieldsToUnset) => {
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
exports.removeFields = removeFields;
|
|
44
|
+
const sanitizePlainObject = (object, fieldsToUnset = []) => {
|
|
45
|
+
const clone = deepCloneAndConvertMaps(object);
|
|
46
|
+
fieldsToUnset.forEach((field) => {
|
|
47
|
+
delete clone[field];
|
|
48
|
+
});
|
|
49
|
+
return clone;
|
|
50
|
+
};
|
|
51
|
+
exports.sanitizePlainObject = sanitizePlainObject;
|
|
44
52
|
const replaceErrors = (error, dictionary) => {
|
|
45
53
|
const getValue = (d, keys) => {
|
|
46
54
|
let currentValue = d;
|
package/helpers/main.helper.ts
CHANGED
|
@@ -41,6 +41,16 @@ export const removeFields = <T>(document: mongoose.Document, fieldsToUnset: stri
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
export const sanitizePlainObject = <T extends object>(object: T, fieldsToUnset: string[] = []): T => {
|
|
45
|
+
const clone = deepCloneAndConvertMaps(object);
|
|
46
|
+
|
|
47
|
+
fieldsToUnset.forEach((field) => {
|
|
48
|
+
delete (clone as Record<string, unknown>)[field];
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return clone;
|
|
52
|
+
};
|
|
53
|
+
|
|
44
54
|
export const replaceErrors = (error: Joi.ValidationError, dictionary: TDictionary) => {
|
|
45
55
|
const getValue = (d: TDictionary, keys: string[]): string => {
|
|
46
56
|
let currentValue: TDictionary | string = d;
|
|
@@ -10,6 +10,7 @@ const _models_1 = require("./_models");
|
|
|
10
10
|
exports.AppraiserValidationSchema = joi_1.default.object({
|
|
11
11
|
_id: joi_1.default.string(),
|
|
12
12
|
name: joi_1.default.string().required(),
|
|
13
|
+
uiId: joi_1.default.string().required(),
|
|
13
14
|
speciality: joi_1.default.string().allow(''),
|
|
14
15
|
isDeleted: joi_1.default.boolean(),
|
|
15
16
|
order: joi_1.default.number().required().allow(null),
|
|
@@ -21,6 +21,7 @@ export interface IAppraiserDoc extends IAppraiser, Document {
|
|
|
21
21
|
export const AppraiserValidationSchema = Joi.object({
|
|
22
22
|
_id: Joi.string(),
|
|
23
23
|
name: Joi.string().required(),
|
|
24
|
+
uiId: Joi.string().required(),
|
|
24
25
|
speciality: Joi.string().allow(''),
|
|
25
26
|
isDeleted: Joi.boolean(),
|
|
26
27
|
order: Joi.number().required().allow (null),
|
|
@@ -10,6 +10,7 @@ const _models_1 = require("./_models");
|
|
|
10
10
|
exports.AppraiserContactValidationSchema = joi_1.default.object({
|
|
11
11
|
_id: joi_1.default.string(),
|
|
12
12
|
appraiserId: joi_1.default.string(),
|
|
13
|
+
uiId: joi_1.default.string().required(),
|
|
13
14
|
name: joi_1.default.string().allow(''),
|
|
14
15
|
title: joi_1.default.string().allow(''),
|
|
15
16
|
emails: joi_1.default.array().items(joi_1.default.string().email()).allow(null),
|
|
@@ -26,6 +26,7 @@ export interface IAppraiserContactDoc extends IAppraiserContact, Document {
|
|
|
26
26
|
export const AppraiserContactValidationSchema = Joi.object({
|
|
27
27
|
_id: Joi.string(),
|
|
28
28
|
appraiserId: Joi.string(),
|
|
29
|
+
uiId: Joi.string().required(),
|
|
29
30
|
name: Joi.string().allow(''),
|
|
30
31
|
title: Joi.string().allow(''),
|
|
31
32
|
emails: Joi.array().items(Joi.string().email()).allow(null),
|
package/models/Auditor.model.js
CHANGED
|
@@ -9,6 +9,7 @@ const joi_1 = __importDefault(require("joi"));
|
|
|
9
9
|
const _models_1 = require("./_models");
|
|
10
10
|
exports.AuditorValidationSchema = joi_1.default.object({
|
|
11
11
|
_id: joi_1.default.string(),
|
|
12
|
+
uiId: joi_1.default.string().required(),
|
|
12
13
|
name: joi_1.default.string().required(),
|
|
13
14
|
isDeleted: joi_1.default.boolean(),
|
|
14
15
|
order: joi_1.default.number().required().allow(null),
|
package/models/Auditor.model.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface IAuditorPlain extends IAuditor {
|
|
|
30
30
|
|
|
31
31
|
export const AuditorValidationSchema = Joi.object({
|
|
32
32
|
_id: Joi.string(),
|
|
33
|
+
uiId: Joi.string().required(),
|
|
33
34
|
name: Joi.string().required(),
|
|
34
35
|
isDeleted: Joi.boolean(),
|
|
35
36
|
order: Joi.number().required().allow (null),
|
|
@@ -10,6 +10,7 @@ const _models_1 = require("./_models");
|
|
|
10
10
|
exports.AuditorContactValidationSchema = joi_1.default.object({
|
|
11
11
|
_id: joi_1.default.string(),
|
|
12
12
|
auditorId: joi_1.default.string(),
|
|
13
|
+
uiId: joi_1.default.string().required(),
|
|
13
14
|
name: joi_1.default.string().required(),
|
|
14
15
|
email: joi_1.default.string().allow(''),
|
|
15
16
|
phone: joi_1.default.string().allow(''),
|
|
@@ -33,6 +33,7 @@ export interface IAuditorContactPlain extends Omit<IAuditorContact, 'auditorId'>
|
|
|
33
33
|
export const AuditorContactValidationSchema = Joi.object({
|
|
34
34
|
_id: Joi.string(),
|
|
35
35
|
auditorId: Joi.string(),
|
|
36
|
+
uiId: Joi.string().required(),
|
|
36
37
|
name: Joi.string().required(),
|
|
37
38
|
email: Joi.string().allow(''),
|
|
38
39
|
phone: Joi.string().allow(''),
|
package/package.json
CHANGED
|
@@ -56,9 +56,9 @@ export declare class BrokersService {
|
|
|
56
56
|
getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
57
57
|
_id: import("mongoose").Types.ObjectId;
|
|
58
58
|
}>)[]>;
|
|
59
|
-
getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
59
|
+
getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & Required<{
|
|
60
60
|
_id: import("mongoose").Types.ObjectId;
|
|
61
|
-
}>)[]
|
|
61
|
+
}>)[]>;
|
|
62
62
|
getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
|
|
63
63
|
getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
|
|
64
64
|
getTotals(borrowerId: string): Promise<BrokerTotalView[]>;
|