@getjones/test-infra 5.2.10 → 5.2.12

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 (288) hide show
  1. package/eslint.config.mjs +156 -156
  2. package/package.json +43 -42
  3. package/src/common/commonFlows/auth/auth.js +95 -95
  4. package/src/common/commonFlows/index.js +5 -5
  5. package/src/common/commonFlows/records/records.js +457 -423
  6. package/src/common/commonFlows/users/users.js +15 -15
  7. package/src/common/consts/accountSettings.js +112 -112
  8. package/src/common/consts/activationStatuses.js +6 -6
  9. package/src/common/consts/analysisStatuses.js +7 -7
  10. package/src/common/consts/autocomplete.js +10 -10
  11. package/src/common/consts/constantsForRecordsSortingAndFilters.js +49 -49
  12. package/src/common/consts/dashboardCharts.js +18 -18
  13. package/src/common/consts/homepage/AttentionTab.js +6 -6
  14. package/src/common/consts/homepage/sortOptions.js +19 -19
  15. package/src/common/consts/projectSettings.js +28 -28
  16. package/src/common/consts/recordTypes.js +5 -5
  17. package/src/common/consts/requirementActions.js +10 -10
  18. package/src/common/consts/s3FileTypes.js +12 -12
  19. package/src/common/consts/userRoles.js +21 -21
  20. package/src/common/consts/userTypes.js +16 -16
  21. package/src/common/errorCodes.js +12 -11
  22. package/src/common/httpResponseStatusCodes.json +19 -19
  23. package/src/common/httpResponseTypes.json +2 -2
  24. package/src/common/requests/apiKeyAuth/requests.js +45 -45
  25. package/src/common/requests/cookieAuth/requests.js +40 -40
  26. package/src/common/requests/internalAuth/requests.js +48 -48
  27. package/src/common/requests/requestHandlers.js +112 -112
  28. package/src/common/utils/arrayUtils.js +19 -19
  29. package/src/common/utils/complianceUtil.js +114 -114
  30. package/src/common/utils/configsUtil.js +22 -22
  31. package/src/common/utils/dataTypeUtils.js +41 -41
  32. package/src/common/utils/numberUtils.js +22 -22
  33. package/src/common/utils/objectUtils.js +102 -102
  34. package/src/common/utils/timeUtils.js +195 -195
  35. package/src/common/validations/typeValidations.js +36 -36
  36. package/src/defaults/configs/attributes.js +170 -170
  37. package/src/defaults/configs/auditConfigs.js +129 -129
  38. package/src/defaults/configs/coverage.js +144 -144
  39. package/src/defaults/configs/polices.js +28 -28
  40. package/src/defaults/configs/requirement.js +218 -218
  41. package/src/defaults/index.js +7 -7
  42. package/src/env.js +58 -58
  43. package/src/factory/globalRecord/globalRecord.js +43 -43
  44. package/src/factory/index.js +8 -8
  45. package/src/factory/records/records.js +295 -295
  46. package/src/factory/users/users.js +70 -70
  47. package/src/index.js +114 -114
  48. package/src/reporters/mochaReporter.js +273 -273
  49. package/src/resources/agreements/agreement.pdf +0 -0
  50. package/src/saas/internal-api/accountDirectory/api/accountDirectory.api.js +152 -152
  51. package/src/saas/internal-api/accountDirectory/api/accountDirectory.service.js +576 -576
  52. package/src/saas/internal-api/accountDirectory/consts/accountDirectory.consts.js +75 -75
  53. package/src/saas/internal-api/accountDirectory/index.js +5 -5
  54. package/src/saas/internal-api/accountDirectory/models/accountDirectory.models.js +172 -172
  55. package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +48 -48
  56. package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +104 -104
  57. package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
  58. package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +60 -60
  59. package/src/saas/internal-api/accounts/api/emailCustomization/consts.js +8 -8
  60. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +54 -54
  61. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +67 -67
  62. package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
  63. package/src/saas/internal-api/accounts/api/settings/settings.service.js +58 -58
  64. package/src/saas/internal-api/accounts/consts/consts.js +8 -8
  65. package/src/saas/internal-api/accounts/index.js +22 -22
  66. package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
  67. package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +110 -110
  68. package/src/saas/internal-api/accounts/utils/utils.js +60 -60
  69. package/src/saas/internal-api/agreement/api/agreement.api.js +39 -39
  70. package/src/saas/internal-api/agreement/api/agreement.service.js +121 -121
  71. package/src/saas/internal-api/agreement/consts/consts.js +11 -11
  72. package/src/saas/internal-api/agreement/index.js +12 -12
  73. package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
  74. package/src/saas/internal-api/agreement/models/createAgreementByAuditorModel.js +11 -11
  75. package/src/saas/internal-api/agreement/models/createAgreementByPMModel.js +13 -13
  76. package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +49 -49
  77. package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +121 -121
  78. package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +40 -40
  79. package/src/saas/internal-api/auditCustomerRules/index.js +7 -7
  80. package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +55 -55
  81. package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +70 -70
  82. package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
  83. package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +116 -116
  84. package/src/saas/internal-api/auditNotes/index.js +4 -4
  85. package/src/saas/internal-api/auditNotes/models/audit.note.model.js +32 -32
  86. package/src/saas/internal-api/auditorComments/api/auditor.comments.api.js +20 -20
  87. package/src/saas/internal-api/auditorComments/api/auditor.comments.service.js +27 -27
  88. package/src/saas/internal-api/auditorComments/consts/auditor.comment.js +16 -16
  89. package/src/saas/internal-api/auditorComments/index.js +5 -5
  90. package/src/saas/internal-api/auditorComments/models/auditor.comment.model.js +40 -40
  91. package/src/saas/internal-api/auth/api/auth.api.js +78 -78
  92. package/src/saas/internal-api/auth/api/auth.service.js +206 -172
  93. package/src/saas/internal-api/auth/index.js +3 -3
  94. package/src/saas/internal-api/coi/api/coi.api.js +76 -76
  95. package/src/saas/internal-api/coi/api/coi.service.js +104 -104
  96. package/src/saas/internal-api/coi/consts/duplicateHandling.js +7 -7
  97. package/src/saas/internal-api/coi/consts/hashes.js +5 -5
  98. package/src/saas/internal-api/coi/consts/uploaderTypes.js +3 -3
  99. package/src/saas/internal-api/coi/index.js +16 -16
  100. package/src/saas/internal-api/coi/models/Combine.last.two.cois.model.js +25 -25
  101. package/src/saas/internal-api/coi/models/submit.coi.batch.model.js +23 -23
  102. package/src/saas/internal-api/coi/models/submit.coi.model.js +23 -23
  103. package/src/saas/internal-api/coi/utils/utils.js +185 -185
  104. package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.api.js +12 -12
  105. package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.service.js +14 -14
  106. package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.api.js +63 -63
  107. package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.service.js +99 -99
  108. package/src/saas/internal-api/compliance/api/audit/audit.api.js +124 -124
  109. package/src/saas/internal-api/compliance/api/audit/audit.service.js +390 -390
  110. package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.api.js +32 -32
  111. package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.service.js +73 -73
  112. package/src/saas/internal-api/compliance/api/convert/convert.api.js +12 -12
  113. package/src/saas/internal-api/compliance/api/convert/convert.service.js +7 -7
  114. package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
  115. package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +46 -46
  116. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +86 -86
  117. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +300 -300
  118. package/src/saas/internal-api/compliance/consts/audit.js +130 -130
  119. package/src/saas/internal-api/compliance/consts/overrideGapRequest/override.gap.request.js +7 -7
  120. package/src/saas/internal-api/compliance/index.js +41 -41
  121. package/src/saas/internal-api/compliance/models/audit/audit.model.js +109 -109
  122. package/src/saas/internal-api/compliance/models/overrideGapRequest/override.gap.request.model.js +16 -16
  123. package/src/saas/internal-api/compliance/models/waive/waive.model.js +112 -112
  124. package/src/saas/internal-api/compliance/utils/auditUtil.js +308 -308
  125. package/src/saas/internal-api/compliance/utils/coverageUtil.js +45 -45
  126. package/src/saas/internal-api/contractors/api/contractors.service.js +482 -482
  127. package/src/saas/internal-api/contractors/consts/consts.js +6 -6
  128. package/src/saas/internal-api/contractors/index.js +8 -8
  129. package/src/saas/internal-api/contractors/models/assign.requirement.model.js +11 -11
  130. package/src/saas/internal-api/contractors/models/edit.contractor.model.js +73 -73
  131. package/src/saas/internal-api/contractors/models/link.request.model.js +10 -10
  132. package/src/saas/internal-api/contractors/models/verification.contractor.model.js +29 -29
  133. package/src/saas/internal-api/contractors/utils.js +25 -25
  134. package/src/saas/internal-api/customTags/api/customTags.api.js +47 -47
  135. package/src/saas/internal-api/customTags/api/customTags.service.js +96 -96
  136. package/src/saas/internal-api/customTags/index.js +4 -4
  137. package/src/saas/internal-api/customTags/models/customTagsModels.js +17 -17
  138. package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
  139. package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
  140. package/src/saas/internal-api/dashboard/index.js +5 -5
  141. package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
  142. package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
  143. package/src/saas/internal-api/dbEmails/api/db.emails.service.js +178 -178
  144. package/src/saas/internal-api/dbEmails/consts/consts.js +66 -66
  145. package/src/saas/internal-api/dbEmails/index.js +6 -6
  146. package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
  147. package/src/saas/internal-api/dbEmails/utils/util.js +82 -82
  148. package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
  149. package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
  150. package/src/saas/internal-api/emailCustomization/index.js +3 -3
  151. package/src/saas/internal-api/fileScan/api/file.scan.api.js +14 -14
  152. package/src/saas/internal-api/fileScan/api/file.scan.service.js +35 -35
  153. package/src/saas/internal-api/fileScan/index.js +3 -3
  154. package/src/saas/internal-api/fileScan/models/update.scan.status.model.js +13 -13
  155. package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
  156. package/src/saas/internal-api/globalRecord/api/global.record.service.js +112 -112
  157. package/src/saas/internal-api/globalRecord/consts.js +20 -20
  158. package/src/saas/internal-api/globalRecord/index.js +6 -6
  159. package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
  160. package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
  161. package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
  162. package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
  163. package/src/saas/internal-api/homepageCharts/index.js +3 -3
  164. package/src/saas/internal-api/notificationCenter/api/notification.center.api.js +32 -32
  165. package/src/saas/internal-api/notificationCenter/api/notification.center.service.js +49 -49
  166. package/src/saas/internal-api/notificationCenter/consts.js +9 -9
  167. package/src/saas/internal-api/notificationCenter/index.js +4 -4
  168. package/src/saas/internal-api/outlook/api/outlook.api.js +14 -14
  169. package/src/saas/internal-api/outlook/api/outlook.service.js +14 -14
  170. package/src/saas/internal-api/outlook/index.js +3 -3
  171. package/src/saas/internal-api/policyFile/api/policy.file.api.js +43 -43
  172. package/src/saas/internal-api/policyFile/api/policy.file.service.js +117 -117
  173. package/src/saas/internal-api/policyFile/consts.js +21 -21
  174. package/src/saas/internal-api/policyFile/index.js +11 -11
  175. package/src/saas/internal-api/policyFile/models/create.policy.file.model.js +11 -11
  176. package/src/saas/internal-api/policyFile/models/set.publish.flag.to.policy.model.js +13 -13
  177. package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
  178. package/src/saas/internal-api/projects/api/core/projects.service.js +77 -77
  179. package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
  180. package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
  181. package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
  182. package/src/saas/internal-api/projects/index.js +24 -24
  183. package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
  184. package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
  185. package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +48 -48
  186. package/src/saas/internal-api/projects/utils/utils.js +159 -159
  187. package/src/saas/internal-api/recordHub/api/record.hub.api.js +20 -20
  188. package/src/saas/internal-api/recordHub/api/record.hub.service.js +86 -86
  189. package/src/saas/internal-api/recordHub/index.js +3 -3
  190. package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
  191. package/src/saas/internal-api/recordNotes/api/record.notes.service.js +56 -56
  192. package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
  193. package/src/saas/internal-api/recordNotes/index.js +3 -3
  194. package/src/saas/internal-api/relatedDocs/api/related.docs.api.js +98 -98
  195. package/src/saas/internal-api/relatedDocs/api/related.docs.service.js +180 -180
  196. package/src/saas/internal-api/relatedDocs/index.js +4 -4
  197. package/src/saas/internal-api/relatedDocs/models/related.doc.model.js +36 -36
  198. package/src/saas/internal-api/reports/api/reports.api.js +56 -56
  199. package/src/saas/internal-api/reports/api/reports.service.js +68 -68
  200. package/src/saas/internal-api/reports/consts/consts.js +71 -71
  201. package/src/saas/internal-api/reports/index.js +15 -15
  202. package/src/saas/internal-api/reports/models/report.model.js +27 -27
  203. package/src/saas/internal-api/requests/api/requests.api.js +132 -132
  204. package/src/saas/internal-api/requests/api/requests.service.js +315 -315
  205. package/src/saas/internal-api/requests/index.js +21 -21
  206. package/src/saas/internal-api/requests/models/create.request.model.js +39 -39
  207. package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -18
  208. package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
  209. package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
  210. package/src/saas/internal-api/requests/models/homepageRequestCriteriaModel.js +19 -19
  211. package/src/saas/internal-api/requests/models/requestListCriteriaModel.js +17 -17
  212. package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
  213. package/src/saas/internal-api/requests/utils.js +16 -16
  214. package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
  215. package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
  216. package/src/saas/internal-api/requestsTable/index.js +3 -3
  217. package/src/saas/internal-api/requirements/api/lease/lease.api.js +74 -56
  218. package/src/saas/internal-api/requirements/api/lease/lease.service.js +167 -123
  219. package/src/saas/internal-api/requirements/api/requirements.api.js +65 -65
  220. package/src/saas/internal-api/requirements/api/requirements.service.js +198 -198
  221. package/src/saas/internal-api/requirements/consts/attributeTypes.json +8 -8
  222. package/src/saas/internal-api/requirements/consts/consts.js +22 -15
  223. package/src/saas/internal-api/requirements/index.js +22 -21
  224. package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
  225. package/src/saas/internal-api/requirements/models/extraction.request.model.js +16 -16
  226. package/src/saas/internal-api/requirements/models/policy.model.js +35 -35
  227. package/src/saas/internal-api/requirements/models/tab.extraction.request.model.js +14 -0
  228. package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
  229. package/src/saas/internal-api/requirements/utils/utils.js +129 -129
  230. package/src/saas/internal-api/sampleCoi/api/sample.coi.api.js +15 -15
  231. package/src/saas/internal-api/sampleCoi/api/sample.coi.service.js +48 -48
  232. package/src/saas/internal-api/sampleCoi/consts/consts.js +22 -22
  233. package/src/saas/internal-api/sampleCoi/index.js +4 -4
  234. package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
  235. package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
  236. package/src/saas/internal-api/serviceArea/index.js +4 -4
  237. package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
  238. package/src/saas/internal-api/tableOfContents/api/table.of.contents.api.js +37 -37
  239. package/src/saas/internal-api/tableOfContents/api/table.of.contents.service.js +19 -19
  240. package/src/saas/internal-api/tableOfContents/index.js +3 -3
  241. package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
  242. package/src/saas/internal-api/tabs/api/tabs.service.js +60 -60
  243. package/src/saas/internal-api/tabs/index.js +3 -3
  244. package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
  245. package/src/saas/internal-api/thread-scheduler/runner.js +69 -69
  246. package/src/saas/internal-api/thread-scheduler/schedulerJobs.js +8 -8
  247. package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +49 -49
  248. package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +162 -162
  249. package/src/saas/internal-api/uploadFiles/consts.js +36 -36
  250. package/src/saas/internal-api/uploadFiles/index.js +5 -5
  251. package/src/saas/internal-api/uploadFiles/utils.js +34 -34
  252. package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +38 -38
  253. package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +109 -109
  254. package/src/saas/internal-api/users/api/users.api.js +158 -158
  255. package/src/saas/internal-api/users/api/users.service.js +363 -363
  256. package/src/saas/internal-api/users/index.js +17 -17
  257. package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
  258. package/src/saas/internal-api/users/models/notification.settings.model.js +15 -14
  259. package/src/saas/internal-api/users/models/tenant.user.model.js +11 -11
  260. package/src/saas/internal-api/users/models/users.model.js +43 -43
  261. package/src/saas/internal-api/users/utils/util.js +50 -49
  262. package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +26 -26
  263. package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +19 -19
  264. package/src/saas/internal-api/vendorProfile/index.js +3 -3
  265. package/src/saas/openapi/accounts/accounts.api.js +17 -17
  266. package/src/saas/openapi/accounts/accounts.service.js +11 -11
  267. package/src/saas/openapi/coi/coi.api.js +35 -35
  268. package/src/saas/openapi/coi/coi.service.js +53 -53
  269. package/src/saas/openapi/projects/projects.api.js +83 -83
  270. package/src/saas/openapi/projects/projects.service.js +71 -71
  271. package/src/saas/openapi/relatedDocs/related.docs.api.js +30 -30
  272. package/src/saas/openapi/relatedDocs/related.docs.service.js +55 -55
  273. package/src/saas/openapi/requests/index.js +7 -7
  274. package/src/saas/openapi/requests/models/invite.request.model.js +42 -42
  275. package/src/saas/openapi/requests/models/update.request.model.js +37 -37
  276. package/src/saas/openapi/requests/requests.api.js +93 -93
  277. package/src/saas/openapi/requests/requests.service.js +94 -94
  278. package/src/saas/openapi/requirements/index.js +6 -6
  279. package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
  280. package/src/saas/openapi/requirements/requirements.api.js +41 -41
  281. package/src/saas/openapi/requirements/requirements.service.js +55 -55
  282. package/src/saas/openapi/tabs/index.js +6 -6
  283. package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
  284. package/src/saas/openapi/tabs/tabs.api.js +27 -27
  285. package/src/saas/openapi/tabs/tabs.service.js +19 -19
  286. package/src/saas/openapi/users/user.model.js +10 -10
  287. package/src/saas/openapi/users/users.api.js +33 -33
  288. package/src/saas/openapi/users/users.service.js +51 -51
@@ -1,121 +1,121 @@
1
- const auditApi = require('../api/customer.rules.api');
2
- const { CustomerRuleModel } = require('../models/customer.rule.model');
3
- const { convertGetRulesToModelConfig } = require('../utils/customer.rule.util');
4
- const { customerRuleLevels } = require('../consts/customer.rule');
5
-
6
- const { validateType } = require('../../../../common/validations/typeValidations');
7
- const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
8
-
9
- const createCustomerRule = async (customerRuleModel, context) => {
10
- validateType(customerRuleModel, CustomerRuleModel);
11
- const response = await auditApi.createCustomerRule(customerRuleModel, context);
12
-
13
- if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
14
- throw Error(`Failed to create customer rule - Response: ${response.status}`);
15
- }
16
-
17
- return response;
18
- };
19
-
20
- const getCustomerRulesForIcs = async (projectId, context) => {
21
- const response = await auditApi.getCustomerRulesForIcs(projectId, context);
22
-
23
- if (response.status !== httpResponseStatusCodes.OK) {
24
- throw Error(`Failed to get customer rules for ICS: projectId - ${projectId}. Response: ${response.status}`);
25
- }
26
-
27
- return response.data;
28
- };
29
-
30
- const getCustomerRulesForAuditor = async (recordId, context) => {
31
- const response = await auditApi.getCustomerRulesForAuditor(recordId, context);
32
-
33
- if (response.status !== httpResponseStatusCodes.OK) {
34
- throw Error(`Failed to get customer rules for auditor: recordId - ${recordId}. Response: ${response.status}`);
35
- }
36
-
37
- return response.data;
38
- };
39
-
40
- const updateCustomerRule = async (customerRuleModel, customerRuleId, context) => {
41
- validateType(customerRuleModel, CustomerRuleModel);
42
- const response = await auditApi.updateCustomerRule(customerRuleModel, customerRuleId, context);
43
-
44
- if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
45
- throw Error(`Failed to update customer rule ${customerRuleId}. Response: ${response.status}`);
46
- }
47
-
48
- return response;
49
- };
50
-
51
- const deleteCustomerRuleById = async (customerRuleModel, customerRuleId, context) => {
52
- validateType(customerRuleModel, CustomerRuleModel);
53
- const response = await auditApi.deleteCustomerRuleById(customerRuleModel, customerRuleId, context);
54
-
55
- if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
56
- throw Error(`Failed to delete customer rule - Response: ${response.status}`);
57
- }
58
-
59
- return response;
60
- };
61
-
62
- // ICS-only endpoint, capped at 100 notes per batch
63
- const convertNotesToRules = async (notesToConvert, context) => {
64
- const response = await auditApi.convertNotesToRules(notesToConvert, context);
65
-
66
- if (response.status !== httpResponseStatusCodes.OK) {
67
- const errorMessage = response.data && response.data.message;
68
- throw Error(`Failed to convert notes to rules. Response: ${response.status}${errorMessage ? ` Message: ${errorMessage}` : ''}`);
69
- }
70
-
71
- return response.data;
72
- };
73
-
74
- const deleteAllCustomerRulesInAccount = async (projectId, context) => {
75
- const existingCustomerRules = await getCustomerRulesForIcs(projectId, context);
76
-
77
- const levels = Object.values(customerRuleLevels);
78
-
79
- for (const level of levels) {
80
- const rulesByLevel = existingCustomerRules[level];
81
-
82
- for (const customerRule of rulesByLevel) {
83
- const convertedRuleConfig = convertGetRulesToModelConfig(customerRule);
84
- const getRuleModel = getCustomerRuleModel(convertedRuleConfig);
85
- await deleteCustomerRuleById(getRuleModel, customerRule.id, context);
86
- }
87
- };
88
- };
89
-
90
- const getCustomerRuleModel = ruleConfig => {
91
- const { accountId, name, level, policyName, projectId, requirementId, attributeName, gapQuote, id, dateModified, target, criteria, tabType } = ruleConfig;
92
-
93
- return new CustomerRuleModel(
94
- accountId,
95
- name,
96
- level,
97
- policyName,
98
- {
99
- projectId, //required also for tabRequirement
100
- requirementId,
101
- attributeName,
102
- gapQuote,
103
- id,
104
- dateModified,
105
- target,
106
- criteria,
107
- tabType
108
- }
109
- );
110
- };
111
-
112
- module.exports = {
113
- createCustomerRule,
114
- getCustomerRulesForIcs,
115
- getCustomerRulesForAuditor,
116
- updateCustomerRule,
117
- deleteCustomerRuleById,
118
- convertNotesToRules,
119
- deleteAllCustomerRulesInAccount,
120
- getCustomerRuleModel
121
- };
1
+ const auditApi = require('../api/customer.rules.api');
2
+ const { CustomerRuleModel } = require('../models/customer.rule.model');
3
+ const { convertGetRulesToModelConfig } = require('../utils/customer.rule.util');
4
+ const { customerRuleLevels } = require('../consts/customer.rule');
5
+
6
+ const { validateType } = require('../../../../common/validations/typeValidations');
7
+ const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
8
+
9
+ const createCustomerRule = async (customerRuleModel, context) => {
10
+ validateType(customerRuleModel, CustomerRuleModel);
11
+ const response = await auditApi.createCustomerRule(customerRuleModel, context);
12
+
13
+ if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
14
+ throw Error(`Failed to create customer rule - Response: ${response.status}`);
15
+ }
16
+
17
+ return response;
18
+ };
19
+
20
+ const getCustomerRulesForIcs = async (projectId, context) => {
21
+ const response = await auditApi.getCustomerRulesForIcs(projectId, context);
22
+
23
+ if (response.status !== httpResponseStatusCodes.OK) {
24
+ throw Error(`Failed to get customer rules for ICS: projectId - ${projectId}. Response: ${response.status}`);
25
+ }
26
+
27
+ return response.data;
28
+ };
29
+
30
+ const getCustomerRulesForAuditor = async (recordId, context) => {
31
+ const response = await auditApi.getCustomerRulesForAuditor(recordId, context);
32
+
33
+ if (response.status !== httpResponseStatusCodes.OK) {
34
+ throw Error(`Failed to get customer rules for auditor: recordId - ${recordId}. Response: ${response.status}`);
35
+ }
36
+
37
+ return response.data;
38
+ };
39
+
40
+ const updateCustomerRule = async (customerRuleModel, customerRuleId, context) => {
41
+ validateType(customerRuleModel, CustomerRuleModel);
42
+ const response = await auditApi.updateCustomerRule(customerRuleModel, customerRuleId, context);
43
+
44
+ if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
45
+ throw Error(`Failed to update customer rule ${customerRuleId}. Response: ${response.status}`);
46
+ }
47
+
48
+ return response;
49
+ };
50
+
51
+ const deleteCustomerRuleById = async (customerRuleModel, customerRuleId, context) => {
52
+ validateType(customerRuleModel, CustomerRuleModel);
53
+ const response = await auditApi.deleteCustomerRuleById(customerRuleModel, customerRuleId, context);
54
+
55
+ if (response.status !== httpResponseStatusCodes.NO_CONTENT) {
56
+ throw Error(`Failed to delete customer rule - Response: ${response.status}`);
57
+ }
58
+
59
+ return response;
60
+ };
61
+
62
+ // ICS-only endpoint, capped at 100 notes per batch
63
+ const convertNotesToRules = async (notesToConvert, context) => {
64
+ const response = await auditApi.convertNotesToRules(notesToConvert, context);
65
+
66
+ if (response.status !== httpResponseStatusCodes.OK) {
67
+ const errorMessage = response.data && response.data.message;
68
+ throw Error(`Failed to convert notes to rules. Response: ${response.status}${errorMessage ? ` Message: ${errorMessage}` : ''}`);
69
+ }
70
+
71
+ return response.data;
72
+ };
73
+
74
+ const deleteAllCustomerRulesInAccount = async (projectId, context) => {
75
+ const existingCustomerRules = await getCustomerRulesForIcs(projectId, context);
76
+
77
+ const levels = Object.values(customerRuleLevels);
78
+
79
+ for (const level of levels) {
80
+ const rulesByLevel = existingCustomerRules[level];
81
+
82
+ for (const customerRule of rulesByLevel) {
83
+ const convertedRuleConfig = convertGetRulesToModelConfig(customerRule);
84
+ const getRuleModel = getCustomerRuleModel(convertedRuleConfig);
85
+ await deleteCustomerRuleById(getRuleModel, customerRule.id, context);
86
+ }
87
+ };
88
+ };
89
+
90
+ const getCustomerRuleModel = ruleConfig => {
91
+ const { accountId, name, level, policyName, projectId, requirementId, attributeName, gapQuote, id, dateModified, target, criteria, tabType } = ruleConfig;
92
+
93
+ return new CustomerRuleModel(
94
+ accountId,
95
+ name,
96
+ level,
97
+ policyName,
98
+ {
99
+ projectId, //required also for tabRequirement
100
+ requirementId,
101
+ attributeName,
102
+ gapQuote,
103
+ id,
104
+ dateModified,
105
+ target,
106
+ criteria,
107
+ tabType
108
+ }
109
+ );
110
+ };
111
+
112
+ module.exports = {
113
+ createCustomerRule,
114
+ getCustomerRulesForIcs,
115
+ getCustomerRulesForAuditor,
116
+ updateCustomerRule,
117
+ deleteCustomerRuleById,
118
+ convertNotesToRules,
119
+ deleteAllCustomerRulesInAccount,
120
+ getCustomerRuleModel
121
+ };
@@ -1,40 +1,40 @@
1
- const customerRuleNames = {
2
- noGap: 'Do not mark a gap'
3
- };
4
-
5
- const customerRuleLevels = {
6
- ACCOUNT: 'Account',
7
- PROJECT: 'Project',
8
- REQUIREMENT: 'Requirement'
9
- };
10
-
11
- const customerRuleVerbs = {
12
- [customerRuleNames.noGap]: 'doNotMarkGap'
13
- };
14
-
15
- const ruleAttributeGroups = {
16
- LIMITS: 'limits',
17
- PROVISIONS: 'provisions',
18
- ENDORSEMENTS: 'endorsements'
19
- };
20
-
21
- const ruleConditionTypes = {
22
- COI_FIELD_CHECK: 'coiFieldCheck',
23
- // EQUIVALENT_PROVISION_PRESENT and LAST_REMAINING_GAP are not evaluated by the backend yet - don't write tests against them
24
- EQUIVALENT_PROVISION_PRESENT: 'equivalentProvisionPresent',
25
- LAST_REMAINING_GAP: 'lastRemainingGap'
26
- };
27
-
28
- const ruleLogicOperators = {
29
- AND: 'AND',
30
- OR: 'OR'
31
- };
32
-
33
- module.exports = {
34
- customerRuleNames,
35
- customerRuleLevels,
36
- customerRuleVerbs,
37
- ruleAttributeGroups,
38
- ruleConditionTypes,
39
- ruleLogicOperators
40
- };
1
+ const customerRuleNames = {
2
+ noGap: 'Do not mark a gap'
3
+ };
4
+
5
+ const customerRuleLevels = {
6
+ ACCOUNT: 'Account',
7
+ PROJECT: 'Project',
8
+ REQUIREMENT: 'Requirement'
9
+ };
10
+
11
+ const customerRuleVerbs = {
12
+ [customerRuleNames.noGap]: 'doNotMarkGap'
13
+ };
14
+
15
+ const ruleAttributeGroups = {
16
+ LIMITS: 'limits',
17
+ PROVISIONS: 'provisions',
18
+ ENDORSEMENTS: 'endorsements'
19
+ };
20
+
21
+ const ruleConditionTypes = {
22
+ COI_FIELD_CHECK: 'coiFieldCheck',
23
+ // EQUIVALENT_PROVISION_PRESENT and LAST_REMAINING_GAP are not evaluated by the backend yet - don't write tests against them
24
+ EQUIVALENT_PROVISION_PRESENT: 'equivalentProvisionPresent',
25
+ LAST_REMAINING_GAP: 'lastRemainingGap'
26
+ };
27
+
28
+ const ruleLogicOperators = {
29
+ AND: 'AND',
30
+ OR: 'OR'
31
+ };
32
+
33
+ module.exports = {
34
+ customerRuleNames,
35
+ customerRuleLevels,
36
+ customerRuleVerbs,
37
+ ruleAttributeGroups,
38
+ ruleConditionTypes,
39
+ ruleLogicOperators
40
+ };
@@ -1,7 +1,7 @@
1
- const api = require('./api/customer.rules.api');
2
- const services = require('./api/customer.rules.service');
3
- const models = require('./models/customer.rule.model');
4
- const consts = require('./consts/customer.rule');
5
- const utils = require('./utils/customer.rule.util');
6
-
7
- module.exports = { api, services, models, consts, utils };
1
+ const api = require('./api/customer.rules.api');
2
+ const services = require('./api/customer.rules.service');
3
+ const models = require('./models/customer.rule.model');
4
+ const consts = require('./consts/customer.rule');
5
+ const utils = require('./utils/customer.rule.util');
6
+
7
+ module.exports = { api, services, models, consts, utils };
@@ -1,55 +1,55 @@
1
- const { customerRuleNames, customerRuleLevels, customerRuleVerbs } = require('../consts/customer.rule');
2
- const { buildTarget } = require('../utils/customer.rule.util');
3
-
4
- class CustomerRuleModel {
5
- constructor(accountId, name, level, policyName, { attributeName, gapQuote, projectId, requirementId, id, dateModified, target, criteria, tabType } = {}) {
6
- this.ruleAssociation = new RuleAssociation(level, accountId, { projectId, requirementId });
7
- this.ruleConfig = new RuleConfig(name, policyName, { attributeName, gapQuote, target, criteria, tabType });
8
- this.dateModified = dateModified;
9
- this.id = id;
10
- }
11
- }
12
-
13
- module.exports = {
14
- CustomerRuleModel
15
- };
16
-
17
- class RuleAssociation {
18
- constructor(level, accountId, { projectId, requirementId } = {}) {
19
- validateCustomerRuleLevel(level);
20
-
21
- this.level = level;
22
- this.accountId = accountId;
23
- this.projectId = projectId;
24
- this.requirementId = requirementId;
25
- }
26
- }
27
-
28
- class RuleConfig {
29
- constructor(name, policyName, { attributeName, gapQuote, target, criteria, tabType } = {}) {
30
- validateCustomerRuleName(name);
31
- this.rule = customerRuleVerbs[name];
32
- this.target = target || buildTarget(policyName, attributeName);
33
- this.gapQuote = gapQuote;
34
-
35
- if (criteria) {
36
- this.criteria = criteria;
37
- }
38
-
39
- if (tabType) {
40
- this.tabType = tabType;
41
- }
42
- }
43
- }
44
-
45
- const validateCustomerRuleLevel = level => {
46
- if (!Object.values(customerRuleLevels).includes(level)) {
47
- throw new Error(`Invalid rule level: ${level}`);
48
- }
49
- };
50
-
51
- const validateCustomerRuleName = customerRuleName => {
52
- if (!Object.values(customerRuleNames).includes(customerRuleName)) {
53
- throw new Error(`Invalid customerRuleName: ${customerRuleName}`);
54
- }
55
- };
1
+ const { customerRuleNames, customerRuleLevels, customerRuleVerbs } = require('../consts/customer.rule');
2
+ const { buildTarget } = require('../utils/customer.rule.util');
3
+
4
+ class CustomerRuleModel {
5
+ constructor(accountId, name, level, policyName, { attributeName, gapQuote, projectId, requirementId, id, dateModified, target, criteria, tabType } = {}) {
6
+ this.ruleAssociation = new RuleAssociation(level, accountId, { projectId, requirementId });
7
+ this.ruleConfig = new RuleConfig(name, policyName, { attributeName, gapQuote, target, criteria, tabType });
8
+ this.dateModified = dateModified;
9
+ this.id = id;
10
+ }
11
+ }
12
+
13
+ module.exports = {
14
+ CustomerRuleModel
15
+ };
16
+
17
+ class RuleAssociation {
18
+ constructor(level, accountId, { projectId, requirementId } = {}) {
19
+ validateCustomerRuleLevel(level);
20
+
21
+ this.level = level;
22
+ this.accountId = accountId;
23
+ this.projectId = projectId;
24
+ this.requirementId = requirementId;
25
+ }
26
+ }
27
+
28
+ class RuleConfig {
29
+ constructor(name, policyName, { attributeName, gapQuote, target, criteria, tabType } = {}) {
30
+ validateCustomerRuleName(name);
31
+ this.rule = customerRuleVerbs[name];
32
+ this.target = target || buildTarget(policyName, attributeName);
33
+ this.gapQuote = gapQuote;
34
+
35
+ if (criteria) {
36
+ this.criteria = criteria;
37
+ }
38
+
39
+ if (tabType) {
40
+ this.tabType = tabType;
41
+ }
42
+ }
43
+ }
44
+
45
+ const validateCustomerRuleLevel = level => {
46
+ if (!Object.values(customerRuleLevels).includes(level)) {
47
+ throw new Error(`Invalid rule level: ${level}`);
48
+ }
49
+ };
50
+
51
+ const validateCustomerRuleName = customerRuleName => {
52
+ if (!Object.values(customerRuleNames).includes(customerRuleName)) {
53
+ throw new Error(`Invalid customerRuleName: ${customerRuleName}`);
54
+ }
55
+ };
@@ -1,70 +1,70 @@
1
- const { customerRuleNames, customerRuleVerbs, ruleAttributeGroups } = require('../consts/customer.rule');
2
- const { policiesCoverageConfig } = require('../../../../defaults/configs/coverage');
3
-
4
- const ruleNamesByVerb = Object.fromEntries(
5
- Object.entries(customerRuleVerbs).map(([name, verb]) => [verb, name])
6
- );
7
-
8
- const policyNameToScopeKey = policyName => policiesCoverageConfig[policyName]?.key ?? policyName;
9
-
10
- const LIMIT_ATTRIBUTE_NAMES = new Set(['Each Occurrence', 'combinedSingleLimit']);
11
- const isEndorsementAttributeName = attributeName => /endorsement/i.test(attributeName || '');
12
- const isLimitAttributeName = attributeName => LIMIT_ATTRIBUTE_NAMES.has(attributeName);
13
-
14
- const getAttributeGroupName = attributeName => {
15
- if (isEndorsementAttributeName(attributeName)) {
16
- return ruleAttributeGroups.ENDORSEMENTS;
17
- }
18
-
19
- if (isLimitAttributeName(attributeName)) {
20
- return ruleAttributeGroups.LIMITS;
21
- }
22
-
23
- return ruleAttributeGroups.PROVISIONS;
24
- };
25
-
26
- const buildTarget = (policyName, attributeName) => {
27
- const target = { scope: [policyNameToScopeKey(policyName)] };
28
-
29
- if (attributeName) {
30
- target[getAttributeGroupName(attributeName)] = [attributeName];
31
- }
32
-
33
- return target;
34
- };
35
-
36
- const readTargetPolicyAndAttribute = target => {
37
- if (!target) {
38
- return {};
39
- }
40
-
41
- const [policyName] = target.scope || [];
42
- const attributeName = target.limits?.[0] ?? target.provisions?.[0] ?? target.endorsements?.[0];
43
-
44
- return { policyName, attributeName };
45
- };
46
-
47
- const convertGetRulesToModelConfig = rule => {
48
- const { accountId, projectId, requirementId, level } = rule.ruleAssociation;
49
- const { rule: ruleVerb, target, gapQuote, criteria, tabType } = rule.ruleConfig;
50
- const { policyName, attributeName } = readTargetPolicyAndAttribute(target);
51
-
52
- const customerRuleConfig = {
53
- id: rule.id,
54
- accountId,
55
- name: ruleNamesByVerb[ruleVerb] || customerRuleNames.noGap,
56
- level,
57
- policyName,
58
- projectId,
59
- requirementId,
60
- attributeName,
61
- gapQuote,
62
- target,
63
- criteria,
64
- tabType,
65
- dateModified: rule.dateModified
66
- };
67
- return customerRuleConfig;
68
- };
69
-
70
- module.exports = { convertGetRulesToModelConfig, buildTarget, getAttributeGroupName, policyNameToScopeKey };
1
+ const { customerRuleNames, customerRuleVerbs, ruleAttributeGroups } = require('../consts/customer.rule');
2
+ const { policiesCoverageConfig } = require('../../../../defaults/configs/coverage');
3
+
4
+ const ruleNamesByVerb = Object.fromEntries(
5
+ Object.entries(customerRuleVerbs).map(([name, verb]) => [verb, name])
6
+ );
7
+
8
+ const policyNameToScopeKey = policyName => policiesCoverageConfig[policyName]?.key ?? policyName;
9
+
10
+ const LIMIT_ATTRIBUTE_NAMES = new Set(['Each Occurrence', 'combinedSingleLimit']);
11
+ const isEndorsementAttributeName = attributeName => /endorsement/i.test(attributeName || '');
12
+ const isLimitAttributeName = attributeName => LIMIT_ATTRIBUTE_NAMES.has(attributeName);
13
+
14
+ const getAttributeGroupName = attributeName => {
15
+ if (isEndorsementAttributeName(attributeName)) {
16
+ return ruleAttributeGroups.ENDORSEMENTS;
17
+ }
18
+
19
+ if (isLimitAttributeName(attributeName)) {
20
+ return ruleAttributeGroups.LIMITS;
21
+ }
22
+
23
+ return ruleAttributeGroups.PROVISIONS;
24
+ };
25
+
26
+ const buildTarget = (policyName, attributeName) => {
27
+ const target = { scope: [policyNameToScopeKey(policyName)] };
28
+
29
+ if (attributeName) {
30
+ target[getAttributeGroupName(attributeName)] = [attributeName];
31
+ }
32
+
33
+ return target;
34
+ };
35
+
36
+ const readTargetPolicyAndAttribute = target => {
37
+ if (!target) {
38
+ return {};
39
+ }
40
+
41
+ const [policyName] = target.scope || [];
42
+ const attributeName = target.limits?.[0] ?? target.provisions?.[0] ?? target.endorsements?.[0];
43
+
44
+ return { policyName, attributeName };
45
+ };
46
+
47
+ const convertGetRulesToModelConfig = rule => {
48
+ const { accountId, projectId, requirementId, level } = rule.ruleAssociation;
49
+ const { rule: ruleVerb, target, gapQuote, criteria, tabType } = rule.ruleConfig;
50
+ const { policyName, attributeName } = readTargetPolicyAndAttribute(target);
51
+
52
+ const customerRuleConfig = {
53
+ id: rule.id,
54
+ accountId,
55
+ name: ruleNamesByVerb[ruleVerb] || customerRuleNames.noGap,
56
+ level,
57
+ policyName,
58
+ projectId,
59
+ requirementId,
60
+ attributeName,
61
+ gapQuote,
62
+ target,
63
+ criteria,
64
+ tabType,
65
+ dateModified: rule.dateModified
66
+ };
67
+ return customerRuleConfig;
68
+ };
69
+
70
+ module.exports = { convertGetRulesToModelConfig, buildTarget, getAttributeGroupName, policyNameToScopeKey };
@@ -1,40 +1,40 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const saas_notes_path = 'saas/notes';
5
- const Endpoints = {
6
- saasNotes: `${backendUrl}/${saas_notes_path}`,
7
- getNotesForAuditor: `${backendUrl}/${saas_notes_path}/auditor`,
8
- updateNote: `${backendUrl}/${saas_notes_path}/update`,
9
- deleteNote: noteId => `${backendUrl}/${saas_notes_path}/${noteId}`
10
- };
11
-
12
- const createAuditNote = (noteModel, context) => {
13
- return requests.postRequestHandler(Endpoints.saasNotes, noteModel, context);
14
- };
15
-
16
- const getAuditNotesByProjectId = (projectId, context) => {
17
- const params = { projectId };
18
- return requests.getRequestHandler(Endpoints.saasNotes, params, context);
19
- };
20
-
21
- const getAuditNotesByRecordId = (recordId, context) => {
22
- const params = { contractorId: recordId };
23
- return requests.getRequestHandler(Endpoints.getNotesForAuditor, params, context);
24
- };
25
-
26
- const updateAuditNote = (noteModel, context) => {
27
- return requests.postRequestHandler(Endpoints.updateNote, noteModel, context);
28
- };
29
-
30
- const deleteAuditNoteById = (noteId, context) => {
31
- return requests.deleteRequestHandler(Endpoints.deleteNote(noteId), context);
32
- };
33
-
34
- module.exports = {
35
- createAuditNote,
36
- getAuditNotesByProjectId,
37
- getAuditNotesByRecordId,
38
- updateAuditNote,
39
- deleteAuditNoteById
40
- };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const saas_notes_path = 'saas/notes';
5
+ const Endpoints = {
6
+ saasNotes: `${backendUrl}/${saas_notes_path}`,
7
+ getNotesForAuditor: `${backendUrl}/${saas_notes_path}/auditor`,
8
+ updateNote: `${backendUrl}/${saas_notes_path}/update`,
9
+ deleteNote: noteId => `${backendUrl}/${saas_notes_path}/${noteId}`
10
+ };
11
+
12
+ const createAuditNote = (noteModel, context) => {
13
+ return requests.postRequestHandler(Endpoints.saasNotes, noteModel, context);
14
+ };
15
+
16
+ const getAuditNotesByProjectId = (projectId, context) => {
17
+ const params = { projectId };
18
+ return requests.getRequestHandler(Endpoints.saasNotes, params, context);
19
+ };
20
+
21
+ const getAuditNotesByRecordId = (recordId, context) => {
22
+ const params = { contractorId: recordId };
23
+ return requests.getRequestHandler(Endpoints.getNotesForAuditor, params, context);
24
+ };
25
+
26
+ const updateAuditNote = (noteModel, context) => {
27
+ return requests.postRequestHandler(Endpoints.updateNote, noteModel, context);
28
+ };
29
+
30
+ const deleteAuditNoteById = (noteId, context) => {
31
+ return requests.deleteRequestHandler(Endpoints.deleteNote(noteId), context);
32
+ };
33
+
34
+ module.exports = {
35
+ createAuditNote,
36
+ getAuditNotesByProjectId,
37
+ getAuditNotesByRecordId,
38
+ updateAuditNote,
39
+ deleteAuditNoteById
40
+ };