@getjones/test-infra 2.11.0 → 2.11.2
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 +1 -1
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +1 -1
- package/src/saas/internal-api/contractors/api/contractors.api.js +3 -3
- package/src/saas/internal-api/contractors/api/contractors.service.js +4 -3
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +2 -1
- package/src/saas/internal-api/requirements/utils/utils.js +21 -8
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ const env = require('../../../../../env');
|
|
|
3
3
|
const accountsAPI = require('./accounts.core.api');
|
|
4
4
|
const CreateAccountModel = require('../../models/core/create.account.model');
|
|
5
5
|
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
6
|
-
const httpResponseStatusCodes = require('
|
|
6
|
+
const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
|
|
7
7
|
|
|
8
8
|
const { accountCreationSecret } = env.getEnv();
|
|
9
9
|
|
|
@@ -49,8 +49,8 @@ const deleteByContractorId = (contractorId, context) => {
|
|
|
49
49
|
return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
|
|
52
|
+
const archiveRecord = (recordVerificationModel, context) => {
|
|
53
|
+
return requests.deleteRequestHandler(Endpoints.archive(recordVerificationModel.contractorId), context, {}, {}, recordVerificationModel);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const restoreRecord = (recordVerificationModel, context) => {
|
|
@@ -146,7 +146,7 @@ module.exports = {
|
|
|
146
146
|
getContractorById,
|
|
147
147
|
getRecordHistory,
|
|
148
148
|
deleteByContractorId,
|
|
149
|
-
|
|
149
|
+
archiveRecord,
|
|
150
150
|
restoreRecord,
|
|
151
151
|
editContractor,
|
|
152
152
|
updateInviteDate,
|
|
@@ -28,8 +28,9 @@ const getRecordHistory = (contractorId, context) => {
|
|
|
28
28
|
return contractorsAPI.getRecordHistory(contractorId, context);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const archiveRecord = (recordVerificationModel, context) => {
|
|
32
|
+
validateType(recordVerificationModel, RecordModifyDateVerificationModel);
|
|
33
|
+
return contractorsAPI.archiveRecord(recordVerificationModel, context);
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
const restoreRecord = (recordVerificationModel, context) => {
|
|
@@ -172,7 +173,7 @@ module.exports = {
|
|
|
172
173
|
getContractorsByAccountId,
|
|
173
174
|
getContractorById,
|
|
174
175
|
getRecordHistory,
|
|
175
|
-
|
|
176
|
+
archiveRecord,
|
|
176
177
|
restoreRecord,
|
|
177
178
|
editContractor,
|
|
178
179
|
updateInviteDate,
|
|
@@ -4,19 +4,30 @@ const { UpdateRequirementModel } = require('../models/update.requirement.model')
|
|
|
4
4
|
const { AttributeModel, PolicyModel, AttributeTypes } = require('../models/policy.model');
|
|
5
5
|
const { CreateRequirementModel } = require('../models/create.requirement.model');
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const customAttributes = {
|
|
8
|
+
Including: 'multiple',
|
|
9
|
+
indemnityPeriod: 'Indemnity Period'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const convertNumericValuesToNumberType = function(value, attributeName) {
|
|
8
13
|
if (dataTypeUtils.isString(value) && value.startsWith('$')) {
|
|
9
14
|
return Number(value.replace(/[$,]/g, ''));
|
|
10
15
|
}
|
|
11
16
|
|
|
17
|
+
if (attributeName === customAttributes.indemnityPeriod) {
|
|
18
|
+
return Number(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
return value;
|
|
13
22
|
};
|
|
14
23
|
|
|
15
|
-
const preparePolicyAttributesTypes = function(value) {
|
|
16
|
-
const attributesValue = convertNumericValuesToNumberType(value);
|
|
24
|
+
const preparePolicyAttributesTypes = function(value, attributeName) {
|
|
25
|
+
const attributesValue = convertNumericValuesToNumberType(value, attributeName);
|
|
17
26
|
|
|
18
27
|
if (dataTypeUtils.isNumber(attributesValue)) {
|
|
19
|
-
return
|
|
28
|
+
return attributeName === customAttributes.indemnityPeriod ?
|
|
29
|
+
AttributeTypes.get(attributeTypes.numeric) :
|
|
30
|
+
AttributeTypes.get(attributeTypes.limit);
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
if (dataTypeUtils.isBoolean(attributesValue)) {
|
|
@@ -46,12 +57,14 @@ const parseRequirementConfig = function(config) {
|
|
|
46
57
|
|
|
47
58
|
if (dataTypeUtils.isObject(config[policy])) {
|
|
48
59
|
for (const attribute in config[policy]) {
|
|
60
|
+
const attributeName = customAttributes[attribute] || attribute;
|
|
61
|
+
|
|
49
62
|
attributes.push({
|
|
50
|
-
name:
|
|
51
|
-
type: preparePolicyAttributesTypes(config[policy][attribute]),
|
|
52
|
-
values:
|
|
63
|
+
name: attributeName,
|
|
64
|
+
type: preparePolicyAttributesTypes(config[policy][attribute], attributeName),
|
|
65
|
+
values: attributeName === customAttributes.Including ?
|
|
53
66
|
config[policy][attribute].split(', ') :
|
|
54
|
-
[convertNumericValuesToNumberType(config[policy][attribute])]
|
|
67
|
+
[convertNumericValuesToNumberType(config[policy][attribute], attributeName)]
|
|
55
68
|
});
|
|
56
69
|
};
|
|
57
70
|
} else {
|