@getjones/test-infra 1.8.1 → 1.11.0
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 +29 -29
- package/src/common/factory/index.js +3 -0
- package/src/common/factory/records/records.js +45 -0
- package/src/common/httpResponseStatusCodes.json +11 -11
- package/src/common/requests/apiKeyAuth/requests.js +38 -38
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/requestHandlers.js +60 -60
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/timeUtils.js +147 -0
- package/src/common/validations/errorValidation.js +16 -16
- package/src/common/validations/typeValidations.js +36 -36
- package/src/env.js +45 -44
- package/src/index.js +67 -65
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +77 -77
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +24 -24
- package/src/saas/internal-api/accounts/index.js +20 -20
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +15 -15
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +19 -19
- package/src/saas/internal-api/accounts/utils/utils.js +32 -32
- package/src/saas/internal-api/auth/api/auth.api.js +12 -12
- package/src/saas/internal-api/auth/api/auth.service.js +47 -47
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/coi/api/coi.api.js +34 -34
- package/src/saas/internal-api/coi/api/coi.service.js +22 -22
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +7 -7
- package/src/saas/internal-api/coi/index.js +13 -13
- package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
- package/src/saas/internal-api/coi/utils/utils.js +48 -48
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +40 -40
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +33 -33
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +24 -24
- package/src/saas/internal-api/compliance/api/waive/waive.api.js +21 -21
- package/src/saas/internal-api/compliance/api/waive/waive.service.js +15 -15
- package/src/saas/internal-api/compliance/index.js +22 -22
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +110 -110
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +45 -45
- package/src/saas/internal-api/contractors/api/contractors.api.js +159 -121
- package/src/saas/internal-api/contractors/api/contractors.service.js +136 -101
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +69 -91
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -33
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -0
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +19 -0
- package/src/saas/internal-api/dbEmails/index.js +3 -0
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -0
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +76 -76
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +83 -83
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +43 -43
- package/src/saas/internal-api/globalRecord/utils/util.js +148 -148
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +17 -17
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +39 -39
- package/src/saas/internal-api/projects/utils/utils.js +82 -82
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/reports/api/reports.api.js +39 -39
- package/src/saas/internal-api/reports/api/reports.service.js +34 -34
- package/src/saas/internal-api/reports/consts/consts.js +63 -63
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +28 -0
- package/src/saas/internal-api/requests/api/requests.service.js +19 -0
- package/src/saas/internal-api/requests/index.js +11 -0
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -0
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -0
- package/src/saas/internal-api/requests/models/validation.models.js +8 -0
- package/src/saas/internal-api/requirements/api/requirements.api.js +27 -27
- package/src/saas/internal-api/requirements/api/requirements.service.js +23 -23
- package/src/saas/internal-api/requirements/index.js +6 -6
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +45 -45
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +18 -18
- package/src/saas/internal-api/thread-scheduler/runner.js +13 -13
- package/src/saas/internal-api/users/api/users.api.js +78 -78
- package/src/saas/internal-api/users/api/users.service.js +101 -101
- package/src/saas/internal-api/users/index.js +4 -4
- package/src/saas/internal-api/users/models/users.model.js +31 -31
- package/src/saas/internal-api/users/utils/util.js +14 -14
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/contractors/contractors.api.js +20 -20
- package/src/saas/openapi/contractors/contractors.service.js +18 -18
- package/src/saas/openapi/contractors/index.js +6 -6
- package/src/saas/openapi/contractors/models/invite.contractor.model.js +37 -37
- package/src/saas/openapi/projects/projects.api.js +59 -59
- package/src/saas/openapi/projects/projects.service.js +44 -44
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +12 -12
- package/src/saas/openapi/requirements/requirements.service.js +20 -20
- package/src/saas/openapi/tabs/tabs.api.js +13 -13
- package/src/saas/openapi/tabs/tabs.service.js +7 -7
- package/tests/env.test.js +40 -40
- package/tests/validation.test.js +83 -83
- package/src/common/utils/dateUtils.js +0 -6
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
const accountsAPI = require('./accounts.openapi.api');
|
|
2
|
-
const crypto = require('crypto');
|
|
3
|
-
|
|
4
|
-
const generateApiKeyValue = accountName => {
|
|
5
|
-
return crypto.createHash('sha256').update(accountName).digest('base64');
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const createStaticApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'ACCOUNT_STATIC', apiKeyName = null } = {}) => {
|
|
9
|
-
const data = { accountId, apiKeyValue, apiKeyName, apiKeyType };
|
|
10
|
-
return accountsAPI.createStaticApiKey(data, context);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const createGeneratorApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'GENERATOR', apiKeyName = null } = {}) => {
|
|
14
|
-
const data = { accountId, apiKeyValue, apiKeyName, apiKeyType };
|
|
15
|
-
return accountsAPI.createGeneratorApiKey(data, context);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const getStaticApiKeyByAccountId = async (accountId, context) => {
|
|
19
|
-
return accountsAPI.getStaticApiKeyByAccountId(accountId, context);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getApiKeyDetails = async (apiKeyValue, context) => {
|
|
23
|
-
return accountsAPI.getApiKeyDetails(apiKeyValue, context);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const deleteStaticApiKey = async (accountId, context) => {
|
|
27
|
-
return accountsAPI.deleteStaticApiKey(accountId, context);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const getOrCreateStaticApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'ACCOUNT_STATIC', apiKeyName = null } = {}) => {
|
|
31
|
-
let response = await getStaticApiKeyByAccountId(accountId, context);
|
|
32
|
-
|
|
33
|
-
if (response.data.apiKeyValue) {
|
|
34
|
-
return response.data;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
response = await getApiKeyDetails(apiKeyValue, context);
|
|
38
|
-
|
|
39
|
-
if (!response.data.apiKeyValue) {
|
|
40
|
-
response = await createStaticApiKey(accountId, apiKeyValue, context, { apiKeyType, apiKeyName });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return response.data;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const getOrCreateGeneratorApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'GENERATOR', apiKeyName = null } = {}) => {
|
|
47
|
-
const existingApiKey = await getApiKeyDetails(apiKeyValue, context);
|
|
48
|
-
|
|
49
|
-
if (!existingApiKey.apiKeyValue) {
|
|
50
|
-
return createGeneratorApiKey(accountId, apiKeyValue, context, { apiKeyType, apiKeyName });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return existingApiKey;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const deleteDynamicApiKey = async (accountId, context) => {
|
|
57
|
-
return accountsAPI.deleteDynamicApiKey(accountId, context);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const makeDynamicApiKeyExpired = async (accountId, context) => {
|
|
61
|
-
return accountsAPI.makeDynamicApiKeyExpired(accountId, context);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
module.exports = {
|
|
65
|
-
createStaticApiKey,
|
|
66
|
-
generateApiKeyValue,
|
|
67
|
-
getOrCreateStaticApiKey,
|
|
68
|
-
getOrCreateGeneratorApiKey,
|
|
69
|
-
getStaticApiKeyByAccountId,
|
|
70
|
-
getApiKeyDetails,
|
|
71
|
-
makeDynamicApiKeyExpired,
|
|
72
|
-
deleteStaticApiKey,
|
|
73
|
-
deleteDynamicApiKey
|
|
74
|
-
};
|
|
1
|
+
const accountsAPI = require('./accounts.openapi.api');
|
|
2
|
+
const crypto = require('crypto');
|
|
3
|
+
|
|
4
|
+
const generateApiKeyValue = accountName => {
|
|
5
|
+
return crypto.createHash('sha256').update(accountName).digest('base64');
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const createStaticApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'ACCOUNT_STATIC', apiKeyName = null } = {}) => {
|
|
9
|
+
const data = { accountId, apiKeyValue, apiKeyName, apiKeyType };
|
|
10
|
+
return accountsAPI.createStaticApiKey(data, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const createGeneratorApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'GENERATOR', apiKeyName = null } = {}) => {
|
|
14
|
+
const data = { accountId, apiKeyValue, apiKeyName, apiKeyType };
|
|
15
|
+
return accountsAPI.createGeneratorApiKey(data, context);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getStaticApiKeyByAccountId = async (accountId, context) => {
|
|
19
|
+
return accountsAPI.getStaticApiKeyByAccountId(accountId, context);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const getApiKeyDetails = async (apiKeyValue, context) => {
|
|
23
|
+
return accountsAPI.getApiKeyDetails(apiKeyValue, context);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const deleteStaticApiKey = async (accountId, context) => {
|
|
27
|
+
return accountsAPI.deleteStaticApiKey(accountId, context);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getOrCreateStaticApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'ACCOUNT_STATIC', apiKeyName = null } = {}) => {
|
|
31
|
+
let response = await getStaticApiKeyByAccountId(accountId, context);
|
|
32
|
+
|
|
33
|
+
if (response.data.apiKeyValue) {
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
response = await getApiKeyDetails(apiKeyValue, context);
|
|
38
|
+
|
|
39
|
+
if (!response.data.apiKeyValue) {
|
|
40
|
+
response = await createStaticApiKey(accountId, apiKeyValue, context, { apiKeyType, apiKeyName });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return response.data;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const getOrCreateGeneratorApiKey = async (accountId, apiKeyValue, context, { apiKeyType = 'GENERATOR', apiKeyName = null } = {}) => {
|
|
47
|
+
const existingApiKey = await getApiKeyDetails(apiKeyValue, context);
|
|
48
|
+
|
|
49
|
+
if (!existingApiKey.apiKeyValue) {
|
|
50
|
+
return createGeneratorApiKey(accountId, apiKeyValue, context, { apiKeyType, apiKeyName });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return existingApiKey;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const deleteDynamicApiKey = async (accountId, context) => {
|
|
57
|
+
return accountsAPI.deleteDynamicApiKey(accountId, context);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const makeDynamicApiKeyExpired = async (accountId, context) => {
|
|
61
|
+
return accountsAPI.makeDynamicApiKeyExpired(accountId, context);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
createStaticApiKey,
|
|
66
|
+
generateApiKeyValue,
|
|
67
|
+
getOrCreateStaticApiKey,
|
|
68
|
+
getOrCreateGeneratorApiKey,
|
|
69
|
+
getStaticApiKeyByAccountId,
|
|
70
|
+
getApiKeyDetails,
|
|
71
|
+
makeDynamicApiKeyExpired,
|
|
72
|
+
deleteStaticApiKey,
|
|
73
|
+
deleteDynamicApiKey
|
|
74
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
get: accountId => `${backendUrl}/saas/account/${accountId}/settings`,
|
|
6
|
-
edit: accountId => `${backendUrl}/saas/account/${accountId}/settings`
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const getAccountSettings = (accountId, context) => {
|
|
10
|
-
return requests.getRequestHandler(Endpoints.get(accountId), {}, context);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
14
|
-
const { accountId } = updateAccountSettingsModel;
|
|
15
|
-
return requests.putRequestHandler(Endpoints.edit(accountId), updateAccountSettingsModel, context);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
19
|
-
getAccountSettings,
|
|
20
|
-
updateAccountSettings
|
|
21
|
-
};
|
|
1
|
+
const requests = require('../../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
get: accountId => `${backendUrl}/saas/account/${accountId}/settings`,
|
|
6
|
+
edit: accountId => `${backendUrl}/saas/account/${accountId}/settings`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getAccountSettings = (accountId, context) => {
|
|
10
|
+
return requests.getRequestHandler(Endpoints.get(accountId), {}, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
14
|
+
const { accountId } = updateAccountSettingsModel;
|
|
15
|
+
return requests.putRequestHandler(Endpoints.edit(accountId), updateAccountSettingsModel, context);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
getAccountSettings,
|
|
20
|
+
updateAccountSettings
|
|
21
|
+
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const accountsAPI = require('./settings.api');
|
|
2
|
-
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
|
-
const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
|
|
4
|
-
|
|
5
|
-
const getAccountSettings = (accountId, context) => {
|
|
6
|
-
return accountsAPI.getAccountSettings(accountId, context);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
10
|
-
validateType(updateAccountSettingsModel, UpdateAccountSettingsModel);
|
|
11
|
-
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const restoreAccountSettings = (accountId, context) => {
|
|
15
|
-
const [isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit] = [false, false, false, false, false];
|
|
16
|
-
const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit);
|
|
17
|
-
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = {
|
|
21
|
-
getAccountSettings,
|
|
22
|
-
updateAccountSettings,
|
|
23
|
-
restoreAccountSettings
|
|
24
|
-
};
|
|
1
|
+
const accountsAPI = require('./settings.api');
|
|
2
|
+
const { validateType } = require('../../../../../common/validations/typeValidations');
|
|
3
|
+
const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
|
|
4
|
+
|
|
5
|
+
const getAccountSettings = (accountId, context) => {
|
|
6
|
+
return accountsAPI.getAccountSettings(accountId, context);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const updateAccountSettings = (updateAccountSettingsModel, context) => {
|
|
10
|
+
validateType(updateAccountSettingsModel, UpdateAccountSettingsModel);
|
|
11
|
+
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const restoreAccountSettings = (accountId, context) => {
|
|
15
|
+
const [isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit] = [false, false, false, false, false];
|
|
16
|
+
const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit);
|
|
17
|
+
return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
getAccountSettings,
|
|
22
|
+
updateAccountSettings,
|
|
23
|
+
restoreAccountSettings
|
|
24
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const CreateAccountModel = require('./models/core/create.account.model');
|
|
2
|
-
const coreModels = { CreateAccountModel };
|
|
3
|
-
|
|
4
|
-
const UpdateAccountSettingsModel = require('./models/settings/update.settings.model');
|
|
5
|
-
const settingsModels = { UpdateAccountSettingsModel };
|
|
6
|
-
|
|
7
|
-
const models = { core: coreModels, settings: settingsModels };
|
|
8
|
-
const utils = require('./utils/utils');
|
|
9
|
-
|
|
10
|
-
const coreService = require('./api/core/accounts.core.service');
|
|
11
|
-
const openApiServices = require('./api/openapi/accounts.openapi.service');
|
|
12
|
-
const settingsServices = require('./api/settings/settings.service');
|
|
13
|
-
|
|
14
|
-
const services = {
|
|
15
|
-
core: coreService,
|
|
16
|
-
openApi: openApiServices,
|
|
17
|
-
settings: settingsServices
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = { services, models, utils };
|
|
1
|
+
const CreateAccountModel = require('./models/core/create.account.model');
|
|
2
|
+
const coreModels = { CreateAccountModel };
|
|
3
|
+
|
|
4
|
+
const UpdateAccountSettingsModel = require('./models/settings/update.settings.model');
|
|
5
|
+
const settingsModels = { UpdateAccountSettingsModel };
|
|
6
|
+
|
|
7
|
+
const models = { core: coreModels, settings: settingsModels };
|
|
8
|
+
const utils = require('./utils/utils');
|
|
9
|
+
|
|
10
|
+
const coreService = require('./api/core/accounts.core.service');
|
|
11
|
+
const openApiServices = require('./api/openapi/accounts.openapi.service');
|
|
12
|
+
const settingsServices = require('./api/settings/settings.service');
|
|
13
|
+
|
|
14
|
+
const services = {
|
|
15
|
+
core: coreService,
|
|
16
|
+
openApi: openApiServices,
|
|
17
|
+
settings: settingsServices
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = { services, models, utils };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const env = require('../../../../../env');
|
|
2
|
-
const { credentials, accountCreationSecret } = env.getEnv();
|
|
3
|
-
const PROPERTY_TYPE = 'Property Management';
|
|
4
|
-
|
|
5
|
-
function CreateAccountModel(accountName, email, password = credentials.strongPassword,
|
|
6
|
-
secret = accountCreationSecret, propertyType = PROPERTY_TYPE) {
|
|
7
|
-
this.companyName = accountName;
|
|
8
|
-
this.email = email;
|
|
9
|
-
this.password = password;
|
|
10
|
-
this.verifyPassword = password;
|
|
11
|
-
this.secret = secret;
|
|
12
|
-
this.userType = propertyType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = CreateAccountModel;
|
|
1
|
+
const env = require('../../../../../env');
|
|
2
|
+
const { credentials, accountCreationSecret } = env.getEnv();
|
|
3
|
+
const PROPERTY_TYPE = 'Property Management';
|
|
4
|
+
|
|
5
|
+
function CreateAccountModel(accountName, email, password = credentials.strongPassword,
|
|
6
|
+
secret = accountCreationSecret, propertyType = PROPERTY_TYPE) {
|
|
7
|
+
this.companyName = accountName;
|
|
8
|
+
this.email = email;
|
|
9
|
+
this.password = password;
|
|
10
|
+
this.verifyPassword = password;
|
|
11
|
+
this.secret = secret;
|
|
12
|
+
this.userType = propertyType;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = CreateAccountModel;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
class UpdateAccountSettingsModel {
|
|
2
|
-
constructor(
|
|
3
|
-
accountId,
|
|
4
|
-
isHighPriority,
|
|
5
|
-
hasAnalyticsDashboard,
|
|
6
|
-
isExcludedFromNetwork,
|
|
7
|
-
isOcrEnabled,
|
|
8
|
-
isCoverageAudit
|
|
9
|
-
) {
|
|
10
|
-
this.accountId = accountId;
|
|
11
|
-
this.isHighPriority = isHighPriority;
|
|
12
|
-
this.hasAnalyticsDashboard = hasAnalyticsDashboard;
|
|
13
|
-
this.isExcludedFromNetwork = isExcludedFromNetwork;
|
|
14
|
-
this.isOcrEnabled = isOcrEnabled;
|
|
15
|
-
this.isCoverageAudit = isCoverageAudit;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = UpdateAccountSettingsModel;
|
|
1
|
+
class UpdateAccountSettingsModel {
|
|
2
|
+
constructor(
|
|
3
|
+
accountId,
|
|
4
|
+
isHighPriority,
|
|
5
|
+
hasAnalyticsDashboard,
|
|
6
|
+
isExcludedFromNetwork,
|
|
7
|
+
isOcrEnabled,
|
|
8
|
+
isCoverageAudit
|
|
9
|
+
) {
|
|
10
|
+
this.accountId = accountId;
|
|
11
|
+
this.isHighPriority = isHighPriority;
|
|
12
|
+
this.hasAnalyticsDashboard = hasAnalyticsDashboard;
|
|
13
|
+
this.isExcludedFromNetwork = isExcludedFromNetwork;
|
|
14
|
+
this.isOcrEnabled = isOcrEnabled;
|
|
15
|
+
this.isCoverageAudit = isCoverageAudit;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = UpdateAccountSettingsModel;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const coreService = require('../api/core/accounts.core.service');
|
|
2
|
-
const CreateAccountModel = require('../models/core/create.account.model');
|
|
3
|
-
|
|
4
|
-
const getOrCreateAccount = (context, accountName, email, { password, type } = {}) => {
|
|
5
|
-
const createAccountModel = new CreateAccountModel(
|
|
6
|
-
accountName,
|
|
7
|
-
email,
|
|
8
|
-
password,
|
|
9
|
-
propertyType = type
|
|
10
|
-
);
|
|
11
|
-
return coreService.getOrCreateAccount(createAccountModel, context);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const createAccount = async (context, accountName, email, { password, type } = {}) => {
|
|
15
|
-
const createAccountModel = new CreateAccountModel(
|
|
16
|
-
accountName,
|
|
17
|
-
email,
|
|
18
|
-
password,
|
|
19
|
-
propertyType = type
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const response = await coreService.createAccount(createAccountModel, context);
|
|
23
|
-
return response.data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const deleteAccountByName = async (context, accountName) => {
|
|
27
|
-
const existingAccount = await coreService.getAccount(accountName, context);
|
|
28
|
-
|
|
29
|
-
return existingAccount && coreService.deleteAccountById(existingAccount.userId, context);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = { getOrCreateAccount, createAccount, deleteAccountByName };
|
|
1
|
+
const coreService = require('../api/core/accounts.core.service');
|
|
2
|
+
const CreateAccountModel = require('../models/core/create.account.model');
|
|
3
|
+
|
|
4
|
+
const getOrCreateAccount = (context, accountName, email, { password, type } = {}) => {
|
|
5
|
+
const createAccountModel = new CreateAccountModel(
|
|
6
|
+
accountName,
|
|
7
|
+
email,
|
|
8
|
+
password,
|
|
9
|
+
propertyType = type
|
|
10
|
+
);
|
|
11
|
+
return coreService.getOrCreateAccount(createAccountModel, context);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const createAccount = async (context, accountName, email, { password, type } = {}) => {
|
|
15
|
+
const createAccountModel = new CreateAccountModel(
|
|
16
|
+
accountName,
|
|
17
|
+
email,
|
|
18
|
+
password,
|
|
19
|
+
propertyType = type
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const response = await coreService.createAccount(createAccountModel, context);
|
|
23
|
+
return response.data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const deleteAccountByName = async (context, accountName) => {
|
|
27
|
+
const existingAccount = await coreService.getAccount(accountName, context);
|
|
28
|
+
|
|
29
|
+
return existingAccount && coreService.deleteAccountById(existingAccount.userId, context);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
module.exports = { getOrCreateAccount, createAccount, deleteAccountByName };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
login: `${backendUrl}/logincontroller`
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const login = (email, password) => {
|
|
9
|
-
return requests.postRequestHandler(Endpoints.login, { email, password });
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
module.exports = { login };
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
login: `${backendUrl}/logincontroller`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const login = (email, password) => {
|
|
9
|
+
return requests.postRequestHandler(Endpoints.login, { email, password });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = { login };
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
const { getEnv, requiredValidation } = require('../../../../env');
|
|
2
|
-
const { credentials } = getEnv();
|
|
3
|
-
const authApi = require('./auth.api');
|
|
4
|
-
|
|
5
|
-
const getAuthCookie = async (email, password) => {
|
|
6
|
-
try {
|
|
7
|
-
const response = await authApi.login(email, password);
|
|
8
|
-
const authCookie = response.headers['set-cookie'].find(item => item.startsWith('JonesToken='));
|
|
9
|
-
|
|
10
|
-
return authCookie;
|
|
11
|
-
} catch (error) {
|
|
12
|
-
throw new Error(`Failed to login to email:${email}`, error);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getIcsCookie = () => {
|
|
17
|
-
requiredValidation({
|
|
18
|
-
'credentials.superUser': credentials.superUser,
|
|
19
|
-
'credentials.superUserPassword': credentials.superUserPassword
|
|
20
|
-
});
|
|
21
|
-
return getAuthCookie(credentials.superUser, credentials.superUserPassword);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const getAuditorCookie = () => {
|
|
25
|
-
const { auditorUser, auditorPassword } = credentials;
|
|
26
|
-
requiredValidation({
|
|
27
|
-
'credentials.auditorUser': auditorUser,
|
|
28
|
-
'credentials.auditorPassword': auditorPassword
|
|
29
|
-
});
|
|
30
|
-
return getAuthCookie(auditorUser, auditorPassword);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const getOperatorCookie = () => {
|
|
34
|
-
const { operatorUser, operatorPassword } = credentials;
|
|
35
|
-
requiredValidation({
|
|
36
|
-
'credentials.operatorUser': operatorUser,
|
|
37
|
-
'credentials.operatorPassword': operatorPassword
|
|
38
|
-
});
|
|
39
|
-
return getAuthCookie(operatorUser, operatorPassword);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
getAuthCookie,
|
|
44
|
-
getIcsCookie,
|
|
45
|
-
getAuditorCookie,
|
|
46
|
-
getOperatorCookie
|
|
47
|
-
};
|
|
1
|
+
const { getEnv, requiredValidation } = require('../../../../env');
|
|
2
|
+
const { credentials } = getEnv();
|
|
3
|
+
const authApi = require('./auth.api');
|
|
4
|
+
|
|
5
|
+
const getAuthCookie = async (email, password) => {
|
|
6
|
+
try {
|
|
7
|
+
const response = await authApi.login(email, password);
|
|
8
|
+
const authCookie = response.headers['set-cookie'].find(item => item.startsWith('JonesToken='));
|
|
9
|
+
|
|
10
|
+
return authCookie;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
throw new Error(`Failed to login to email:${email}`, error);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getIcsCookie = () => {
|
|
17
|
+
requiredValidation({
|
|
18
|
+
'credentials.superUser': credentials.superUser,
|
|
19
|
+
'credentials.superUserPassword': credentials.superUserPassword
|
|
20
|
+
});
|
|
21
|
+
return getAuthCookie(credentials.superUser, credentials.superUserPassword);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getAuditorCookie = () => {
|
|
25
|
+
const { auditorUser, auditorPassword } = credentials;
|
|
26
|
+
requiredValidation({
|
|
27
|
+
'credentials.auditorUser': auditorUser,
|
|
28
|
+
'credentials.auditorPassword': auditorPassword
|
|
29
|
+
});
|
|
30
|
+
return getAuthCookie(auditorUser, auditorPassword);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getOperatorCookie = () => {
|
|
34
|
+
const { operatorUser, operatorPassword } = credentials;
|
|
35
|
+
requiredValidation({
|
|
36
|
+
'credentials.operatorUser': operatorUser,
|
|
37
|
+
'credentials.operatorPassword': operatorPassword
|
|
38
|
+
});
|
|
39
|
+
return getAuthCookie(operatorUser, operatorPassword);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
getAuthCookie,
|
|
44
|
+
getIcsCookie,
|
|
45
|
+
getAuditorCookie,
|
|
46
|
+
getOperatorCookie
|
|
47
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const services = require('./api/auth.service');
|
|
2
|
-
|
|
3
|
-
module.exports = { services };
|
|
1
|
+
const services = require('./api/auth.service');
|
|
2
|
+
|
|
3
|
+
module.exports = { services };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const axiosFile = require('axios-file');
|
|
2
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
3
|
-
|
|
4
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
5
|
-
|
|
6
|
-
const Endpoints = {
|
|
7
|
-
uploadToS3: `${backendUrl}/_saas/coi/upload`,
|
|
8
|
-
submitCoi: `${backendUrl}/coi/merge`,
|
|
9
|
-
completeScan: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/complete-scan`,
|
|
10
|
-
getCoiPresignedUrl: fileName => `${backendUrl}/saas/coi/${fileName}`
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const uploadToS3 = (contractorId, fileData) => {
|
|
14
|
-
return axiosFile({
|
|
15
|
-
url: Endpoints.uploadToS3,
|
|
16
|
-
method: 'post',
|
|
17
|
-
params: { contractorId },
|
|
18
|
-
data: { fileData }
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const submitCoi = submitCoiModel => {
|
|
23
|
-
return requests.postRequestHandler(Endpoints.submitCoi, submitCoiModel);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const completeScan = (contractorId, pdfFileName, context) => {
|
|
27
|
-
return requests.postRequestHandler(Endpoints.completeScan(contractorId), { pdfFileName }, context);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
31
|
-
return requests.getRequestHandler(Endpoints.getCoiPresignedUrl(coiFileName), {}, context);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = { uploadToS3, submitCoi, getCoiPreSignedUrl, completeScan };
|
|
1
|
+
const axiosFile = require('axios-file');
|
|
2
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
3
|
+
|
|
4
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
5
|
+
|
|
6
|
+
const Endpoints = {
|
|
7
|
+
uploadToS3: `${backendUrl}/_saas/coi/upload`,
|
|
8
|
+
submitCoi: `${backendUrl}/coi/merge`,
|
|
9
|
+
completeScan: contractorId => `${backendUrl}/saas/auditor/contractors/${contractorId}/coi/complete-scan`,
|
|
10
|
+
getCoiPresignedUrl: fileName => `${backendUrl}/saas/coi/${fileName}`
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const uploadToS3 = (contractorId, fileData) => {
|
|
14
|
+
return axiosFile({
|
|
15
|
+
url: Endpoints.uploadToS3,
|
|
16
|
+
method: 'post',
|
|
17
|
+
params: { contractorId },
|
|
18
|
+
data: { fileData }
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const submitCoi = submitCoiModel => {
|
|
23
|
+
return requests.postRequestHandler(Endpoints.submitCoi, submitCoiModel);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const completeScan = (contractorId, pdfFileName, context) => {
|
|
27
|
+
return requests.postRequestHandler(Endpoints.completeScan(contractorId), { pdfFileName }, context);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getCoiPreSignedUrl = (coiFileName, context) => {
|
|
31
|
+
return requests.getRequestHandler(Endpoints.getCoiPresignedUrl(coiFileName), {}, context);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = { uploadToS3, submitCoi, getCoiPreSignedUrl, completeScan };
|