@getjones/test-infra 2.5.0 → 2.6.1

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.
Files changed (144) hide show
  1. package/package.json +30 -30
  2. package/src/common/commonFlows/index.js +3 -3
  3. package/src/common/commonFlows/records/records.js +71 -71
  4. package/src/common/httpResponseStatusCodes.json +11 -11
  5. package/src/common/requests/apiKeyAuth/requests.js +38 -38
  6. package/src/common/requests/cookieAuth/requests.js +40 -40
  7. package/src/common/requests/requestHandlers.js +60 -60
  8. package/src/common/utils/dataTypeUtils.js +41 -41
  9. package/src/common/utils/numberUtils.js +22 -22
  10. package/src/common/utils/objectUtils.js +9 -9
  11. package/src/common/utils/timeUtils.js +171 -171
  12. package/src/common/validations/errorValidation.js +16 -16
  13. package/src/common/validations/typeValidations.js +36 -36
  14. package/src/defaults/configs/auditConfigs.js +85 -85
  15. package/src/defaults/configs/polices.js +47 -47
  16. package/src/defaults/configs/requirement.js +29 -29
  17. package/src/defaults/index.js +5 -5
  18. package/src/env.js +57 -57
  19. package/src/index.js +73 -73
  20. package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
  21. package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +77 -77
  22. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
  23. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
  24. package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
  25. package/src/saas/internal-api/accounts/api/settings/settings.service.js +24 -24
  26. package/src/saas/internal-api/accounts/consts/consts.js +6 -6
  27. package/src/saas/internal-api/accounts/index.js +21 -21
  28. package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
  29. package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +23 -23
  30. package/src/saas/internal-api/accounts/utils/utils.js +32 -32
  31. package/src/saas/internal-api/auth/api/auth.api.js +18 -18
  32. package/src/saas/internal-api/auth/api/auth.service.js +67 -67
  33. package/src/saas/internal-api/auth/index.js +3 -3
  34. package/src/saas/internal-api/coi/api/coi.api.js +34 -34
  35. package/src/saas/internal-api/coi/api/coi.service.js +22 -22
  36. package/src/saas/internal-api/coi/consts/uploaderTypes.js +7 -7
  37. package/src/saas/internal-api/coi/index.js +13 -13
  38. package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
  39. package/src/saas/internal-api/coi/utils/utils.js +48 -48
  40. package/src/saas/internal-api/compliance/api/audit/audit.api.js +40 -40
  41. package/src/saas/internal-api/compliance/api/audit/audit.service.js +151 -151
  42. package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
  43. package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
  44. package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
  45. package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +24 -24
  46. package/src/saas/internal-api/compliance/api/waive/waive.api.js +21 -21
  47. package/src/saas/internal-api/compliance/api/waive/waive.service.js +15 -15
  48. package/src/saas/internal-api/compliance/consts/audit.js +81 -81
  49. package/src/saas/internal-api/compliance/index.js +28 -28
  50. package/src/saas/internal-api/compliance/models/audit/audit.model.js +84 -84
  51. package/src/saas/internal-api/compliance/models/waive/waive.model.js +45 -45
  52. package/src/saas/internal-api/compliance/utils/util.js +175 -175
  53. package/src/saas/internal-api/contractors/api/contractors.api.js +141 -141
  54. package/src/saas/internal-api/contractors/api/contractors.service.js +147 -123
  55. package/src/saas/internal-api/contractors/index.js +8 -8
  56. package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
  57. package/src/saas/internal-api/contractors/models/edit.contractor.model.js +60 -60
  58. package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
  59. package/src/saas/internal-api/dashboardInnerPage/api/recordList.api.js +12 -12
  60. package/src/saas/internal-api/dashboardInnerPage/api/recordList.service.js +7 -7
  61. package/src/saas/internal-api/dashboardInnerPage/index.js +5 -5
  62. package/src/saas/internal-api/dashboardInnerPage/models/dashboard.filter.criteria.model.js +38 -38
  63. package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
  64. package/src/saas/internal-api/dbEmails/api/db.emails.service.js +127 -127
  65. package/src/saas/internal-api/dbEmails/consts/consts.js +3 -3
  66. package/src/saas/internal-api/dbEmails/index.js +4 -4
  67. package/src/saas/internal-api/dbEmails/models/db.emails.model.js +21 -21
  68. package/src/saas/internal-api/dbEmails/utils/util.js +59 -59
  69. package/src/saas/internal-api/globalRecord/api/global.record.api.js +76 -76
  70. package/src/saas/internal-api/globalRecord/api/global.record.service.js +83 -83
  71. package/src/saas/internal-api/globalRecord/consts.js +20 -20
  72. package/src/saas/internal-api/globalRecord/index.js +6 -6
  73. package/src/saas/internal-api/globalRecord/models/global.record.model.js +43 -43
  74. package/src/saas/internal-api/globalRecord/utils/util.js +148 -148
  75. package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
  76. package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
  77. package/src/saas/internal-api/homepageCharts/index.js +3 -3
  78. package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
  79. package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
  80. package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
  81. package/src/saas/internal-api/projects/api/settings/project.settings.service.js +17 -17
  82. package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
  83. package/src/saas/internal-api/projects/index.js +24 -24
  84. package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
  85. package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
  86. package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +39 -39
  87. package/src/saas/internal-api/projects/utils/utils.js +82 -82
  88. package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
  89. package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
  90. package/src/saas/internal-api/recordNotes/index.js +3 -3
  91. package/src/saas/internal-api/reports/api/reports.api.js +39 -39
  92. package/src/saas/internal-api/reports/api/reports.service.js +34 -34
  93. package/src/saas/internal-api/reports/consts/consts.js +63 -63
  94. package/src/saas/internal-api/reports/index.js +15 -15
  95. package/src/saas/internal-api/reports/models/report.model.js +27 -27
  96. package/src/saas/internal-api/requests/api/requests.api.js +54 -54
  97. package/src/saas/internal-api/requests/api/requests.service.js +51 -51
  98. package/src/saas/internal-api/requests/index.js +14 -14
  99. package/src/saas/internal-api/requests/models/create.request.model.js +22 -22
  100. package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
  101. package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
  102. package/src/saas/internal-api/requests/utils.js +8 -8
  103. package/src/saas/internal-api/requirements/api/requirements.api.js +45 -45
  104. package/src/saas/internal-api/requirements/api/requirements.service.js +94 -94
  105. package/src/saas/internal-api/requirements/consts/attributeTypes.json +5 -5
  106. package/src/saas/internal-api/requirements/consts/consts.js +6 -6
  107. package/src/saas/internal-api/requirements/index.js +8 -8
  108. package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
  109. package/src/saas/internal-api/requirements/models/policy.model.js +32 -32
  110. package/src/saas/internal-api/requirements/models/update.requirement.model.js +21 -21
  111. package/src/saas/internal-api/requirements/utils/utils.js +101 -101
  112. package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
  113. package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
  114. package/src/saas/internal-api/serviceArea/index.js +4 -4
  115. package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
  116. package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
  117. package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
  118. package/src/saas/internal-api/tabs/index.js +3 -3
  119. package/src/saas/internal-api/tabs/models/tabs.model.js +18 -18
  120. package/src/saas/internal-api/thread-scheduler/runner.js +39 -13
  121. package/src/saas/internal-api/users/api/users.api.js +77 -77
  122. package/src/saas/internal-api/users/api/users.service.js +101 -101
  123. package/src/saas/internal-api/users/index.js +4 -4
  124. package/src/saas/internal-api/users/models/users.model.js +31 -31
  125. package/src/saas/internal-api/users/utils/util.js +14 -14
  126. package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
  127. package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
  128. package/src/saas/internal-api/vendorProfile/index.js +3 -3
  129. package/src/saas/openapi/accounts/accounts.api.js +17 -17
  130. package/src/saas/openapi/accounts/accounts.service.js +11 -11
  131. package/src/saas/openapi/projects/projects.api.js +59 -59
  132. package/src/saas/openapi/projects/projects.service.js +44 -44
  133. package/src/saas/openapi/requests/index.js +6 -6
  134. package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
  135. package/src/saas/openapi/requests/requests.api.js +20 -20
  136. package/src/saas/openapi/requests/requests.service.js +18 -18
  137. package/src/saas/openapi/requirements/index.js +6 -6
  138. package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
  139. package/src/saas/openapi/requirements/requirements.api.js +12 -12
  140. package/src/saas/openapi/requirements/requirements.service.js +20 -20
  141. package/src/saas/openapi/tabs/tabs.api.js +13 -13
  142. package/src/saas/openapi/tabs/tabs.service.js +7 -7
  143. package/tests/env.test.js +40 -40
  144. package/tests/validation.test.js +83 -83
@@ -1,48 +1,48 @@
1
- const requests = require('../../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../../env').getEnv();
3
-
4
- const Endpoints = {
5
- createApiKey: `${backendUrl}/saas/api-keys`,
6
- getStaticApiKeyByAccountId: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
7
- getApiKeyByKeyValue: `${backendUrl}/saas/api-keys`,
8
- removeStaticApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
9
- dynamicApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/dynamic-api-key`
10
- };
11
-
12
- const createStaticApiKey = (data, context) => {
13
- return requests.postRequestHandler(Endpoints.createApiKey, data, context);
14
- };
15
-
16
- const createGeneratorApiKey = (data, context) => {
17
- return requests.postRequestHandler(Endpoints.createApiKey, data, context);
18
- };
19
-
20
- const getStaticApiKeyByAccountId = (accountId, context) => {
21
- return requests.getRequestHandler(Endpoints.getStaticApiKeyByAccountId(accountId), {}, context);
22
- };
23
-
24
- const getApiKeyDetails = (apiKeyValue, context) => {
25
- return requests.getRequestHandler(Endpoints.getApiKeyByKeyValue, { apiKeyValue }, context);
26
- };
27
-
28
- const deleteStaticApiKey = (accountId, context) => {
29
- return requests.deleteRequestHandler(Endpoints.removeStaticApiKey(accountId), context);
30
- };
31
-
32
- const deleteDynamicApiKey = (accountId, context) => {
33
- return requests.deleteRequestHandler(Endpoints.dynamicApiKey(accountId), context);
34
- };
35
-
36
- const makeDynamicApiKeyExpired = (accountId, context) => {
37
- return requests.patchRequestHandler(Endpoints.dynamicApiKey(accountId), context, {});
38
- };
39
-
40
- module.exports = {
41
- createStaticApiKey,
42
- createGeneratorApiKey,
43
- getStaticApiKeyByAccountId,
44
- getApiKeyDetails,
45
- makeDynamicApiKeyExpired,
46
- deleteStaticApiKey,
47
- deleteDynamicApiKey
48
- };
1
+ const requests = require('../../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ createApiKey: `${backendUrl}/saas/api-keys`,
6
+ getStaticApiKeyByAccountId: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
7
+ getApiKeyByKeyValue: `${backendUrl}/saas/api-keys`,
8
+ removeStaticApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/static-api-keys`,
9
+ dynamicApiKey: accountId => `${backendUrl}/saas/accounts/${accountId}/dynamic-api-key`
10
+ };
11
+
12
+ const createStaticApiKey = (data, context) => {
13
+ return requests.postRequestHandler(Endpoints.createApiKey, data, context);
14
+ };
15
+
16
+ const createGeneratorApiKey = (data, context) => {
17
+ return requests.postRequestHandler(Endpoints.createApiKey, data, context);
18
+ };
19
+
20
+ const getStaticApiKeyByAccountId = (accountId, context) => {
21
+ return requests.getRequestHandler(Endpoints.getStaticApiKeyByAccountId(accountId), {}, context);
22
+ };
23
+
24
+ const getApiKeyDetails = (apiKeyValue, context) => {
25
+ return requests.getRequestHandler(Endpoints.getApiKeyByKeyValue, { apiKeyValue }, context);
26
+ };
27
+
28
+ const deleteStaticApiKey = (accountId, context) => {
29
+ return requests.deleteRequestHandler(Endpoints.removeStaticApiKey(accountId), context);
30
+ };
31
+
32
+ const deleteDynamicApiKey = (accountId, context) => {
33
+ return requests.deleteRequestHandler(Endpoints.dynamicApiKey(accountId), context);
34
+ };
35
+
36
+ const makeDynamicApiKeyExpired = (accountId, context) => {
37
+ return requests.patchRequestHandler(Endpoints.dynamicApiKey(accountId), context, {});
38
+ };
39
+
40
+ module.exports = {
41
+ createStaticApiKey,
42
+ createGeneratorApiKey,
43
+ getStaticApiKeyByAccountId,
44
+ getApiKeyDetails,
45
+ makeDynamicApiKeyExpired,
46
+ deleteStaticApiKey,
47
+ deleteDynamicApiKey
48
+ };
@@ -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, isAccountRequirementsEnabled] = [false, false, false, false, false, false];
16
- const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit, isAccountRequirementsEnabled);
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, isAccountRequirementsEnabled] = [false, false, false, false, false, false];
16
+ const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId, isHighPriority, hasAnalyticsDashboard, isExcludedFromNetwork, isOcrEnabled, isCoverageAudit, isAccountRequirementsEnabled);
17
+ return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
18
+ };
19
+
20
+ module.exports = {
21
+ getAccountSettings,
22
+ updateAccountSettings,
23
+ restoreAccountSettings
24
+ };
@@ -1,6 +1,6 @@
1
- const ACCOUNT_TYPES = {
2
- PROPERTY: 'Property Management',
3
- CONSTRUCTION: 'Construction'
4
- };
5
-
6
- module.exports = { ACCOUNT_TYPES };
1
+ const ACCOUNT_TYPES = {
2
+ PROPERTY: 'Property Management',
3
+ CONSTRUCTION: 'Construction'
4
+ };
5
+
6
+ module.exports = { ACCOUNT_TYPES };
@@ -1,21 +1,21 @@
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
- const consts = require('./consts/consts');
10
-
11
- const coreService = require('./api/core/accounts.core.service');
12
- const openApiServices = require('./api/openapi/accounts.openapi.service');
13
- const settingsServices = require('./api/settings/settings.service');
14
-
15
- const services = {
16
- core: coreService,
17
- openApi: openApiServices,
18
- settings: settingsServices
19
- };
20
-
21
- module.exports = { services, models, utils, consts };
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
+ const consts = require('./consts/consts');
10
+
11
+ const coreService = require('./api/core/accounts.core.service');
12
+ const openApiServices = require('./api/openapi/accounts.openapi.service');
13
+ const settingsServices = require('./api/settings/settings.service');
14
+
15
+ const services = {
16
+ core: coreService,
17
+ openApi: openApiServices,
18
+ settings: settingsServices
19
+ };
20
+
21
+ module.exports = { services, models, utils, consts };
@@ -1,16 +1,16 @@
1
- const env = require('../../../../../env');
2
- const { credentials, accountCreationSecret } = env.getEnv();
3
- const { ACCOUNT_TYPES } = require('../../consts/consts');
4
-
5
- class CreateAccountModel {
6
- constructor(accountName, email, password = credentials.strongPassword, propertyType = ACCOUNT_TYPES.PROPERTY) {
7
- this.companyName = accountName;
8
- this.email = email;
9
- this.password = password;
10
- this.verifyPassword = password;
11
- this.userType = propertyType;
12
- this.secret = accountCreationSecret;
13
- }
14
- }
15
-
16
- module.exports = CreateAccountModel;
1
+ const env = require('../../../../../env');
2
+ const { credentials, accountCreationSecret } = env.getEnv();
3
+ const { ACCOUNT_TYPES } = require('../../consts/consts');
4
+
5
+ class CreateAccountModel {
6
+ constructor(accountName, email, password = credentials.strongPassword, propertyType = ACCOUNT_TYPES.PROPERTY) {
7
+ this.companyName = accountName;
8
+ this.email = email;
9
+ this.password = password;
10
+ this.verifyPassword = password;
11
+ this.userType = propertyType;
12
+ this.secret = accountCreationSecret;
13
+ }
14
+ }
15
+
16
+ module.exports = CreateAccountModel;
@@ -1,23 +1,23 @@
1
- class UpdateAccountSettingsModel {
2
- constructor(
3
- accountId,
4
- isHighPriority,
5
- hasAnalyticsDashboard,
6
- isEmailOnWelcomePageVA,
7
- isExcludedFromNetwork,
8
- isOcrEnabled,
9
- isCoverageAudit,
10
- isAccountRequirementsEnabled
11
- ) {
12
- this.accountId = accountId;
13
- this.isHighPriority = isHighPriority;
14
- this.hasAnalyticsDashboard = hasAnalyticsDashboard;
15
- this.isEmailOnWelcomePageVA = isEmailOnWelcomePageVA;
16
- this.isExcludedFromNetwork = isExcludedFromNetwork;
17
- this.isOcrEnabled = isOcrEnabled;
18
- this.isCoverageAudit = isCoverageAudit;
19
- this.isAccountRequirementsEnabled = isAccountRequirementsEnabled;
20
- }
21
- }
22
-
23
- module.exports = UpdateAccountSettingsModel;
1
+ class UpdateAccountSettingsModel {
2
+ constructor(
3
+ accountId,
4
+ isHighPriority,
5
+ hasAnalyticsDashboard,
6
+ isEmailOnWelcomePageVA,
7
+ isExcludedFromNetwork,
8
+ isOcrEnabled,
9
+ isCoverageAudit,
10
+ isAccountRequirementsEnabled
11
+ ) {
12
+ this.accountId = accountId;
13
+ this.isHighPriority = isHighPriority;
14
+ this.hasAnalyticsDashboard = hasAnalyticsDashboard;
15
+ this.isEmailOnWelcomePageVA = isEmailOnWelcomePageVA;
16
+ this.isExcludedFromNetwork = isExcludedFromNetwork;
17
+ this.isOcrEnabled = isOcrEnabled;
18
+ this.isCoverageAudit = isCoverageAudit;
19
+ this.isAccountRequirementsEnabled = isAccountRequirementsEnabled;
20
+ }
21
+ }
22
+
23
+ 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,18 +1,18 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const Endpoints = {
5
- login: `${backendUrl}/logincontroller`,
6
- isHubUser: email => `${backendUrl}/vendor-app/is-hub-user?email=${email}`
7
-
8
- };
9
-
10
- const login = (email, password) => {
11
- return requests.postRequestHandler(Endpoints.login, { email, password });
12
- };
13
-
14
- const vendorHubLogin = email => {
15
- return requests.postRequestHandler(Endpoints.isHubUser(email), { email });
16
- };
17
-
18
- module.exports = { login, vendorHubLogin };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ login: `${backendUrl}/logincontroller`,
6
+ isHubUser: email => `${backendUrl}/vendor-app/is-hub-user?email=${email}`
7
+
8
+ };
9
+
10
+ const login = (email, password) => {
11
+ return requests.postRequestHandler(Endpoints.login, { email, password });
12
+ };
13
+
14
+ const vendorHubLogin = email => {
15
+ return requests.postRequestHandler(Endpoints.isHubUser(email), { email });
16
+ };
17
+
18
+ module.exports = { login, vendorHubLogin };