@getjones/test-infra 2.10.15 → 2.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.
Files changed (193) hide show
  1. package/package.json +30 -30
  2. package/src/common/commonFlows/auth/auth.js +40 -40
  3. package/src/common/commonFlows/index.js +4 -4
  4. package/src/common/commonFlows/records/records.js +102 -102
  5. package/src/common/consts/dashboardCharts.js +18 -18
  6. package/src/common/consts/recordTypes.js +5 -5
  7. package/src/common/consts/s3FileTypes.js +11 -11
  8. package/src/common/consts/userTypes.js +8 -8
  9. package/src/common/httpResponseStatusCodes.json +11 -11
  10. package/src/common/requests/apiKeyAuth/requests.js +44 -44
  11. package/src/common/requests/cookieAuth/requests.js +40 -40
  12. package/src/common/requests/requestHandlers.js +78 -78
  13. package/src/common/utils/complianceUtil.js +83 -83
  14. package/src/common/utils/configsUtil.js +22 -22
  15. package/src/common/utils/dataTypeUtils.js +41 -41
  16. package/src/common/utils/numberUtils.js +22 -22
  17. package/src/common/utils/objectUtils.js +7 -7
  18. package/src/common/utils/timeUtils.js +177 -177
  19. package/src/common/validations/errorValidation.js +16 -16
  20. package/src/common/validations/typeValidations.js +36 -36
  21. package/src/defaults/configs/auditConfigs.js +91 -91
  22. package/src/defaults/configs/coverage.js +227 -227
  23. package/src/defaults/configs/polices.js +54 -54
  24. package/src/defaults/configs/requirement.js +32 -32
  25. package/src/defaults/index.js +6 -6
  26. package/src/env.js +57 -57
  27. package/src/factory/globalRecord/globalRecord.js +70 -70
  28. package/src/factory/index.js +8 -8
  29. package/src/factory/records/records.js +128 -128
  30. package/src/factory/users/users.js +77 -77
  31. package/src/index.js +89 -89
  32. package/src/resources/virusFile.pdf +0 -0
  33. package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +28 -28
  34. package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +82 -82
  35. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
  36. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
  37. package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
  38. package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
  39. package/src/saas/internal-api/accounts/consts/consts.js +6 -6
  40. package/src/saas/internal-api/accounts/index.js +20 -20
  41. package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
  42. package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +38 -38
  43. package/src/saas/internal-api/accounts/utils/utils.js +58 -58
  44. package/src/saas/internal-api/agreement/api/agreement.api.js +35 -35
  45. package/src/saas/internal-api/agreement/api/agreement.service.js +67 -67
  46. package/src/saas/internal-api/agreement/consts/consts.js +8 -8
  47. package/src/saas/internal-api/agreement/index.js +11 -11
  48. package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
  49. package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
  50. package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
  51. package/src/saas/internal-api/auditNotes/index.js +4 -4
  52. package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
  53. package/src/saas/internal-api/auth/api/auth.api.js +27 -27
  54. package/src/saas/internal-api/auth/api/auth.service.js +90 -90
  55. package/src/saas/internal-api/auth/index.js +3 -3
  56. package/src/saas/internal-api/coi/api/coi.api.js +34 -34
  57. package/src/saas/internal-api/coi/api/coi.service.js +22 -22
  58. package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
  59. package/src/saas/internal-api/coi/index.js +13 -13
  60. package/src/saas/internal-api/coi/models/submit.coi.model.js +9 -9
  61. package/src/saas/internal-api/coi/utils/utils.js +48 -48
  62. package/src/saas/internal-api/compliance/api/audit/audit.api.js +96 -96
  63. package/src/saas/internal-api/compliance/api/audit/audit.service.js +219 -219
  64. package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
  65. package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
  66. package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
  67. package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +48 -48
  68. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +33 -33
  69. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +141 -141
  70. package/src/saas/internal-api/compliance/consts/audit.js +102 -102
  71. package/src/saas/internal-api/compliance/index.js +33 -33
  72. package/src/saas/internal-api/compliance/models/audit/audit.model.js +94 -94
  73. package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
  74. package/src/saas/internal-api/compliance/utils/auditUtil.js +222 -222
  75. package/src/saas/internal-api/compliance/utils/coverageUtil.js +40 -40
  76. package/src/saas/internal-api/contractors/api/contractors.api.js +166 -166
  77. package/src/saas/internal-api/contractors/api/contractors.service.js +198 -198
  78. package/src/saas/internal-api/contractors/consts/consts.js +6 -6
  79. package/src/saas/internal-api/contractors/index.js +9 -9
  80. package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
  81. package/src/saas/internal-api/contractors/models/create.contractor.model.js +22 -22
  82. package/src/saas/internal-api/contractors/models/edit.contractor.model.js +60 -60
  83. package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
  84. package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
  85. package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
  86. package/src/saas/internal-api/dashboard/index.js +5 -5
  87. package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
  88. package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
  89. package/src/saas/internal-api/dbEmails/api/db.emails.service.js +147 -147
  90. package/src/saas/internal-api/dbEmails/consts/consts.js +53 -53
  91. package/src/saas/internal-api/dbEmails/index.js +6 -6
  92. package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
  93. package/src/saas/internal-api/dbEmails/utils/util.js +82 -82
  94. package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
  95. package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
  96. package/src/saas/internal-api/emailCustomization/index.js +3 -3
  97. package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
  98. package/src/saas/internal-api/globalRecord/api/global.record.service.js +106 -106
  99. package/src/saas/internal-api/globalRecord/consts.js +20 -20
  100. package/src/saas/internal-api/globalRecord/index.js +6 -6
  101. package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
  102. package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
  103. package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
  104. package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
  105. package/src/saas/internal-api/homepageCharts/index.js +3 -3
  106. package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
  107. package/src/saas/internal-api/projects/api/core/projects.service.js +65 -65
  108. package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
  109. package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
  110. package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
  111. package/src/saas/internal-api/projects/index.js +24 -24
  112. package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
  113. package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
  114. package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +41 -41
  115. package/src/saas/internal-api/projects/utils/utils.js +156 -156
  116. package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
  117. package/src/saas/internal-api/recordNotes/api/record.notes.service.js +29 -29
  118. package/src/saas/internal-api/recordNotes/index.js +3 -3
  119. package/src/saas/internal-api/reports/api/reports.api.js +39 -39
  120. package/src/saas/internal-api/reports/api/reports.service.js +34 -34
  121. package/src/saas/internal-api/reports/consts/consts.js +64 -64
  122. package/src/saas/internal-api/reports/index.js +15 -15
  123. package/src/saas/internal-api/reports/models/report.model.js +27 -27
  124. package/src/saas/internal-api/requests/api/requests.api.js +78 -78
  125. package/src/saas/internal-api/requests/api/requests.service.js +151 -151
  126. package/src/saas/internal-api/requests/index.js +16 -16
  127. package/src/saas/internal-api/requests/models/create.request.model.js +33 -33
  128. package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
  129. package/src/saas/internal-api/requests/models/inner.page.request.criteria.model.js +17 -17
  130. package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
  131. package/src/saas/internal-api/requests/utils.js +8 -8
  132. package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
  133. package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
  134. package/src/saas/internal-api/requestsTable/index.js +3 -3
  135. package/src/saas/internal-api/requirements/api/requirements.api.js +45 -45
  136. package/src/saas/internal-api/requirements/api/requirements.service.js +134 -134
  137. package/src/saas/internal-api/requirements/consts/attributeTypes.json +5 -6
  138. package/src/saas/internal-api/requirements/consts/consts.js +6 -6
  139. package/src/saas/internal-api/requirements/index.js +10 -10
  140. package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
  141. package/src/saas/internal-api/requirements/models/policy.model.js +33 -33
  142. package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
  143. package/src/saas/internal-api/requirements/utils/utils.js +102 -115
  144. package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
  145. package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
  146. package/src/saas/internal-api/serviceArea/index.js +4 -4
  147. package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
  148. package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
  149. package/src/saas/internal-api/tabs/api/tabs.service.js +54 -54
  150. package/src/saas/internal-api/tabs/index.js +3 -3
  151. package/src/saas/internal-api/tabs/models/tabs.model.js +18 -19
  152. package/src/saas/internal-api/thread-scheduler/runner.js +39 -39
  153. package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +25 -25
  154. package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +32 -32
  155. package/src/saas/internal-api/uploadFiles/consts.js +12 -12
  156. package/src/saas/internal-api/uploadFiles/index.js +3 -3
  157. package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +32 -32
  158. package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +78 -78
  159. package/src/saas/internal-api/users/api/users.api.js +109 -109
  160. package/src/saas/internal-api/users/api/users.service.js +198 -198
  161. package/src/saas/internal-api/users/index.js +16 -16
  162. package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
  163. package/src/saas/internal-api/users/models/notification.settings.model.js +12 -12
  164. package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
  165. package/src/saas/internal-api/users/models/users.model.js +41 -41
  166. package/src/saas/internal-api/users/utils/util.js +39 -39
  167. package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +20 -20
  168. package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +14 -14
  169. package/src/saas/internal-api/vendorProfile/index.js +3 -3
  170. package/src/saas/openapi/accounts/accounts.api.js +17 -17
  171. package/src/saas/openapi/accounts/accounts.service.js +11 -11
  172. package/src/saas/openapi/coi/coi.api.js +20 -20
  173. package/src/saas/openapi/coi/coi.service.js +13 -13
  174. package/src/saas/openapi/projects/projects.api.js +83 -83
  175. package/src/saas/openapi/projects/projects.service.js +64 -64
  176. package/src/saas/openapi/requests/index.js +7 -7
  177. package/src/saas/openapi/requests/models/invite.request.model.js +37 -37
  178. package/src/saas/openapi/requests/models/update.request.model.js +35 -35
  179. package/src/saas/openapi/requests/requests.api.js +76 -76
  180. package/src/saas/openapi/requests/requests.service.js +65 -65
  181. package/src/saas/openapi/requirements/index.js +6 -6
  182. package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
  183. package/src/saas/openapi/requirements/requirements.api.js +32 -32
  184. package/src/saas/openapi/requirements/requirements.service.js +37 -37
  185. package/src/saas/openapi/tabs/index.js +6 -6
  186. package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
  187. package/src/saas/openapi/tabs/tabs.api.js +27 -27
  188. package/src/saas/openapi/tabs/tabs.service.js +19 -19
  189. package/src/saas/openapi/users/user.model.js +10 -10
  190. package/src/saas/openapi/users/users.api.js +33 -33
  191. package/src/saas/openapi/users/users.service.js +41 -41
  192. package/tests/env.test.js +40 -40
  193. package/tests/validation.test.js +83 -83
@@ -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,41 +1,41 @@
1
- const accountsAPI = require('./settings.api');
2
- const { validateType } = require('../../../../../common/validations/typeValidations');
3
- const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
4
- const util = require('../../utils/utils');
5
- const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
6
-
7
- const getAccountSettings = (accountId, context) => {
8
- return accountsAPI.getAccountSettings(accountId, context);
9
- };
10
-
11
- const updateAccountSettings = (updateAccountSettingsModel, context) => {
12
- validateType(updateAccountSettingsModel, UpdateAccountSettingsModel);
13
- return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
14
- };
15
-
16
- const restoreAccountSettings = (accountId, context) => {
17
- const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId);
18
- return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
19
- };
20
-
21
- const setAccountSettings = async (accountId, settings, context) => {
22
- const isUIConfig = util.isUIConfig(settings);
23
-
24
- const settingsConfig = isUIConfig ? util.parseAccountSettingsConfig(accountId, settings) : settings;
25
- const settingsModel = new UpdateAccountSettingsModel(accountId, settingsConfig);
26
-
27
- const updateResponse = await updateAccountSettings(settingsModel, context);
28
-
29
- if (updateResponse.status !== httpResponseStatusCodes.OK) {
30
- throw new Error(`Failed to set account: ${accountId} settings\n${updateResponse.data}`);
31
- }
32
-
33
- return updateResponse;
34
- };
35
-
36
- module.exports = {
37
- getAccountSettings,
38
- updateAccountSettings,
39
- restoreAccountSettings,
40
- setAccountSettings
41
- };
1
+ const accountsAPI = require('./settings.api');
2
+ const { validateType } = require('../../../../../common/validations/typeValidations');
3
+ const UpdateAccountSettingsModel = require('../../models/settings/update.settings.model');
4
+ const util = require('../../utils/utils');
5
+ const httpResponseStatusCodes = require('../../../../../common/httpResponseStatusCodes.json');
6
+
7
+ const getAccountSettings = (accountId, context) => {
8
+ return accountsAPI.getAccountSettings(accountId, context);
9
+ };
10
+
11
+ const updateAccountSettings = (updateAccountSettingsModel, context) => {
12
+ validateType(updateAccountSettingsModel, UpdateAccountSettingsModel);
13
+ return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
14
+ };
15
+
16
+ const restoreAccountSettings = (accountId, context) => {
17
+ const updateAccountSettingsModel = new UpdateAccountSettingsModel(accountId);
18
+ return accountsAPI.updateAccountSettings(updateAccountSettingsModel, context);
19
+ };
20
+
21
+ const setAccountSettings = async (accountId, settings, context) => {
22
+ const isUIConfig = util.isUIConfig(settings);
23
+
24
+ const settingsConfig = isUIConfig ? util.parseAccountSettingsConfig(accountId, settings) : settings;
25
+ const settingsModel = new UpdateAccountSettingsModel(accountId, settingsConfig);
26
+
27
+ const updateResponse = await updateAccountSettings(settingsModel, context);
28
+
29
+ if (updateResponse.status !== httpResponseStatusCodes.OK) {
30
+ throw new Error(`Failed to set account: ${accountId} settings\n${updateResponse.data}`);
31
+ }
32
+
33
+ return updateResponse;
34
+ };
35
+
36
+ module.exports = {
37
+ getAccountSettings,
38
+ updateAccountSettings,
39
+ restoreAccountSettings,
40
+ setAccountSettings
41
+ };
@@ -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,20 +1,20 @@
1
- const CreateAccountModel = require('./models/core/create.account.model');
2
- const coreModels = { CreateAccountModel };
3
- const UpdateAccountSettingsModel = require('./models/settings/update.settings.model');
4
- const settingsModels = { UpdateAccountSettingsModel };
5
-
6
- const models = { core: coreModels, settings: settingsModels };
7
- const utils = require('./utils/utils');
8
- const consts = require('./consts/consts');
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, consts };
1
+ const CreateAccountModel = require('./models/core/create.account.model');
2
+ const coreModels = { CreateAccountModel };
3
+ const UpdateAccountSettingsModel = require('./models/settings/update.settings.model');
4
+ const settingsModels = { UpdateAccountSettingsModel };
5
+
6
+ const models = { core: coreModels, settings: settingsModels };
7
+ const utils = require('./utils/utils');
8
+ const consts = require('./consts/consts');
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, 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,38 +1,38 @@
1
- class UpdateAccountSettingsModel {
2
- constructor(
3
- accountId,
4
- {
5
- isHighPriority = false,
6
- hasAnalyticsDashboard = false,
7
- isEmailOnWelcomePageVA = false,
8
- isExcludedFromNetwork = false,
9
- isOcrEnabled = false,
10
- isCoverageAudit = false,
11
- isAccountRequirementsEnabled = false,
12
- isAccountRequirementsAutoRenewalsEnabled = false,
13
- autoGaps = {},
14
- auditSlaHours = 24,
15
- shouldReachOutVendors = true
16
- } = {}
17
- ) {
18
- this.accountId = accountId;
19
- this.isHighPriority = isHighPriority;
20
- this.hasAnalyticsDashboard = hasAnalyticsDashboard;
21
- this.isEmailOnWelcomePageVA = isEmailOnWelcomePageVA;
22
- this.isExcludedFromNetwork = isExcludedFromNetwork;
23
- this.isOcrEnabled = isOcrEnabled;
24
- this.isCoverageAudit = isCoverageAudit;
25
- this.isAccountRequirementsEnabled = isAccountRequirementsEnabled;
26
- this.isAccountRequirementsAutoRenewalsEnabled = isAccountRequirementsAutoRenewalsEnabled;
27
- this.autoGaps = { ... DEFAULT_AUTO_GAPS, ... autoGaps };
28
- this.auditSlaHours = auditSlaHours;
29
- this.shouldReachOutVendors = shouldReachOutVendors;
30
- }
31
- }
32
-
33
- const DEFAULT_AUTO_GAPS = {
34
- isAutoGapsEnabledForTenants: false,
35
- isAutoGapsEnabledForVendors: false
36
- };
37
-
38
- module.exports = UpdateAccountSettingsModel;
1
+ class UpdateAccountSettingsModel {
2
+ constructor(
3
+ accountId,
4
+ {
5
+ isHighPriority = false,
6
+ hasAnalyticsDashboard = false,
7
+ isEmailOnWelcomePageVA = false,
8
+ isExcludedFromNetwork = false,
9
+ isOcrEnabled = false,
10
+ isCoverageAudit = false,
11
+ isAccountRequirementsEnabled = false,
12
+ isAccountRequirementsAutoRenewalsEnabled = false,
13
+ autoGaps = {},
14
+ auditSlaHours = 24,
15
+ shouldReachOutVendors = true
16
+ } = {}
17
+ ) {
18
+ this.accountId = accountId;
19
+ this.isHighPriority = isHighPriority;
20
+ this.hasAnalyticsDashboard = hasAnalyticsDashboard;
21
+ this.isEmailOnWelcomePageVA = isEmailOnWelcomePageVA;
22
+ this.isExcludedFromNetwork = isExcludedFromNetwork;
23
+ this.isOcrEnabled = isOcrEnabled;
24
+ this.isCoverageAudit = isCoverageAudit;
25
+ this.isAccountRequirementsEnabled = isAccountRequirementsEnabled;
26
+ this.isAccountRequirementsAutoRenewalsEnabled = isAccountRequirementsAutoRenewalsEnabled;
27
+ this.autoGaps = { ... DEFAULT_AUTO_GAPS, ... autoGaps };
28
+ this.auditSlaHours = auditSlaHours;
29
+ this.shouldReachOutVendors = shouldReachOutVendors;
30
+ }
31
+ }
32
+
33
+ const DEFAULT_AUTO_GAPS = {
34
+ isAutoGapsEnabledForTenants: false,
35
+ isAutoGapsEnabledForVendors: false
36
+ };
37
+
38
+ module.exports = UpdateAccountSettingsModel;
@@ -1,58 +1,58 @@
1
- const coreService = require('../api/core/accounts.core.service');
2
- const CreateAccountModel = require('../models/core/create.account.model');
3
- const configsUtil = require('../../../../common/utils/configsUtil');
4
-
5
- const getOrCreateAccount = (context, accountName, email, { password, type } = {}) => {
6
- const createAccountModel = new CreateAccountModel(
7
- accountName,
8
- email,
9
- password,
10
- propertyType = type
11
- );
12
- return coreService.getOrCreateAccount(createAccountModel, context);
13
- };
14
-
15
- const createAccount = async (context, accountName, email, { password, type } = {}) => {
16
- const createAccountModel = new CreateAccountModel(
17
- accountName,
18
- email,
19
- password,
20
- propertyType = type
21
- );
22
-
23
- const response = await coreService.createAccount(createAccountModel, context);
24
- return response.data;
25
- };
26
-
27
- const deleteAccountByName = async (context, accountName) => {
28
- const existingAccount = await coreService.getAccount(accountName, context);
29
-
30
- return existingAccount && coreService.deleteAccountById(existingAccount.userId, context);
31
- };
32
-
33
- const isUIConfig = config => {
34
- return configsUtil.isUIConfig(config, attributesConvertor);
35
- };
36
-
37
- const parseAccountSettingsConfig = (accountId, settingsConfig) => {
38
- const settings = configsUtil.objectConvertor(settingsConfig, attributesConvertor);
39
- return { ... settings, accountId };
40
- };
41
-
42
- module.exports = {
43
- getOrCreateAccount,
44
- createAccount,
45
- deleteAccountByName,
46
- parseAccountSettingsConfig,
47
- isUIConfig
48
- };
49
-
50
- const attributesConvertor = {
51
- 'Enable high priority in auditor portal': 'isHighPriority',
52
- 'Analytics Dashboard': 'hasAnalyticsDashboard',
53
- 'Email on welcome page experiment': 'isEmailOnWelcomePageVA',
54
- 'Exclude account records from the Jones Network': 'isExcludedFromNetwork',
55
- 'OCR Audit Enabled': 'isOcrEnabled',
56
- 'Coverage Auditing': 'isCoverageAudit',
57
- 'Account Requirements': 'isAccountRequirementsEnabled'
58
- };
1
+ const coreService = require('../api/core/accounts.core.service');
2
+ const CreateAccountModel = require('../models/core/create.account.model');
3
+ const configsUtil = require('../../../../common/utils/configsUtil');
4
+
5
+ const getOrCreateAccount = (context, accountName, email, { password, type } = {}) => {
6
+ const createAccountModel = new CreateAccountModel(
7
+ accountName,
8
+ email,
9
+ password,
10
+ propertyType = type
11
+ );
12
+ return coreService.getOrCreateAccount(createAccountModel, context);
13
+ };
14
+
15
+ const createAccount = async (context, accountName, email, { password, type } = {}) => {
16
+ const createAccountModel = new CreateAccountModel(
17
+ accountName,
18
+ email,
19
+ password,
20
+ propertyType = type
21
+ );
22
+
23
+ const response = await coreService.createAccount(createAccountModel, context);
24
+ return response.data;
25
+ };
26
+
27
+ const deleteAccountByName = async (context, accountName) => {
28
+ const existingAccount = await coreService.getAccount(accountName, context);
29
+
30
+ return existingAccount && coreService.deleteAccountById(existingAccount.userId, context);
31
+ };
32
+
33
+ const isUIConfig = config => {
34
+ return configsUtil.isUIConfig(config, attributesConvertor);
35
+ };
36
+
37
+ const parseAccountSettingsConfig = (accountId, settingsConfig) => {
38
+ const settings = configsUtil.objectConvertor(settingsConfig, attributesConvertor);
39
+ return { ... settings, accountId };
40
+ };
41
+
42
+ module.exports = {
43
+ getOrCreateAccount,
44
+ createAccount,
45
+ deleteAccountByName,
46
+ parseAccountSettingsConfig,
47
+ isUIConfig
48
+ };
49
+
50
+ const attributesConvertor = {
51
+ 'Enable high priority in auditor portal': 'isHighPriority',
52
+ 'Analytics Dashboard': 'hasAnalyticsDashboard',
53
+ 'Email on welcome page experiment': 'isEmailOnWelcomePageVA',
54
+ 'Exclude account records from the Jones Network': 'isExcludedFromNetwork',
55
+ 'OCR Audit Enabled': 'isOcrEnabled',
56
+ 'Coverage Auditing': 'isCoverageAudit',
57
+ 'Account Requirements': 'isAccountRequirementsEnabled'
58
+ };
@@ -1,35 +1,35 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const AGREEMENT_API_URL = `${backendUrl}/saas/contractor/agreement`;
5
-
6
- const Endpoints = {
7
- create: AGREEMENT_API_URL,
8
- delete: AGREEMENT_API_URL,
9
- getAgreementPreSignedUrl: `${backendUrl}/pre-signed-url/upload/agreement`
10
- };
11
-
12
- const getAgreementPreSignedUrl = (formData, context) => {
13
- return requests.postRequestHandler(Endpoints.getAgreementPreSignedUrl, formData, context, formData.getHeaders());
14
- };
15
-
16
- const uploadAgreementToS3 = (preSignedUrl, file) => {
17
- return requests.putRequestHandler(preSignedUrl, file);
18
- };
19
-
20
- const createAgreement = (createAgreementModel, context) => {
21
- return requests.postRequestHandler(Endpoints.create, createAgreementModel, context);
22
- };
23
-
24
- const deleteAgreement = (recordId, context) => {
25
- const headers = {};
26
- const params = { contractorId: recordId };
27
- return requests.deleteRequestHandler(Endpoints.delete, context, headers, params);
28
- };
29
-
30
- module.exports = {
31
- createAgreement,
32
- deleteAgreement,
33
- uploadAgreementToS3,
34
- getAgreementPreSignedUrl
35
- };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const AGREEMENT_API_URL = `${backendUrl}/saas/contractor/agreement`;
5
+
6
+ const Endpoints = {
7
+ create: AGREEMENT_API_URL,
8
+ delete: AGREEMENT_API_URL,
9
+ getAgreementPreSignedUrl: `${backendUrl}/pre-signed-url/upload/agreement`
10
+ };
11
+
12
+ const getAgreementPreSignedUrl = (formData, context) => {
13
+ return requests.postRequestHandler(Endpoints.getAgreementPreSignedUrl, formData, context, formData.getHeaders());
14
+ };
15
+
16
+ const uploadAgreementToS3 = (preSignedUrl, file) => {
17
+ return requests.putRequestHandler(preSignedUrl, file);
18
+ };
19
+
20
+ const createAgreement = (createAgreementModel, context) => {
21
+ return requests.postRequestHandler(Endpoints.create, createAgreementModel, context);
22
+ };
23
+
24
+ const deleteAgreement = (recordId, context) => {
25
+ const headers = {};
26
+ const params = { contractorId: recordId };
27
+ return requests.deleteRequestHandler(Endpoints.delete, context, headers, params);
28
+ };
29
+
30
+ module.exports = {
31
+ createAgreement,
32
+ deleteAgreement,
33
+ uploadAgreementToS3,
34
+ getAgreementPreSignedUrl
35
+ };