@getjones/test-infra 5.2.14 → 5.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint.config.mjs +156 -156
- package/package.json +43 -43
- package/src/common/commonFlows/auth/auth.js +95 -95
- package/src/common/commonFlows/index.js +5 -5
- package/src/common/commonFlows/records/records.js +452 -452
- package/src/common/commonFlows/users/users.js +15 -15
- package/src/common/consts/accountSettings.js +112 -112
- package/src/common/consts/activationStatuses.js +6 -6
- package/src/common/consts/analysisStatuses.js +7 -7
- package/src/common/consts/autocomplete.js +10 -10
- package/src/common/consts/constantsForRecordsSortingAndFilters.js +49 -49
- package/src/common/consts/dashboardCharts.js +18 -18
- package/src/common/consts/homepage/AttentionTab.js +6 -6
- package/src/common/consts/homepage/sortOptions.js +19 -19
- package/src/common/consts/projectSettings.js +28 -28
- package/src/common/consts/recordTypes.js +5 -5
- package/src/common/consts/requirementActions.js +10 -10
- package/src/common/consts/s3FileTypes.js +12 -12
- package/src/common/consts/userRoles.js +21 -21
- package/src/common/consts/userTypes.js +16 -16
- package/src/common/errorCodes.js +13 -13
- package/src/common/httpResponseStatusCodes.json +19 -19
- package/src/common/httpResponseTypes.json +2 -2
- package/src/common/requests/apiKeyAuth/requests.js +45 -45
- package/src/common/requests/cookieAuth/requests.js +40 -40
- package/src/common/requests/internalAuth/requests.js +48 -48
- package/src/common/requests/requestHandlers.js +112 -112
- package/src/common/utils/arrayUtils.js +19 -19
- package/src/common/utils/complianceUtil.js +114 -114
- package/src/common/utils/configsUtil.js +22 -22
- package/src/common/utils/dataTypeUtils.js +41 -41
- package/src/common/utils/numberUtils.js +22 -22
- package/src/common/utils/objectUtils.js +102 -102
- package/src/common/utils/timeUtils.js +202 -202
- package/src/common/validations/typeValidations.js +36 -36
- package/src/defaults/configs/attributes.js +170 -170
- package/src/defaults/configs/auditConfigs.js +129 -129
- package/src/defaults/configs/coverage.js +144 -144
- package/src/defaults/configs/polices.js +28 -28
- package/src/defaults/configs/requirement.js +218 -218
- package/src/defaults/index.js +7 -7
- package/src/env.js +58 -58
- package/src/factory/globalRecord/globalRecord.js +43 -43
- package/src/factory/index.js +8 -8
- package/src/factory/records/records.js +295 -295
- package/src/factory/users/users.js +70 -70
- package/src/index.js +118 -118
- package/src/reporters/mochaReporter.js +273 -273
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.api.js +152 -152
- package/src/saas/internal-api/accountDirectory/api/accountDirectory.service.js +576 -576
- package/src/saas/internal-api/accountDirectory/consts/accountDirectory.consts.js +75 -75
- package/src/saas/internal-api/accountDirectory/index.js +5 -5
- package/src/saas/internal-api/accountDirectory/models/accountDirectory.models.js +172 -172
- package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +54 -54
- package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +114 -114
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
- package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +60 -60
- package/src/saas/internal-api/accounts/api/emailCustomization/consts.js +8 -8
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +54 -54
- package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +67 -67
- package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
- package/src/saas/internal-api/accounts/api/settings/settings.service.js +58 -58
- package/src/saas/internal-api/accounts/consts/consts.js +8 -8
- package/src/saas/internal-api/accounts/index.js +22 -22
- package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
- package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +110 -110
- package/src/saas/internal-api/accounts/utils/utils.js +60 -60
- package/src/saas/internal-api/agreement/api/agreement.api.js +39 -39
- package/src/saas/internal-api/agreement/api/agreement.service.js +121 -121
- package/src/saas/internal-api/agreement/consts/consts.js +11 -11
- package/src/saas/internal-api/agreement/index.js +12 -12
- package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
- package/src/saas/internal-api/agreement/models/createAgreementByAuditorModel.js +11 -11
- package/src/saas/internal-api/agreement/models/createAgreementByPMModel.js +13 -13
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +49 -49
- package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +121 -121
- package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +40 -40
- package/src/saas/internal-api/auditCustomerRules/index.js +7 -7
- package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +55 -55
- package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +70 -70
- package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
- package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +116 -116
- package/src/saas/internal-api/auditNotes/index.js +4 -4
- package/src/saas/internal-api/auditNotes/models/audit.note.model.js +32 -32
- package/src/saas/internal-api/auditorComments/api/auditor.comments.api.js +20 -20
- package/src/saas/internal-api/auditorComments/api/auditor.comments.service.js +27 -27
- package/src/saas/internal-api/auditorComments/consts/auditor.comment.js +16 -16
- package/src/saas/internal-api/auditorComments/index.js +5 -5
- package/src/saas/internal-api/auditorComments/models/auditor.comment.model.js +40 -40
- package/src/saas/internal-api/auth/api/auth.api.js +78 -78
- package/src/saas/internal-api/auth/api/auth.service.js +217 -217
- package/src/saas/internal-api/auth/index.js +3 -3
- package/src/saas/internal-api/certificial/api/certificial.api.js +15 -15
- package/src/saas/internal-api/certificial/api/certificial.service.js +24 -24
- package/src/saas/internal-api/certificial/consts.js +8 -8
- package/src/saas/internal-api/certificial/index.js +4 -4
- package/src/saas/internal-api/coi/api/coi.api.js +76 -76
- package/src/saas/internal-api/coi/api/coi.service.js +104 -104
- package/src/saas/internal-api/coi/consts/{uploaderStatuses.js → coiUploaderTypes.js} +9 -9
- package/src/saas/internal-api/coi/consts/duplicateHandling.js +7 -7
- package/src/saas/internal-api/coi/consts/hashes.js +5 -5
- package/src/saas/internal-api/coi/consts/uploaderTypes.js +3 -3
- package/src/saas/internal-api/coi/index.js +17 -17
- package/src/saas/internal-api/coi/models/Combine.last.two.cois.model.js +25 -25
- package/src/saas/internal-api/coi/models/submit.coi.batch.model.js +23 -23
- package/src/saas/internal-api/coi/models/submit.coi.model.js +23 -23
- package/src/saas/internal-api/coi/utils/utils.js +186 -185
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.api.js +12 -12
- package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.service.js +14 -14
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.api.js +63 -63
- package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.service.js +99 -99
- package/src/saas/internal-api/compliance/api/audit/audit.api.js +124 -124
- package/src/saas/internal-api/compliance/api/audit/audit.service.js +390 -390
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.api.js +32 -32
- package/src/saas/internal-api/compliance/api/complianceSnapshot/compliance.snapshot.service.js +73 -73
- package/src/saas/internal-api/compliance/api/convert/convert.api.js +12 -12
- package/src/saas/internal-api/compliance/api/convert/convert.service.js +7 -7
- package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
- package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +46 -46
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +86 -86
- package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +300 -300
- package/src/saas/internal-api/compliance/consts/audit.js +130 -130
- package/src/saas/internal-api/compliance/consts/overrideGapRequest/override.gap.request.js +7 -7
- package/src/saas/internal-api/compliance/index.js +41 -41
- package/src/saas/internal-api/compliance/models/audit/audit.model.js +109 -109
- package/src/saas/internal-api/compliance/models/overrideGapRequest/override.gap.request.model.js +16 -16
- package/src/saas/internal-api/compliance/models/waive/waive.model.js +112 -112
- package/src/saas/internal-api/compliance/utils/auditUtil.js +308 -308
- package/src/saas/internal-api/compliance/utils/coverageUtil.js +45 -45
- package/src/saas/internal-api/contractors/api/contractors.api.js +251 -251
- package/src/saas/internal-api/contractors/api/contractors.service.js +482 -482
- package/src/saas/internal-api/contractors/consts/consts.js +6 -6
- package/src/saas/internal-api/contractors/index.js +8 -8
- package/src/saas/internal-api/contractors/models/assign.requirement.model.js +11 -11
- package/src/saas/internal-api/contractors/models/edit.contractor.model.js +73 -73
- package/src/saas/internal-api/contractors/models/link.request.model.js +10 -10
- package/src/saas/internal-api/contractors/models/verification.contractor.model.js +29 -29
- package/src/saas/internal-api/contractors/utils.js +25 -25
- package/src/saas/internal-api/customTags/api/customTags.api.js +47 -47
- package/src/saas/internal-api/customTags/api/customTags.service.js +96 -96
- package/src/saas/internal-api/customTags/index.js +4 -4
- package/src/saas/internal-api/customTags/models/customTagsModels.js +17 -17
- package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
- package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
- package/src/saas/internal-api/dashboard/index.js +5 -5
- package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
- package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
- package/src/saas/internal-api/dbEmails/api/db.emails.service.js +209 -209
- package/src/saas/internal-api/dbEmails/consts/consts.js +66 -66
- package/src/saas/internal-api/dbEmails/index.js +6 -6
- package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
- package/src/saas/internal-api/dbEmails/utils/util.js +82 -82
- package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
- package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
- package/src/saas/internal-api/emailCustomization/index.js +3 -3
- package/src/saas/internal-api/fileScan/api/file.scan.api.js +14 -14
- package/src/saas/internal-api/fileScan/api/file.scan.service.js +35 -35
- package/src/saas/internal-api/fileScan/index.js +3 -3
- package/src/saas/internal-api/fileScan/models/update.scan.status.model.js +13 -13
- package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
- package/src/saas/internal-api/globalRecord/api/global.record.service.js +112 -112
- package/src/saas/internal-api/globalRecord/consts.js +20 -20
- package/src/saas/internal-api/globalRecord/index.js +6 -6
- package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
- package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
- package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
- package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
- package/src/saas/internal-api/homepageCharts/index.js +3 -3
- package/src/saas/internal-api/notificationCenter/api/notification.center.api.js +32 -32
- package/src/saas/internal-api/notificationCenter/api/notification.center.service.js +49 -49
- package/src/saas/internal-api/notificationCenter/consts.js +9 -9
- package/src/saas/internal-api/notificationCenter/index.js +4 -4
- package/src/saas/internal-api/outlook/api/outlook.api.js +14 -14
- package/src/saas/internal-api/outlook/api/outlook.service.js +14 -14
- package/src/saas/internal-api/outlook/index.js +3 -3
- package/src/saas/internal-api/policyFile/api/policy.file.api.js +43 -43
- package/src/saas/internal-api/policyFile/api/policy.file.service.js +117 -117
- package/src/saas/internal-api/policyFile/consts.js +21 -21
- package/src/saas/internal-api/policyFile/index.js +11 -11
- package/src/saas/internal-api/policyFile/models/create.policy.file.model.js +11 -11
- package/src/saas/internal-api/policyFile/models/set.publish.flag.to.policy.model.js +13 -13
- package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
- package/src/saas/internal-api/projects/api/core/projects.service.js +77 -77
- package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
- package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
- package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
- package/src/saas/internal-api/projects/index.js +24 -24
- package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
- package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
- package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +56 -56
- package/src/saas/internal-api/projects/utils/utils.js +159 -159
- package/src/saas/internal-api/recordHub/api/record.hub.api.js +20 -20
- package/src/saas/internal-api/recordHub/api/record.hub.service.js +86 -86
- package/src/saas/internal-api/recordHub/index.js +3 -3
- package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
- package/src/saas/internal-api/recordNotes/api/record.notes.service.js +56 -56
- package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
- package/src/saas/internal-api/recordNotes/index.js +3 -3
- package/src/saas/internal-api/relatedDocs/api/related.docs.api.js +98 -98
- package/src/saas/internal-api/relatedDocs/api/related.docs.service.js +180 -180
- package/src/saas/internal-api/relatedDocs/index.js +4 -4
- package/src/saas/internal-api/relatedDocs/models/related.doc.model.js +36 -36
- package/src/saas/internal-api/reports/api/reports.api.js +56 -56
- package/src/saas/internal-api/reports/api/reports.service.js +68 -68
- package/src/saas/internal-api/reports/consts/consts.js +71 -71
- package/src/saas/internal-api/reports/index.js +15 -15
- package/src/saas/internal-api/reports/models/report.model.js +27 -27
- package/src/saas/internal-api/requests/api/requests.api.js +132 -132
- package/src/saas/internal-api/requests/api/requests.service.js +315 -315
- package/src/saas/internal-api/requests/index.js +21 -21
- package/src/saas/internal-api/requests/models/create.request.model.js +39 -39
- package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -18
- package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
- package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
- package/src/saas/internal-api/requests/models/homepageRequestCriteriaModel.js +19 -19
- package/src/saas/internal-api/requests/models/requestListCriteriaModel.js +17 -17
- package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
- package/src/saas/internal-api/requests/utils.js +16 -16
- package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
- package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
- package/src/saas/internal-api/requestsTable/index.js +3 -3
- package/src/saas/internal-api/requirements/api/lease/lease.api.js +74 -74
- package/src/saas/internal-api/requirements/api/lease/lease.service.js +167 -167
- package/src/saas/internal-api/requirements/api/requirements.api.js +65 -65
- package/src/saas/internal-api/requirements/api/requirements.service.js +198 -198
- package/src/saas/internal-api/requirements/consts/attributeTypes.json +8 -8
- package/src/saas/internal-api/requirements/consts/consts.js +22 -22
- package/src/saas/internal-api/requirements/index.js +22 -22
- package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
- package/src/saas/internal-api/requirements/models/extraction.request.model.js +16 -16
- package/src/saas/internal-api/requirements/models/policy.model.js +35 -35
- package/src/saas/internal-api/requirements/models/tab.extraction.request.model.js +14 -14
- package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
- package/src/saas/internal-api/requirements/utils/utils.js +129 -129
- package/src/saas/internal-api/sampleCoi/api/sample.coi.api.js +15 -15
- package/src/saas/internal-api/sampleCoi/api/sample.coi.service.js +48 -48
- package/src/saas/internal-api/sampleCoi/consts/consts.js +22 -22
- package/src/saas/internal-api/sampleCoi/index.js +4 -4
- package/src/saas/internal-api/schedulerJobRun/api/scheduler.job.run.api.js +31 -31
- package/src/saas/internal-api/schedulerJobRun/api/scheduler.job.run.service.js +56 -56
- package/src/saas/internal-api/schedulerJobRun/index.js +3 -3
- package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
- package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
- package/src/saas/internal-api/serviceArea/index.js +4 -4
- package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
- package/src/saas/internal-api/tableOfContents/api/table.of.contents.api.js +37 -37
- package/src/saas/internal-api/tableOfContents/api/table.of.contents.service.js +19 -19
- package/src/saas/internal-api/tableOfContents/index.js +3 -3
- package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
- package/src/saas/internal-api/tabs/api/tabs.service.js +60 -60
- package/src/saas/internal-api/tabs/index.js +3 -3
- package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
- package/src/saas/internal-api/thread-scheduler/runner.js +86 -86
- package/src/saas/internal-api/thread-scheduler/schedulerJobs.js +10 -10
- package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +49 -49
- package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +176 -176
- package/src/saas/internal-api/uploadFiles/consts.js +36 -36
- package/src/saas/internal-api/uploadFiles/index.js +5 -5
- package/src/saas/internal-api/uploadFiles/utils.js +34 -34
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +38 -38
- package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +109 -109
- package/src/saas/internal-api/users/api/users.api.js +158 -158
- package/src/saas/internal-api/users/api/users.service.js +363 -363
- package/src/saas/internal-api/users/index.js +17 -17
- package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
- package/src/saas/internal-api/users/models/notification.settings.model.js +15 -15
- package/src/saas/internal-api/users/models/tenant.user.model.js +11 -11
- package/src/saas/internal-api/users/models/users.model.js +43 -43
- package/src/saas/internal-api/users/utils/util.js +50 -50
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +26 -26
- package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +19 -19
- package/src/saas/internal-api/vendorProfile/index.js +3 -3
- package/src/saas/openapi/accounts/accounts.api.js +17 -17
- package/src/saas/openapi/accounts/accounts.service.js +11 -11
- package/src/saas/openapi/coi/coi.api.js +35 -35
- package/src/saas/openapi/coi/coi.service.js +53 -53
- package/src/saas/openapi/projects/projects.api.js +83 -83
- package/src/saas/openapi/projects/projects.service.js +89 -89
- package/src/saas/openapi/relatedDocs/related.docs.api.js +30 -30
- package/src/saas/openapi/relatedDocs/related.docs.service.js +56 -56
- package/src/saas/openapi/requests/index.js +7 -7
- package/src/saas/openapi/requests/models/invite.request.model.js +42 -42
- package/src/saas/openapi/requests/models/update.request.model.js +37 -37
- package/src/saas/openapi/requests/requests.api.js +93 -93
- package/src/saas/openapi/requests/requests.service.js +100 -100
- package/src/saas/openapi/requirements/index.js +6 -6
- package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
- package/src/saas/openapi/requirements/requirements.api.js +41 -41
- package/src/saas/openapi/requirements/requirements.service.js +61 -61
- package/src/saas/openapi/tabs/index.js +6 -6
- package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
- package/src/saas/openapi/tabs/tabs.api.js +27 -27
- package/src/saas/openapi/tabs/tabs.service.js +26 -26
- package/src/saas/openapi/users/user.model.js +10 -10
- package/src/saas/openapi/users/users.api.js +33 -33
- package/src/saas/openapi/users/users.service.js +51 -51
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
const services = require('../api/core/projects.service');
|
|
2
|
-
|
|
3
|
-
const numberUtils = require('../../../../common/utils/numberUtils');
|
|
4
|
-
|
|
5
|
-
const CreateProjectModel = require('../models/core/create.project.model');
|
|
6
|
-
const UpdateProjectModel = require('../models/core/update.project.model');
|
|
7
|
-
|
|
8
|
-
const { NAME: DEFAULT_PROJECT_NAME } = require('../consts/defaultProject');
|
|
9
|
-
|
|
10
|
-
const getDefaultProjectId = async (accountId, context) => {
|
|
11
|
-
const defaultProject = await services.getProjectByName(accountId, DEFAULT_PROJECT_NAME, context);
|
|
12
|
-
return defaultProject ? defaultProject.projectId : null;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getOrCreateProject = (accountId, projectConfig, context) => {
|
|
16
|
-
const createProjectModel = getCreateProjectModel(accountId, projectConfig);
|
|
17
|
-
return services.getOrCreateProject(createProjectModel, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getCreateProjectModel = (accountId, projectData) => {
|
|
21
|
-
const createProjectModel = new CreateProjectModel(
|
|
22
|
-
accountId,
|
|
23
|
-
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
24
|
-
projectData.description || projectData['Region/Division'] || 'N/A',
|
|
25
|
-
projectData.address || projectData['Address'] || 'N/A',
|
|
26
|
-
projectData.number || projectData['Property Number'] || projectData['Project Number'] || 'N/A',
|
|
27
|
-
projectData.startDate || projectData['Start Date'] || '01/01/2021',
|
|
28
|
-
projectData.endDate || projectData['End Date'] || '01/01/2021',
|
|
29
|
-
projectData.city || projectData['City'] || 'N/A',
|
|
30
|
-
projectData.state || projectData['State'] || 'Alabama',
|
|
31
|
-
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
32
|
-
projectData.companyNameForProject || projectData['Company Name (for external communications)'] || projectData.name,
|
|
33
|
-
projectData.certificateHolder || projectData['Certificate Holder'] || '',
|
|
34
|
-
projectData.additionalInsured || projectData['Additional Insured'] || ''
|
|
35
|
-
);
|
|
36
|
-
return createProjectModel;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getUpdateProjectModel = (accountId, projectId, projectData) => {
|
|
40
|
-
const updateProjectModel = new UpdateProjectModel(
|
|
41
|
-
accountId,
|
|
42
|
-
projectId,
|
|
43
|
-
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
44
|
-
projectData.description || projectData['Region/Division'],
|
|
45
|
-
projectData.address || projectData['Address'],
|
|
46
|
-
projectData.number || projectData['Property Number'] || projectData['Project Number'],
|
|
47
|
-
projectData.startDate || projectData['Start Date'],
|
|
48
|
-
projectData.endDate || projectData['End Date'],
|
|
49
|
-
projectData.city || projectData['City'],
|
|
50
|
-
projectData.state || projectData['State'],
|
|
51
|
-
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
52
|
-
projectData.companyNameForProject || projectData['Company Name (for external communications)'],
|
|
53
|
-
projectData.certificateHolder || projectData['Certificate Holder'] || '',
|
|
54
|
-
projectData.additionalInsured || projectData['Additional Insured'] || ''
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
return updateProjectModel;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const getProjectConfig = (projectName, { city, state, accountName, projectNumber } = {}) => {
|
|
61
|
-
return {
|
|
62
|
-
'name': projectName,
|
|
63
|
-
'description': `${projectName}Description`,
|
|
64
|
-
'address': `${projectName}Street 14.`,
|
|
65
|
-
'number': projectNumber || numberUtils.getRandomNumberInRange(10000, 99999),
|
|
66
|
-
'startDate': '01/01/2022',
|
|
67
|
-
'endDate': '01/01/2030',
|
|
68
|
-
'city': city || `${projectName}City`,
|
|
69
|
-
'state': state || 'Alabama',
|
|
70
|
-
'zipCode': '11111',
|
|
71
|
-
'companyNameForProject': accountName || `${projectName}Account`
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const deleteProjectByName = (accountId, projectName, context) => {
|
|
76
|
-
return services.deleteProjectByName(accountId, projectName, context);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const isUIConfig = config => {
|
|
80
|
-
const allKeysSettings = { ... attributesConvertor, ... marketplaceAttributesConvertor, ... autoGapsConvertor, ... autocompleteAttributesConvertor };
|
|
81
|
-
const convectorKeys = Object.keys(allKeysSettings);
|
|
82
|
-
const configKeys = Object.keys(config);
|
|
83
|
-
|
|
84
|
-
return convectorKeys.some(key => configKeys.includes(key));
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const assignNewSettingFormat = (target, sourceKey, sourceValue, dictionaryObject) => {
|
|
88
|
-
const attributeKey = dictionaryObject[sourceKey];
|
|
89
|
-
const attributeValue = JSON.parse(sourceValue);
|
|
90
|
-
Object.assign(target, { [attributeKey]: attributeValue });
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const marketplaceParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
94
|
-
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
95
|
-
|
|
96
|
-
assignNewSettingFormat(settings.marketplaceSettings, sourceKey, sourceValue, dictionary);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const autoGapsParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
100
|
-
settings.autoGaps = settings.autoGaps || {};
|
|
101
|
-
|
|
102
|
-
assignNewSettingFormat(settings.autoGaps, sourceKey, sourceValue, dictionary);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const autocompleteParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
106
|
-
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
107
|
-
|
|
108
|
-
assignNewSettingFormat(settings.autocompleteSettings, sourceKey, sourceValue, dictionary);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const parseProjectSettingsConfig = (projectId, settingsConfig) => {
|
|
112
|
-
const settings = { projectId };
|
|
113
|
-
|
|
114
|
-
for (const setting in settingsConfig) {
|
|
115
|
-
marketplaceAttributesConvertor[setting] && marketplaceParser(settings, setting, settingsConfig[setting], marketplaceAttributesConvertor);
|
|
116
|
-
|
|
117
|
-
autocompleteAttributesConvertor[setting] && autocompleteParser(settings, setting, settingsConfig[setting], autocompleteAttributesConvertor);
|
|
118
|
-
|
|
119
|
-
attributesConvertor[setting] && assignNewSettingFormat(settings, setting, settingsConfig[setting], attributesConvertor);
|
|
120
|
-
|
|
121
|
-
autoGapsConvertor[setting] && autoGapsParser(settings, setting, settingsConfig[setting], autoGapsConvertor);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return settings;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
module.exports = {
|
|
128
|
-
getProjectConfig,
|
|
129
|
-
getOrCreateProject,
|
|
130
|
-
getDefaultProjectId,
|
|
131
|
-
getCreateProjectModel,
|
|
132
|
-
getUpdateProjectModel,
|
|
133
|
-
deleteProjectByName,
|
|
134
|
-
parseProjectSettingsConfig,
|
|
135
|
-
isUIConfig
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const attributesConvertor = {
|
|
139
|
-
'Automatic Renewal': 'autoRenewals',
|
|
140
|
-
'Onboarding Phase Enabled': 'onboardingPhase',
|
|
141
|
-
'Tenant App': 'tenantSolution'
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const marketplaceAttributesConvertor = {
|
|
145
|
-
'Vendor Network Onboarding': 'marketplaceEnabled',
|
|
146
|
-
'Vendor Network - Show Onboarded Vendors': 'marketplaceOnboardedVendors',
|
|
147
|
-
'Pre-Approved Tab': 'marketplacePreApproved',
|
|
148
|
-
'Compliant Vendor Quotation': 'marketplaceCompliantVendorQuotationEnabled'
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const autocompleteAttributesConvertor = {
|
|
152
|
-
'For Tenants': 'autocompleteAddVendorsForTenants'
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const autoGapsConvertor = {
|
|
156
|
-
'Guests': 'isAutoGapsEnabledForGuests',
|
|
157
|
-
'Tenants': 'isAutoGapsEnabledForTenants',
|
|
158
|
-
'Vendors': 'isAutoGapsEnabledForVendors'
|
|
159
|
-
};
|
|
1
|
+
const services = require('../api/core/projects.service');
|
|
2
|
+
|
|
3
|
+
const numberUtils = require('../../../../common/utils/numberUtils');
|
|
4
|
+
|
|
5
|
+
const CreateProjectModel = require('../models/core/create.project.model');
|
|
6
|
+
const UpdateProjectModel = require('../models/core/update.project.model');
|
|
7
|
+
|
|
8
|
+
const { NAME: DEFAULT_PROJECT_NAME } = require('../consts/defaultProject');
|
|
9
|
+
|
|
10
|
+
const getDefaultProjectId = async (accountId, context) => {
|
|
11
|
+
const defaultProject = await services.getProjectByName(accountId, DEFAULT_PROJECT_NAME, context);
|
|
12
|
+
return defaultProject ? defaultProject.projectId : null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getOrCreateProject = (accountId, projectConfig, context) => {
|
|
16
|
+
const createProjectModel = getCreateProjectModel(accountId, projectConfig);
|
|
17
|
+
return services.getOrCreateProject(createProjectModel, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getCreateProjectModel = (accountId, projectData) => {
|
|
21
|
+
const createProjectModel = new CreateProjectModel(
|
|
22
|
+
accountId,
|
|
23
|
+
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
24
|
+
projectData.description || projectData['Region/Division'] || 'N/A',
|
|
25
|
+
projectData.address || projectData['Address'] || 'N/A',
|
|
26
|
+
projectData.number || projectData['Property Number'] || projectData['Project Number'] || 'N/A',
|
|
27
|
+
projectData.startDate || projectData['Start Date'] || '01/01/2021',
|
|
28
|
+
projectData.endDate || projectData['End Date'] || '01/01/2021',
|
|
29
|
+
projectData.city || projectData['City'] || 'N/A',
|
|
30
|
+
projectData.state || projectData['State'] || 'Alabama',
|
|
31
|
+
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
32
|
+
projectData.companyNameForProject || projectData['Company Name (for external communications)'] || projectData.name,
|
|
33
|
+
projectData.certificateHolder || projectData['Certificate Holder'] || '',
|
|
34
|
+
projectData.additionalInsured || projectData['Additional Insured'] || ''
|
|
35
|
+
);
|
|
36
|
+
return createProjectModel;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getUpdateProjectModel = (accountId, projectId, projectData) => {
|
|
40
|
+
const updateProjectModel = new UpdateProjectModel(
|
|
41
|
+
accountId,
|
|
42
|
+
projectId,
|
|
43
|
+
projectData.name || projectData['Property Name'] || projectData['Project Name'],
|
|
44
|
+
projectData.description || projectData['Region/Division'],
|
|
45
|
+
projectData.address || projectData['Address'],
|
|
46
|
+
projectData.number || projectData['Property Number'] || projectData['Project Number'],
|
|
47
|
+
projectData.startDate || projectData['Start Date'],
|
|
48
|
+
projectData.endDate || projectData['End Date'],
|
|
49
|
+
projectData.city || projectData['City'],
|
|
50
|
+
projectData.state || projectData['State'],
|
|
51
|
+
projectData.zipCode || projectData['Zip Code'] || '11111',
|
|
52
|
+
projectData.companyNameForProject || projectData['Company Name (for external communications)'],
|
|
53
|
+
projectData.certificateHolder || projectData['Certificate Holder'] || '',
|
|
54
|
+
projectData.additionalInsured || projectData['Additional Insured'] || ''
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return updateProjectModel;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const getProjectConfig = (projectName, { city, state, accountName, projectNumber } = {}) => {
|
|
61
|
+
return {
|
|
62
|
+
'name': projectName,
|
|
63
|
+
'description': `${projectName}Description`,
|
|
64
|
+
'address': `${projectName}Street 14.`,
|
|
65
|
+
'number': projectNumber || numberUtils.getRandomNumberInRange(10000, 99999),
|
|
66
|
+
'startDate': '01/01/2022',
|
|
67
|
+
'endDate': '01/01/2030',
|
|
68
|
+
'city': city || `${projectName}City`,
|
|
69
|
+
'state': state || 'Alabama',
|
|
70
|
+
'zipCode': '11111',
|
|
71
|
+
'companyNameForProject': accountName || `${projectName}Account`
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const deleteProjectByName = (accountId, projectName, context) => {
|
|
76
|
+
return services.deleteProjectByName(accountId, projectName, context);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isUIConfig = config => {
|
|
80
|
+
const allKeysSettings = { ... attributesConvertor, ... marketplaceAttributesConvertor, ... autoGapsConvertor, ... autocompleteAttributesConvertor };
|
|
81
|
+
const convectorKeys = Object.keys(allKeysSettings);
|
|
82
|
+
const configKeys = Object.keys(config);
|
|
83
|
+
|
|
84
|
+
return convectorKeys.some(key => configKeys.includes(key));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const assignNewSettingFormat = (target, sourceKey, sourceValue, dictionaryObject) => {
|
|
88
|
+
const attributeKey = dictionaryObject[sourceKey];
|
|
89
|
+
const attributeValue = JSON.parse(sourceValue);
|
|
90
|
+
Object.assign(target, { [attributeKey]: attributeValue });
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const marketplaceParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
94
|
+
settings.marketplaceSettings = settings.marketplaceSettings || {};
|
|
95
|
+
|
|
96
|
+
assignNewSettingFormat(settings.marketplaceSettings, sourceKey, sourceValue, dictionary);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const autoGapsParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
100
|
+
settings.autoGaps = settings.autoGaps || {};
|
|
101
|
+
|
|
102
|
+
assignNewSettingFormat(settings.autoGaps, sourceKey, sourceValue, dictionary);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const autocompleteParser = (settings, sourceKey, sourceValue, dictionary) => {
|
|
106
|
+
settings.autocompleteSettings = settings.autocompleteSettings || {};
|
|
107
|
+
|
|
108
|
+
assignNewSettingFormat(settings.autocompleteSettings, sourceKey, sourceValue, dictionary);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const parseProjectSettingsConfig = (projectId, settingsConfig) => {
|
|
112
|
+
const settings = { projectId };
|
|
113
|
+
|
|
114
|
+
for (const setting in settingsConfig) {
|
|
115
|
+
marketplaceAttributesConvertor[setting] && marketplaceParser(settings, setting, settingsConfig[setting], marketplaceAttributesConvertor);
|
|
116
|
+
|
|
117
|
+
autocompleteAttributesConvertor[setting] && autocompleteParser(settings, setting, settingsConfig[setting], autocompleteAttributesConvertor);
|
|
118
|
+
|
|
119
|
+
attributesConvertor[setting] && assignNewSettingFormat(settings, setting, settingsConfig[setting], attributesConvertor);
|
|
120
|
+
|
|
121
|
+
autoGapsConvertor[setting] && autoGapsParser(settings, setting, settingsConfig[setting], autoGapsConvertor);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return settings;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
module.exports = {
|
|
128
|
+
getProjectConfig,
|
|
129
|
+
getOrCreateProject,
|
|
130
|
+
getDefaultProjectId,
|
|
131
|
+
getCreateProjectModel,
|
|
132
|
+
getUpdateProjectModel,
|
|
133
|
+
deleteProjectByName,
|
|
134
|
+
parseProjectSettingsConfig,
|
|
135
|
+
isUIConfig
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const attributesConvertor = {
|
|
139
|
+
'Automatic Renewal': 'autoRenewals',
|
|
140
|
+
'Onboarding Phase Enabled': 'onboardingPhase',
|
|
141
|
+
'Tenant App': 'tenantSolution'
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const marketplaceAttributesConvertor = {
|
|
145
|
+
'Vendor Network Onboarding': 'marketplaceEnabled',
|
|
146
|
+
'Vendor Network - Show Onboarded Vendors': 'marketplaceOnboardedVendors',
|
|
147
|
+
'Pre-Approved Tab': 'marketplacePreApproved',
|
|
148
|
+
'Compliant Vendor Quotation': 'marketplaceCompliantVendorQuotationEnabled'
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const autocompleteAttributesConvertor = {
|
|
152
|
+
'For Tenants': 'autocompleteAddVendorsForTenants'
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const autoGapsConvertor = {
|
|
156
|
+
'Guests': 'isAutoGapsEnabledForGuests',
|
|
157
|
+
'Tenants': 'isAutoGapsEnabledForTenants',
|
|
158
|
+
'Vendors': 'isAutoGapsEnabledForVendors'
|
|
159
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
2
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
getRecordHubDataByRecordId: recordId => `${backendUrl}/vendor-app/vendors/${recordId}/false`,
|
|
6
|
-
updateRecordPartially: recordId => `${backendUrl}/vendor-app/vendors/${recordId}`
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const getRecordHubDataByRecordId = (recordId, context) => {
|
|
10
|
-
return requests.getRequestHandler(Endpoints.getRecordHubDataByRecordId(recordId), {}, context);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const updateRecordPartially = (recordId, body, context) => {
|
|
14
|
-
return requests.patchRequestHandler(Endpoints.updateRecordPartially(recordId), context, body);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
getRecordHubDataByRecordId,
|
|
19
|
-
updateRecordPartially
|
|
20
|
-
};
|
|
1
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
2
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
getRecordHubDataByRecordId: recordId => `${backendUrl}/vendor-app/vendors/${recordId}/false`,
|
|
6
|
+
updateRecordPartially: recordId => `${backendUrl}/vendor-app/vendors/${recordId}`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getRecordHubDataByRecordId = (recordId, context) => {
|
|
10
|
+
return requests.getRequestHandler(Endpoints.getRecordHubDataByRecordId(recordId), {}, context);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const updateRecordPartially = (recordId, body, context) => {
|
|
14
|
+
return requests.patchRequestHandler(Endpoints.updateRecordPartially(recordId), context, body);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
getRecordHubDataByRecordId,
|
|
19
|
+
updateRecordPartially
|
|
20
|
+
};
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
const recordHubAPI = require('./record.hub.api');
|
|
2
|
-
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
3
|
-
|
|
4
|
-
const getRecordHubDataByRecordId = (recordId, context) => {
|
|
5
|
-
return recordHubAPI.getRecordHubDataByRecordId(recordId, context);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const doesRecordHaveAgreementStep = async (recordId, context) => {
|
|
9
|
-
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
10
|
-
|
|
11
|
-
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
12
|
-
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return recordDataResponse?.data?.isVendorsAgreementSignNeeded;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const isFullPolicyCopyInRequirementByRecordId = async (recordId, context) => {
|
|
19
|
-
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
20
|
-
|
|
21
|
-
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
22
|
-
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return recordDataResponse?.data?.isFullPolicyCopyInRequirement;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Submits the Company Information step exactly as the vendor app does.
|
|
30
|
-
*
|
|
31
|
-
* The company details are always sent in full: the server copies company, dba, location, city, state,
|
|
32
|
-
* zipCode and phoneNumber from the body onto the record unconditionally, so a body that omits them
|
|
33
|
-
* nulls them out and later assertions fail for reasons that have nothing to do with broker emails.
|
|
34
|
-
*
|
|
35
|
-
* brokerEmails is included only when the caller passes it. An absent key and an empty array mean
|
|
36
|
-
* different things to the server - absent is a no-op, empty clears every stored address - so the
|
|
37
|
-
* distinction has to survive all the way down to the request body.
|
|
38
|
-
*/
|
|
39
|
-
const updateCompanyDetails = async (recordId, companyDetails, context, { brokerEmails, expectError = false } = {}) => {
|
|
40
|
-
const body = { contractorId: recordId, ... companyDetails };
|
|
41
|
-
|
|
42
|
-
if (brokerEmails !== undefined) {
|
|
43
|
-
body.brokerEmails = brokerEmails;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const response = await recordHubAPI.updateRecordPartially(recordId, body, context);
|
|
47
|
-
|
|
48
|
-
if (expectError) {
|
|
49
|
-
return response;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (response.status !== httpResponseStatusCodes.ACCEPTED) {
|
|
53
|
-
throw new Error(`Failed to update company details for record ${recordId}, response status - ${response.status}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return response;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const getActiveBrokerEmails = async (recordId, context) => {
|
|
60
|
-
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
61
|
-
|
|
62
|
-
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
63
|
-
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return recordDataResponse?.data?.brokerEmails;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const isCertificialEnabledForRecord = async (recordId, context) => {
|
|
70
|
-
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
71
|
-
|
|
72
|
-
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
73
|
-
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return recordDataResponse?.data?.isCertificialEnabled;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
module.exports = {
|
|
80
|
-
getRecordHubDataByRecordId,
|
|
81
|
-
doesRecordHaveAgreementStep,
|
|
82
|
-
isFullPolicyCopyInRequirementByRecordId,
|
|
83
|
-
updateCompanyDetails,
|
|
84
|
-
getActiveBrokerEmails,
|
|
85
|
-
isCertificialEnabledForRecord
|
|
86
|
-
};
|
|
1
|
+
const recordHubAPI = require('./record.hub.api');
|
|
2
|
+
const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
|
|
3
|
+
|
|
4
|
+
const getRecordHubDataByRecordId = (recordId, context) => {
|
|
5
|
+
return recordHubAPI.getRecordHubDataByRecordId(recordId, context);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const doesRecordHaveAgreementStep = async (recordId, context) => {
|
|
9
|
+
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
10
|
+
|
|
11
|
+
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
12
|
+
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return recordDataResponse?.data?.isVendorsAgreementSignNeeded;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const isFullPolicyCopyInRequirementByRecordId = async (recordId, context) => {
|
|
19
|
+
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
20
|
+
|
|
21
|
+
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
22
|
+
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return recordDataResponse?.data?.isFullPolicyCopyInRequirement;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Submits the Company Information step exactly as the vendor app does.
|
|
30
|
+
*
|
|
31
|
+
* The company details are always sent in full: the server copies company, dba, location, city, state,
|
|
32
|
+
* zipCode and phoneNumber from the body onto the record unconditionally, so a body that omits them
|
|
33
|
+
* nulls them out and later assertions fail for reasons that have nothing to do with broker emails.
|
|
34
|
+
*
|
|
35
|
+
* brokerEmails is included only when the caller passes it. An absent key and an empty array mean
|
|
36
|
+
* different things to the server - absent is a no-op, empty clears every stored address - so the
|
|
37
|
+
* distinction has to survive all the way down to the request body.
|
|
38
|
+
*/
|
|
39
|
+
const updateCompanyDetails = async (recordId, companyDetails, context, { brokerEmails, expectError = false } = {}) => {
|
|
40
|
+
const body = { contractorId: recordId, ... companyDetails };
|
|
41
|
+
|
|
42
|
+
if (brokerEmails !== undefined) {
|
|
43
|
+
body.brokerEmails = brokerEmails;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const response = await recordHubAPI.updateRecordPartially(recordId, body, context);
|
|
47
|
+
|
|
48
|
+
if (expectError) {
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (response.status !== httpResponseStatusCodes.ACCEPTED) {
|
|
53
|
+
throw new Error(`Failed to update company details for record ${recordId}, response status - ${response.status}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return response;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getActiveBrokerEmails = async (recordId, context) => {
|
|
60
|
+
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
61
|
+
|
|
62
|
+
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
63
|
+
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return recordDataResponse?.data?.brokerEmails;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const isCertificialEnabledForRecord = async (recordId, context) => {
|
|
70
|
+
const recordDataResponse = await getRecordHubDataByRecordId(recordId, context);
|
|
71
|
+
|
|
72
|
+
if (recordDataResponse.status !== httpResponseStatusCodes.OK) {
|
|
73
|
+
throw new Error(`Failed to get record hub data, response status - ${recordDataResponse.status}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return recordDataResponse?.data?.isCertificialEnabled;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
module.exports = {
|
|
80
|
+
getRecordHubDataByRecordId,
|
|
81
|
+
doesRecordHaveAgreementStep,
|
|
82
|
+
isFullPolicyCopyInRequirementByRecordId,
|
|
83
|
+
updateCompanyDetails,
|
|
84
|
+
getActiveBrokerEmails,
|
|
85
|
+
isCertificialEnabledForRecord
|
|
86
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const services = require('./api/record.hub.service');
|
|
2
|
-
|
|
3
|
-
module.exports = { services };
|
|
1
|
+
const services = require('./api/record.hub.service');
|
|
2
|
+
|
|
3
|
+
module.exports = { services };
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
-
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
-
|
|
4
|
-
const Endpoints = {
|
|
5
|
-
create: `${backendUrl}/saas/contractors/notes`,
|
|
6
|
-
getNotesByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
7
|
-
getNotesCountByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes/count`,
|
|
8
|
-
deleteByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`,
|
|
9
|
-
updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const createRecordNote = (data, context) => {
|
|
13
|
-
return requests.postRequestHandler(Endpoints.create, data, context);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getNotesByRecordId = (recordId, context) => {
|
|
17
|
-
return requests.getRequestHandler(Endpoints.getNotesByRecordId(recordId), {}, context);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getNotesCountByRecordId = (recordId, context) => {
|
|
21
|
-
return requests.getRequestHandler(Endpoints.getNotesCountByRecordId(recordId), {}, context);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const deleteByNoteId = (id, data, context) => {
|
|
25
|
-
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, {}, {}, data);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const updateByNoteId = (id, data, context) => {
|
|
29
|
-
return requests.putRequestHandler(Endpoints.updateByNoteId(id), data, context);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
createRecordNote,
|
|
34
|
-
getNotesByRecordId,
|
|
35
|
-
getNotesCountByRecordId,
|
|
36
|
-
deleteByNoteId,
|
|
37
|
-
updateByNoteId
|
|
38
|
-
};
|
|
1
|
+
const requests = require('../../../../common/requests/cookieAuth/requests');
|
|
2
|
+
const { backendUrl } = require('../../../../env').getEnv();
|
|
3
|
+
|
|
4
|
+
const Endpoints = {
|
|
5
|
+
create: `${backendUrl}/saas/contractors/notes`,
|
|
6
|
+
getNotesByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes`,
|
|
7
|
+
getNotesCountByRecordId: recordId => `${backendUrl}/saas/contractors/${recordId}/notes/count`,
|
|
8
|
+
deleteByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`,
|
|
9
|
+
updateByNoteId: noteId => `${backendUrl}/saas/contractors/notes/${noteId}`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const createRecordNote = (data, context) => {
|
|
13
|
+
return requests.postRequestHandler(Endpoints.create, data, context);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getNotesByRecordId = (recordId, context) => {
|
|
17
|
+
return requests.getRequestHandler(Endpoints.getNotesByRecordId(recordId), {}, context);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getNotesCountByRecordId = (recordId, context) => {
|
|
21
|
+
return requests.getRequestHandler(Endpoints.getNotesCountByRecordId(recordId), {}, context);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const deleteByNoteId = (id, data, context) => {
|
|
25
|
+
return requests.deleteRequestHandler(Endpoints.deleteByNoteId(id), context, {}, {}, data);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const updateByNoteId = (id, data, context) => {
|
|
29
|
+
return requests.putRequestHandler(Endpoints.updateByNoteId(id), data, context);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
createRecordNote,
|
|
34
|
+
getNotesByRecordId,
|
|
35
|
+
getNotesCountByRecordId,
|
|
36
|
+
deleteByNoteId,
|
|
37
|
+
updateByNoteId
|
|
38
|
+
};
|