rez_core 5.0.28 → 5.0.29
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/.prettierrc +3 -3
- package/README.md +99 -99
- package/dist/module/auth/guards/role.guard.js +3 -3
- package/dist/module/auth/services/auth.service.js +2 -2
- package/dist/module/entity_json/controller/entity_json.controller.d.ts +11 -1
- package/dist/module/entity_json/controller/entity_json.controller.js +14 -0
- package/dist/module/entity_json/controller/entity_json.controller.js.map +1 -1
- package/dist/module/entity_json/entity/entityJson.entity.d.ts +10 -0
- package/dist/module/entity_json/entity/entityJson.entity.js +55 -0
- package/dist/module/entity_json/entity/entityJson.entity.js.map +1 -0
- package/dist/module/entity_json/entity_json.module.js +4 -2
- package/dist/module/entity_json/entity_json.module.js.map +1 -1
- package/dist/module/entity_json/service/entityJson.repository.d.ts +7 -0
- package/dist/module/entity_json/service/entityJson.repository.js +45 -0
- package/dist/module/entity_json/service/entityJson.repository.js.map +1 -0
- package/dist/module/entity_json/service/entity_json.service.d.ts +14 -4
- package/dist/module/entity_json/service/entity_json.service.js +84 -57
- package/dist/module/entity_json/service/entity_json.service.js.map +1 -1
- package/dist/module/filter/repository/saved-filter.repository.js +4 -4
- package/dist/module/filter/service/filter-evaluator.service.js +2 -2
- package/dist/module/filter/service/filter.service.js +106 -36
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/examples/usage.example.js +9 -9
- package/dist/module/integration/service/integration.service.js +1 -1
- package/dist/module/integration/service/wrapper.service.js +26 -26
- package/dist/module/linked_attributes/controller/linked_attributes.controller.d.ts +2 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js +26 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js.map +1 -1
- package/dist/module/linked_attributes/entity/linked_attribute.entity.d.ts +1 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js +4 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js.map +1 -1
- package/dist/module/linked_attributes/service/linked_attributes.service.d.ts +6 -1
- package/dist/module/linked_attributes/service/linked_attributes.service.js +61 -2
- package/dist/module/linked_attributes/service/linked_attributes.service.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.js +2 -2
- package/dist/module/listmaster/service/list-master.service.js +13 -2
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/mapper/service/field-mapper.service.js +4 -4
- package/dist/module/mapper/service/mapper.service.js +2 -2
- package/dist/module/meta/controller/attribute-master.controller.d.ts +2 -3
- package/dist/module/meta/controller/attribute-master.controller.js +2 -12
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/entity/attribute-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/attribute-master.entity.js +4 -0
- package/dist/module/meta/entity/attribute-master.entity.js.map +1 -1
- package/dist/module/meta/repository/entity-attribute-update.repository.js +3 -3
- package/dist/module/meta/repository/entity-master.repository.js +6 -6
- package/dist/module/meta/service/entity-dynamic.service.js +44 -44
- package/dist/module/meta/service/entity-list.service.js +3 -3
- package/dist/module/meta/service/entity-master.service.js +3 -3
- package/dist/module/meta/service/entity-relation.service.js +9 -9
- package/dist/module/meta/service/entity-service-impl.service.js +3 -3
- package/dist/module/meta/service/resolver.service.js +3 -3
- package/dist/module/module/repository/menu.repository.js +12 -12
- package/dist/module/notification/controller/otp.controller.d.ts +1 -31
- package/dist/module/notification/service/notification.service.js +10 -10
- package/dist/module/notification/service/otp.service.d.ts +1 -31
- package/dist/module/notification/service/otp.service.js +1 -0
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +20 -19
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +3 -57
- package/dist/module/user/service/login.service.js +12 -2
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/role.service.js +4 -4
- package/dist/module/user/service/user-session.service.js +2 -2
- package/dist/module/user/service/user.service.js +1 -1
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.js +20 -20
- package/dist/module/workflow/repository/comm-template.repository.js +6 -6
- package/dist/module/workflow/repository/form-master.repository.js +2 -2
- package/dist/module/workflow/repository/stage-group.repository.js +20 -20
- package/dist/module/workflow/repository/stage-movement.repository.js +17 -17
- package/dist/module/workflow/repository/stage.repository.js +8 -8
- package/dist/module/workflow/service/action-template-mapping.service.js +31 -31
- package/dist/module/workflow/service/action.service.js +7 -7
- package/dist/module/workflow/service/entity-modification.service.js +2 -2
- package/dist/module/workflow/service/stage-group.service.js +2 -2
- package/dist/module/workflow/service/stage.service.js +2 -2
- package/dist/module/workflow/service/task.service.js +35 -35
- package/dist/module/workflow/service/workflow-list-master.service.js +15 -15
- package/dist/module/workflow/service/workflow-meta.service.js +27 -27
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.js +2 -2
- package/dist/module/workflow-automation/service/schedule-handler.service.d.ts +11 -5
- package/dist/module/workflow-automation/service/schedule-handler.service.js +59 -27
- package/dist/module/workflow-automation/service/schedule-handler.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.d.ts +4 -3
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js +12 -4
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +4 -2
- package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
- package/dist/module/workflow-automation/workflow-automation.module.js +6 -0
- package/dist/module/workflow-automation/workflow-automation.module.js.map +1 -1
- package/dist/module/workflow-schedule/processors/schedule.processor.js +4 -4
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js +10 -10
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/reflection-helper.service.js +2 -2
- package/docs/modules/event-driven-integration-design.md +91 -91
- package/docs/modules/integration.md +250 -250
- package/eslint.config.mjs +34 -34
- package/nest-cli.json +14 -14
- package/package.json +124 -124
- package/src/app.controller.ts +12 -12
- package/src/app.module.ts +66 -66
- package/src/app.service.ts +8 -8
- package/src/config/bull.config.ts +69 -69
- package/src/config/config.module.ts +17 -17
- package/src/config/database.config.ts +48 -48
- package/src/constant/global.constant.ts +67 -67
- package/src/core.module.ts +88 -88
- package/src/decorators/roles.decorator.ts +7 -7
- package/src/dtos/response.dto.ts +6 -6
- package/src/dtos/response.ts +5 -5
- package/src/index.ts +1 -1
- package/src/module/auth/auth.module.ts +49 -49
- package/src/module/auth/controller/auth.controller.ts +28 -28
- package/src/module/auth/guards/google-auth.guard.ts +9 -9
- package/src/module/auth/guards/jwt.guard.ts +22 -22
- package/src/module/auth/guards/role.guard.ts +68 -68
- package/src/module/auth/services/auth.service.ts +50 -50
- package/src/module/auth/services/jwt.service.ts +11 -11
- package/src/module/auth/strategies/google.strategy.ts +54 -54
- package/src/module/auth/strategies/jwt.strategy.ts +58 -58
- package/src/module/auth/strategies/local.strategy.ts +13 -13
- package/src/module/dashboard/controller/dashboard.controller.ts +36 -36
- package/src/module/dashboard/dashboard.module.ts +21 -21
- package/src/module/dashboard/entity/dashboard_page_data.entity.ts +27 -27
- package/src/module/dashboard/entity/widget_master.entity.ts +18 -18
- package/src/module/dashboard/repository/dashboard.repository.ts +42 -42
- package/src/module/dashboard/service/dashboard.service.ts +73 -73
- package/src/module/dev/dev.module.ts +12 -12
- package/src/module/dev/service/dev.service.ts +7 -7
- package/src/module/enterprise/controller/organization.controller.ts +36 -36
- package/src/module/enterprise/enterprise.module.ts +30 -30
- package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
- package/src/module/enterprise/entity/organization-app-mapping.entity.ts +13 -13
- package/src/module/enterprise/entity/organization.entity.ts +92 -92
- package/src/module/enterprise/repository/enterprise.repository.ts +31 -31
- package/src/module/enterprise/repository/organization.repository.ts +26 -26
- package/src/module/enterprise/repository/school.repository.ts +278 -278
- package/src/module/enterprise/service/brand.service.ts +5 -5
- package/src/module/enterprise/service/enterprise.service.ts +16 -16
- package/src/module/enterprise/service/organization-app-mapping.service.ts +4 -4
- package/src/module/enterprise/service/organization.service.ts +145 -145
- package/src/module/entity_json/controller/entity_json.controller.ts +47 -47
- package/src/module/entity_json/entity/entityJson.entity.ts +39 -0
- package/src/module/entity_json/entity_json.module.ts +18 -15
- package/src/module/entity_json/service/entityJson.repository.ts +37 -0
- package/src/module/entity_json/service/entity_json.service.ts +234 -265
- package/src/module/filter/controller/filter.controller.ts +84 -84
- package/src/module/filter/dto/filter-request.dto.ts +38 -38
- package/src/module/filter/entity/saved-filter-detail.entity.ts +41 -41
- package/src/module/filter/entity/saved-filter-master.entity.ts +23 -23
- package/src/module/filter/filter.module.ts +31 -31
- package/src/module/filter/repository/saved-filter.repository.ts +168 -168
- package/src/module/filter/service/filter-evaluator.service.ts +86 -86
- package/src/module/filter/service/filter.service.ts +1144 -1051
- package/src/module/filter/service/saved-filter.service.ts +170 -170
- package/src/module/ics/controller/ics.controller.ts +21 -21
- package/src/module/ics/dto/ics.dto.ts +55 -55
- package/src/module/ics/ics.module.ts +13 -13
- package/src/module/ics/service/ics.service.ts +57 -57
- package/src/module/integration/controller/calender-event.controller.ts +31 -31
- package/src/module/integration/controller/integration.controller.ts +662 -662
- package/src/module/integration/controller/wrapper.controller.ts +37 -37
- package/src/module/integration/dto/create-config.dto.ts +526 -526
- package/src/module/integration/entity/integration-config.entity.ts +112 -112
- package/src/module/integration/entity/integration-entity-mapper.entity.ts +14 -14
- package/src/module/integration/entity/integration-source.entity.ts +17 -17
- package/src/module/integration/entity/user-integration.entity.ts +71 -71
- package/src/module/integration/examples/usage.example.ts +338 -338
- package/src/module/integration/factories/base.factory.ts +7 -7
- package/src/module/integration/factories/email.factory.ts +49 -49
- package/src/module/integration/factories/integration.factory.ts +121 -121
- package/src/module/integration/factories/sms.factory.ts +51 -51
- package/src/module/integration/factories/telephone.factory.ts +41 -41
- package/src/module/integration/factories/whatsapp.factory.ts +56 -56
- package/src/module/integration/integration.module.ts +110 -110
- package/src/module/integration/service/calendar-event.service.ts +118 -118
- package/src/module/integration/service/integration-entity-mapper.service.ts +17 -17
- package/src/module/integration/service/integration-queue.service.ts +229 -229
- package/src/module/integration/service/integration.service.ts +2633 -2633
- package/src/module/integration/service/oauth.service.ts +224 -224
- package/src/module/integration/service/wrapper.service.ts +701 -701
- package/src/module/integration/strategies/email/gmail-api.strategy.ts +280 -280
- package/src/module/integration/strategies/email/outlook-api.strategy.ts +44 -44
- package/src/module/integration/strategies/email/outlook.strategy.ts +64 -64
- package/src/module/integration/strategies/email/sendgrid-api.strategy.ts +260 -260
- package/src/module/integration/strategies/integration.strategy.ts +97 -97
- package/src/module/integration/strategies/sms/gupshup-sms.strategy.ts +146 -146
- package/src/module/integration/strategies/sms/msg91-sms.strategy.ts +164 -164
- package/src/module/integration/strategies/sms/tubelight-sms.strategy.ts +163 -163
- package/src/module/integration/strategies/telephone/ozonetel-voice.strategy.ts +238 -238
- package/src/module/integration/strategies/telephone/tubelight-voice.strategy.ts +210 -210
- package/src/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.ts +359 -359
- package/src/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.ts +372 -372
- package/src/module/integration/strategies/whatsapp/whatsapp-cloud.strategy.ts +403 -403
- package/src/module/integration/strategies/whatsapp/whatsapp.strategy.ts +57 -57
- package/src/module/layout/controller/layout.controller.ts +47 -47
- package/src/module/layout/entity/header-items.entity.ts +28 -28
- package/src/module/layout/entity/header-section.entity.ts +19 -19
- package/src/module/layout/layout.module.ts +21 -21
- package/src/module/layout/repository/header-items.repository.ts +18 -18
- package/src/module/layout/repository/header-section.repository.ts +22 -22
- package/src/module/layout/service/header-section.service.ts +25 -25
- package/src/module/layout_preference/controller/layout_preference.controller.ts +73 -73
- package/src/module/layout_preference/entity/layout_preference.entity.ts +28 -28
- package/src/module/layout_preference/layout_preference.module.ts +22 -22
- package/src/module/layout_preference/repository/layout_preference.repository.ts +65 -65
- package/src/module/layout_preference/service/layout_preference.service.ts +191 -191
- package/src/module/lead/controller/lead.controller.ts +30 -30
- package/src/module/lead/lead.module.ts +14 -14
- package/src/module/lead/repository/lead.repository.ts +41 -41
- package/src/module/lead/service/lead.service.ts +54 -54
- package/src/module/linked_attributes/controller/linked_attributes.controller.ts +34 -10
- package/src/module/linked_attributes/entity/linked_attribute.entity.ts +51 -48
- package/src/module/linked_attributes/linked_attributes.module.ts +16 -16
- package/src/module/linked_attributes/repository/linked_attribute.repository.ts +12 -12
- package/src/module/linked_attributes/service/linked_attributes.service.ts +102 -22
- package/src/module/listmaster/controller/list-master.controller.ts +230 -230
- package/src/module/listmaster/entity/list-master-items.entity.ts +43 -43
- package/src/module/listmaster/entity/list-master.entity.ts +33 -33
- package/src/module/listmaster/listmaster.module.ts +46 -46
- package/src/module/listmaster/repository/list-master-items.repository.ts +173 -173
- package/src/module/listmaster/repository/list-master.repository.ts +46 -46
- package/src/module/listmaster/service/list-master-engine.ts +19 -19
- package/src/module/listmaster/service/list-master-extension.interface.ts +4 -4
- package/src/module/listmaster/service/list-master-item.service.ts +292 -292
- package/src/module/listmaster/service/list-master-registry.ts +15 -15
- package/src/module/listmaster/service/list-master.service.ts +558 -535
- package/src/module/mapper/controller/field-mapper.controller.ts +76 -76
- package/src/module/mapper/controller/mapper.controller.ts +20 -20
- package/src/module/mapper/dto/field-mapper.dto.ts +14 -14
- package/src/module/mapper/entity/field-lovs.entity.ts +19 -19
- package/src/module/mapper/entity/field-mapper.entity.ts +53 -53
- package/src/module/mapper/entity/mapper.entity.ts +16 -16
- package/src/module/mapper/mapper.module.ts +34 -34
- package/src/module/mapper/repository/field-lovs.repository.ts +35 -35
- package/src/module/mapper/repository/field-mapper.repository.ts +42 -42
- package/src/module/mapper/repository/mapper.repository.ts +15 -15
- package/src/module/mapper/service/field-mapper.service.ts +271 -271
- package/src/module/mapper/service/mapper.service.ts +79 -79
- package/src/module/master/controller/master.controller.ts +74 -74
- package/src/module/master/service/master.service.ts +483 -483
- package/src/module/meta/controller/app-master.controller.ts +38 -38
- package/src/module/meta/controller/attribute-master.controller.ts +84 -86
- package/src/module/meta/controller/entity-dynamic.controller.ts +125 -125
- package/src/module/meta/controller/entity-master.controller.ts +41 -41
- package/src/module/meta/controller/entity-relation.controller.ts +36 -36
- package/src/module/meta/controller/entity.controller.ts +392 -392
- package/src/module/meta/controller/entity.public.controller.ts +75 -75
- package/src/module/meta/controller/media.controller.ts +107 -107
- package/src/module/meta/controller/meta.controller.ts +96 -96
- package/src/module/meta/controller/view-master.controller.ts +86 -86
- package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
- package/src/module/meta/dto/entity-tab.dto.ts +4 -4
- package/src/module/meta/dto/entity-table.dto.ts +9 -9
- package/src/module/meta/entity/app-master.entity.ts +34 -34
- package/src/module/meta/entity/attribute-master.entity.ts +92 -89
- package/src/module/meta/entity/base-entity.entity.ts +75 -75
- package/src/module/meta/entity/entity-master.entity.ts +85 -85
- package/src/module/meta/entity/entity-relation-data.entity.ts +29 -29
- package/src/module/meta/entity/entity-relation.entity.ts +23 -23
- package/src/module/meta/entity/entity-table-column.entity.ts +61 -61
- package/src/module/meta/entity/entity-table.entity.ts +50 -50
- package/src/module/meta/entity/media-data.entity.ts +32 -32
- package/src/module/meta/entity/preference.entity.ts +62 -62
- package/src/module/meta/entity/view-master.entity.ts +41 -41
- package/src/module/meta/entity.module.ts +166 -166
- package/src/module/meta/repository/app-master.repository.ts +20 -20
- package/src/module/meta/repository/attribute-master.repository.ts +138 -138
- package/src/module/meta/repository/entity-attribute-update.repository.ts +44 -44
- package/src/module/meta/repository/entity-master.repository.ts +111 -111
- package/src/module/meta/repository/entity-table-column.repository.ts +39 -39
- package/src/module/meta/repository/entity-table.repository.ts +53 -53
- package/src/module/meta/repository/media-data.repository.ts +50 -50
- package/src/module/meta/repository/preference.repository.ts +20 -20
- package/src/module/meta/repository/user-app-mapping.repository.ts +28 -28
- package/src/module/meta/repository/view-master.repository.ts +42 -42
- package/src/module/meta/service/app-master.service.ts +37 -37
- package/src/module/meta/service/attribute-master.service.ts +130 -130
- package/src/module/meta/service/common.service.ts +9 -9
- package/src/module/meta/service/entity-attribute-update.service.ts +28 -28
- package/src/module/meta/service/entity-dynamic.service.ts +809 -809
- package/src/module/meta/service/entity-list.service.ts +205 -205
- package/src/module/meta/service/entity-master.service.ts +175 -175
- package/src/module/meta/service/entity-realation-data.service.ts +9 -9
- package/src/module/meta/service/entity-relation.service.ts +87 -87
- package/src/module/meta/service/entity-service-impl.service.ts +525 -525
- package/src/module/meta/service/entity-table-column.service.ts +39 -39
- package/src/module/meta/service/entity-table.service.ts +150 -150
- package/src/module/meta/service/entity-validation.service.ts +187 -187
- package/src/module/meta/service/entity.service.ts +67 -67
- package/src/module/meta/service/field-group.service.ts +103 -103
- package/src/module/meta/service/media-data.service.ts +507 -507
- package/src/module/meta/service/populate-meta.service.ts +193 -193
- package/src/module/meta/service/preference.service.ts +16 -16
- package/src/module/meta/service/resolver.service.ts +271 -271
- package/src/module/meta/service/section-master.service.ts +104 -104
- package/src/module/meta/service/update-form-json.service.ts +22 -22
- package/src/module/meta/service/user-app-mapping.service.ts +17 -17
- package/src/module/meta/service/view-master.service.ts +127 -127
- package/src/module/microservice-client/microservice-clients.module.ts +13 -13
- package/src/module/microservice-client/service/microservice-client-factory.ts +37 -37
- package/src/module/microservice-client/service/microservice-clients.ts +4 -4
- package/src/module/module/controller/menu.controller.ts +15 -15
- package/src/module/module/controller/module-access.controller.ts +134 -134
- package/src/module/module/entity/menu.entity.ts +43 -43
- package/src/module/module/entity/module-access.entity.ts +25 -25
- package/src/module/module/entity/module-action.entity.ts +17 -17
- package/src/module/module/entity/module.entity.ts +52 -52
- package/src/module/module/module.module.ts +42 -42
- package/src/module/module/repository/menu.repository.ts +184 -184
- package/src/module/module/repository/module-access.repository.ts +344 -344
- package/src/module/module/service/menu.service.ts +82 -82
- package/src/module/module/service/module-access.service.ts +194 -194
- package/src/module/notification/controller/notification.controller.ts +58 -58
- package/src/module/notification/controller/otp.controller.ts +117 -117
- package/src/module/notification/entity/notification.entity.ts +26 -26
- package/src/module/notification/entity/otp.entity.ts +28 -28
- package/src/module/notification/firebase-admin.config.ts +22 -22
- package/src/module/notification/notification.module.ts +69 -69
- package/src/module/notification/repository/otp.repository.ts +27 -27
- package/src/module/notification/service/email.service.ts +127 -127
- package/src/module/notification/service/notification.service.ts +160 -160
- package/src/module/notification/service/otp.service.ts +133 -132
- package/src/module/third-party-module/entity/third-party-api-registry.entity.ts +52 -52
- package/src/module/third-party-module/repository/third-party-api-registry.repository.ts +20 -20
- package/src/module/third-party-module/service/api-registry.service.ts +13 -13
- package/src/module/third-party-module/third-party.module.ts +12 -12
- package/src/module/user/controller/login.controller.ts +198 -197
- package/src/module/user/controller/user.controller.ts +40 -40
- package/src/module/user/dto/create-user.dto.ts +62 -62
- package/src/module/user/dto/update-user.dto.ts +4 -4
- package/src/module/user/entity/role.entity.ts +33 -33
- package/src/module/user/entity/user-role-mapping.entity.ts +38 -38
- package/src/module/user/entity/user-session.entity.ts +73 -73
- package/src/module/user/entity/user.entity.ts +59 -59
- package/src/module/user/repository/role.repository.ts +96 -96
- package/src/module/user/repository/user-role-mapping.repository.ts +126 -126
- package/src/module/user/repository/user.repository.ts +50 -50
- package/src/module/user/repository/userSession.repository.ts +33 -33
- package/src/module/user/service/login.service.ts +326 -304
- package/src/module/user/service/role.service.ts +189 -189
- package/src/module/user/service/user-role-mapping.service.ts +98 -98
- package/src/module/user/service/user-session.service.ts +168 -168
- package/src/module/user/service/user.service.ts +368 -365
- package/src/module/user/user.module.ts +65 -65
- package/src/module/workflow/controller/action-category.controller.ts +54 -54
- package/src/module/workflow/controller/action-resource-mapping.controller.ts +23 -23
- package/src/module/workflow/controller/action-template-mapping.controller.ts +35 -35
- package/src/module/workflow/controller/action.controller.ts +111 -111
- package/src/module/workflow/controller/activity-log.controller.ts +55 -55
- package/src/module/workflow/controller/comm-template.controller.ts +43 -43
- package/src/module/workflow/controller/entity-modification.controller.ts +35 -35
- package/src/module/workflow/controller/form-master.controller.ts +43 -43
- package/src/module/workflow/controller/stage-group.controller.ts +48 -48
- package/src/module/workflow/controller/stage.controller.ts +50 -50
- package/src/module/workflow/controller/task.controller.ts +77 -77
- package/src/module/workflow/controller/workflow-list-master.controller.ts +44 -44
- package/src/module/workflow/controller/workflow-meta.controller.ts +80 -80
- package/src/module/workflow/controller/workflow.controller.ts +67 -67
- package/src/module/workflow/entity/action-category.entity.ts +38 -38
- package/src/module/workflow/entity/action-data.entity.ts +55 -55
- package/src/module/workflow/entity/action-resources-mapping.entity.ts +29 -29
- package/src/module/workflow/entity/action-template-mapping.entity.ts +17 -17
- package/src/module/workflow/entity/action.entity.ts +53 -53
- package/src/module/workflow/entity/activity-log.entity.ts +43 -43
- package/src/module/workflow/entity/comm-template.entity.ts +43 -43
- package/src/module/workflow/entity/entity-modification.entity.ts +38 -38
- package/src/module/workflow/entity/form.entity.ts +25 -25
- package/src/module/workflow/entity/stage-action-mapping.entity.ts +17 -17
- package/src/module/workflow/entity/stage-group.entity.ts +23 -23
- package/src/module/workflow/entity/stage-movement-data.entity.ts +38 -38
- package/src/module/workflow/entity/stage.entity.ts +20 -20
- package/src/module/workflow/entity/task-data.entity.ts +88 -88
- package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -30
- package/src/module/workflow/entity/workflow-data.entity.ts +11 -11
- package/src/module/workflow/entity/workflow-level-mapping.entity.ts +18 -18
- package/src/module/workflow/entity/workflow.entity.ts +20 -20
- package/src/module/workflow/repository/action-category.repository.ts +79 -79
- package/src/module/workflow/repository/action-data.repository.ts +334 -334
- package/src/module/workflow/repository/action.repository.ts +323 -323
- package/src/module/workflow/repository/activity-log.repository.ts +148 -148
- package/src/module/workflow/repository/comm-template.repository.ts +149 -149
- package/src/module/workflow/repository/form-master.repository.ts +59 -59
- package/src/module/workflow/repository/stage-group.repository.ts +197 -197
- package/src/module/workflow/repository/stage-movement.repository.ts +246 -246
- package/src/module/workflow/repository/stage.repository.ts +172 -172
- package/src/module/workflow/repository/task.repository.ts +134 -134
- package/src/module/workflow/repository/workflow.repository.ts +42 -42
- package/src/module/workflow/service/action-category.service.ts +33 -33
- package/src/module/workflow/service/action-data.service.ts +62 -62
- package/src/module/workflow/service/action-resources-mapping.service.ts +10 -10
- package/src/module/workflow/service/action-template-mapping.service.ts +115 -115
- package/src/module/workflow/service/action.service.ts +279 -279
- package/src/module/workflow/service/activity-log.service.ts +107 -107
- package/src/module/workflow/service/comm-template.service.ts +180 -180
- package/src/module/workflow/service/entity-modification.service.ts +61 -61
- package/src/module/workflow/service/form-master.service.ts +35 -35
- package/src/module/workflow/service/populate-workflow.service.ts +303 -303
- package/src/module/workflow/service/stage-action-mapping.service.ts +5 -5
- package/src/module/workflow/service/stage-group.service.ts +342 -342
- package/src/module/workflow/service/stage.service.ts +199 -199
- package/src/module/workflow/service/task.service.ts +558 -558
- package/src/module/workflow/service/workflow-list-master.service.ts +60 -60
- package/src/module/workflow/service/workflow-meta.service.ts +654 -654
- package/src/module/workflow/service/workflow.service.ts +205 -205
- package/src/module/workflow/workflow.module.ts +178 -178
- package/src/module/workflow-automation/SCHEDULING_GUIDE.md +145 -145
- package/src/module/workflow-automation/controller/workflow-automation.controller.ts +43 -43
- package/src/module/workflow-automation/entity/workflow-automation-action.entity.ts +26 -26
- package/src/module/workflow-automation/entity/workflow-automation.entity.ts +40 -40
- package/src/module/workflow-automation/interface/action.decorator.ts +7 -7
- package/src/module/workflow-automation/interface/action.interface.ts +5 -5
- package/src/module/workflow-automation/service/action-registery.service.ts +35 -35
- package/src/module/workflow-automation/service/schedule-handler.service.ts +168 -149
- package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +224 -214
- package/src/module/workflow-automation/service/workflow-automation.service.ts +515 -508
- package/src/module/workflow-automation/workflow-automation.module.ts +54 -47
- package/src/module/workflow-schedule/INSTALLATION.md +244 -244
- package/src/module/workflow-schedule/MULTI_PROJECT_GUIDE.md +196 -196
- package/src/module/workflow-schedule/README.md +422 -422
- package/src/module/workflow-schedule/constants/schedule.constants.ts +48 -48
- package/src/module/workflow-schedule/controller/workflow-schedule.controller.ts +255 -255
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_GUIDE.md +510 -510
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_PROMPT.md +362 -362
- package/src/module/workflow-schedule/docs/RUN_CLAUDE_CODE.sh +68 -68
- package/src/module/workflow-schedule/dto/create-schedule.dto.ts +147 -147
- package/src/module/workflow-schedule/dto/get-execution-logs.dto.ts +119 -119
- package/src/module/workflow-schedule/dto/update-schedule.dto.ts +96 -96
- package/src/module/workflow-schedule/entities/scheduled-workflow.entity.ts +148 -148
- package/src/module/workflow-schedule/entities/workflow-execution-log.entity.ts +154 -154
- package/src/module/workflow-schedule/interfaces/schedule-job-data.interface.ts +53 -53
- package/src/module/workflow-schedule/interfaces/workflow-schedule-options.interface.ts +12 -12
- package/src/module/workflow-schedule/processors/schedule.processor.ts +584 -584
- package/src/module/workflow-schedule/service/workflow-schedule.service.ts +600 -600
- package/src/module/workflow-schedule/workflow-schedule.module.ts +67 -67
- package/src/resources/dev.properties.yaml +31 -31
- package/src/resources/local.properties.yaml +27 -27
- package/src/resources/properties.module.ts +12 -12
- package/src/resources/properties.yaml.ts +11 -11
- package/src/resources/uat.properties.yaml +31 -31
- package/src/table.config.ts +130 -130
- package/src/utils/dto/excel-data.dto.ts +14 -14
- package/src/utils/dto/excelsheet-data.dto.ts +5 -5
- package/src/utils/service/base64util.service.ts +18 -18
- package/src/utils/service/clockIDGenUtil.service.ts +21 -21
- package/src/utils/service/codeGenerator.service.ts +22 -22
- package/src/utils/service/dateUtil.service.ts +17 -17
- package/src/utils/service/encryptUtil.service.ts +97 -97
- package/src/utils/service/excel-helper.service.ts +72 -72
- package/src/utils/service/excelUtil.service.ts +15 -15
- package/src/utils/service/file-util.service.ts +11 -11
- package/src/utils/service/json-util.service.ts +23 -23
- package/src/utils/service/loggingUtil.service.ts +88 -88
- package/src/utils/service/reflection-helper.service.ts +62 -62
- package/src/utils/service/wbsCodeGen.service.ts +8 -8
- package/src/utils/utils.module.ts +27 -27
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +24 -24
- package/.claude/settings.local.json +0 -26
- package/.idea/250218_nodejs_core.iml +0 -9
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/server.log +0 -850
|
@@ -12,17 +12,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.EntityJSONService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const filter_service_1 = require("../../filter/service/filter.service");
|
|
15
|
+
const linked_attribute_entity_1 = require("../../linked_attributes/entity/linked_attribute.entity");
|
|
15
16
|
const attribute_master_entity_1 = require("../../meta/entity/attribute-master.entity");
|
|
16
17
|
const entity_relation_entity_1 = require("../../meta/entity/entity-relation.entity");
|
|
17
18
|
const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
|
|
18
19
|
const loggingUtil_service_1 = require("../../../utils/service/loggingUtil.service");
|
|
19
20
|
const typeorm_1 = require("typeorm");
|
|
21
|
+
const entityJson_repository_1 = require("./entityJson.repository");
|
|
20
22
|
let EntityJSONService = class EntityJSONService extends entity_service_impl_service_1.EntityServiceImpl {
|
|
21
|
-
constructor(dataSource, filterService, loggerService) {
|
|
23
|
+
constructor(dataSource, filterService, loggerService, EntityJSONRepository) {
|
|
22
24
|
super();
|
|
23
25
|
this.dataSource = dataSource;
|
|
24
26
|
this.filterService = filterService;
|
|
25
27
|
this.loggerService = loggerService;
|
|
28
|
+
this.EntityJSONRepository = EntityJSONRepository;
|
|
26
29
|
}
|
|
27
30
|
async getAttributeForFlatJSON(entityType, loggedInUser, flag) {
|
|
28
31
|
const orgId = loggedInUser.organization_id;
|
|
@@ -30,7 +33,7 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
30
33
|
const mainAttributes = await this.dataSource
|
|
31
34
|
.getRepository(attribute_master_entity_1.AttributeMaster)
|
|
32
35
|
.createQueryBuilder('attr')
|
|
33
|
-
.select(['attr.id', 'attr.name', 'attr.attribute_key'])
|
|
36
|
+
.select(['attr.id', 'attr.name', 'attr.flat_json_key', 'attr.attribute_key'])
|
|
34
37
|
.where('attr.mapped_entity_type = :entityType', { entityType })
|
|
35
38
|
.andWhere('attr.organization_id = :orgId', { orgId })
|
|
36
39
|
.getMany();
|
|
@@ -49,53 +52,69 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
49
52
|
? await this.dataSource
|
|
50
53
|
.getRepository(attribute_master_entity_1.AttributeMaster)
|
|
51
54
|
.createQueryBuilder('attr')
|
|
52
|
-
.select(['attr.id', 'attr.name', 'attr.
|
|
55
|
+
.select(['attr.id', 'attr.name', 'attr.flat_json_key', 'attr.mapped_entity_type', 'attr.attribute_key'])
|
|
53
56
|
.where('attr.mapped_entity_type IN (:...types)', { types: relatedTypesList })
|
|
54
57
|
.andWhere('attr.organization_id = :orgId', { orgId })
|
|
55
58
|
.getMany()
|
|
56
59
|
: [];
|
|
57
60
|
await this.loggerService.log('debug', 'EntityJSONService', 'getAttributeForFlatJSON', `Loaded ${relatedAttributes.length} related attributes`);
|
|
58
61
|
const linkedAttributes = await this.dataSource
|
|
59
|
-
.getRepository(
|
|
62
|
+
.getRepository(linked_attribute_entity_1.LinkedAttributes)
|
|
60
63
|
.createQueryBuilder('fla')
|
|
61
64
|
.innerJoin(attribute_master_entity_1.AttributeMaster, 'attr', 'fla.applicable_entity_type = attr.mapped_entity_type AND fla.applicable_attribute_key = attr.attribute_key')
|
|
62
65
|
.select([
|
|
63
|
-
'fla.applicable_entity_type',
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
66
|
+
'fla.applicable_entity_type AS applicable_entity_type',
|
|
67
|
+
'fla.applicable_attribute_key AS applicable_attribute_key',
|
|
68
|
+
'fla.attribute_key AS target_attribute_key',
|
|
69
|
+
'fla.saved_filter_code AS saved_filter_code',
|
|
70
|
+
'attr.name AS name',
|
|
71
|
+
'attr.id AS id',
|
|
67
72
|
])
|
|
68
73
|
.where('attr.organization_id = :orgId', { orgId })
|
|
69
74
|
.getRawMany();
|
|
70
75
|
await this.loggerService.log('debug', 'EntityJSONService', 'getAttributeForFlatJSON', `Loaded ${linkedAttributes.length} linked attributes`);
|
|
71
|
-
if (flag === 'flat_json') {
|
|
76
|
+
if (flag === 'flat_json' || flag === 'all') {
|
|
72
77
|
const result = {};
|
|
73
|
-
mainAttributes.forEach(attr => { if (attr.
|
|
74
|
-
result[attr.
|
|
75
|
-
relatedAttributes.forEach(attr => { if (attr.
|
|
76
|
-
result[attr.
|
|
77
|
-
linkedAttributes.forEach(link => { if (link.
|
|
78
|
-
result[link.
|
|
78
|
+
mainAttributes.forEach(attr => { if (attr.flat_json_key)
|
|
79
|
+
result[attr.flat_json_key] = null; });
|
|
80
|
+
relatedAttributes.forEach(attr => { if (attr.flat_json_key)
|
|
81
|
+
result[attr.flat_json_key] = null; });
|
|
82
|
+
linkedAttributes.forEach(link => { if (link.target_attribute_key)
|
|
83
|
+
result[link.target_attribute_key] = null; });
|
|
84
|
+
if (flag === 'all') {
|
|
85
|
+
return { flat_json: result, attributes: { mainAttributes, relatedAttributes, linkedAttributes } };
|
|
86
|
+
}
|
|
79
87
|
return result;
|
|
80
88
|
}
|
|
81
89
|
const dropdown = [];
|
|
82
|
-
dropdown.push(...mainAttributes.map(a => ({ label: a.name, value: a.
|
|
83
|
-
dropdown.push(...relatedAttributes.map(a => ({ label: a.name, value: a.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
90
|
+
dropdown.push(...mainAttributes.map(a => ({ label: a.name, value: a.flat_json_key })));
|
|
91
|
+
dropdown.push(...relatedAttributes.map(a => ({ label: a.name, value: a.flat_json_key })));
|
|
92
|
+
if (linkedAttributes.length > 0) {
|
|
93
|
+
dropdown.push(...linkedAttributes.map(a => ({ label: a.name, value: a.attribute_key })));
|
|
94
|
+
}
|
|
87
95
|
return dropdown;
|
|
88
96
|
}
|
|
89
97
|
async updateEntityJSON(entityType, entityId, loggedInUser) {
|
|
90
98
|
await this.loggerService.log('info', 'EntityJSONService', 'updateEntityJSON', `Building flat JSON for entity: ${entityType}#${entityId}`);
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
await this.loggerService.log('error', 'EntityJSONService', 'updateEntityJSON', `
|
|
94
|
-
|
|
99
|
+
const response = await this.getAttributeForFlatJSON(entityType, loggedInUser, 'all');
|
|
100
|
+
if (!response || !('flat_json' in response) || !('attributes' in response) || !response.attributes) {
|
|
101
|
+
await this.loggerService.log('error', 'EntityJSONService', 'updateEntityJSON', `getAttributeForFlatJSON() did not return expected structure`);
|
|
102
|
+
return null;
|
|
95
103
|
}
|
|
104
|
+
const { flat_json: flatJson, attributes } = response;
|
|
105
|
+
if (!flatJson)
|
|
106
|
+
return null;
|
|
107
|
+
const safeAttributes = {
|
|
108
|
+
mainAttributes: attributes.mainAttributes || [],
|
|
109
|
+
relatedAttributes: attributes.relatedAttributes || [],
|
|
110
|
+
linkedAttributes: attributes.linkedAttributes || [],
|
|
111
|
+
};
|
|
112
|
+
const attrMap = {};
|
|
113
|
+
const allAttrs = [...safeAttributes.mainAttributes, ...safeAttributes.relatedAttributes];
|
|
114
|
+
allAttrs.forEach(attr => { if (attr.attribute_key)
|
|
115
|
+
attrMap[attr.attribute_key] = attr.flat_json_key || attr.attribute_key; });
|
|
96
116
|
const mainData = await this.getResolvedEntityData(entityType, entityId, loggedInUser);
|
|
97
|
-
this.
|
|
98
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', 'Merged main entity data into flat JSON');
|
|
117
|
+
this.mergeEntityDataIntoFlatJson(flatJson, mainData, attrMap);
|
|
99
118
|
const relations = await this.dataSource
|
|
100
119
|
.getRepository('frm_entity_relation_data')
|
|
101
120
|
.createQueryBuilder('erd')
|
|
@@ -104,38 +123,46 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
104
123
|
.andWhere('erd.source_entity_id = :entityId', { entityId })
|
|
105
124
|
.andWhere('erd.relation_type = :rt', { rt: 'ONE_TO_ONE' })
|
|
106
125
|
.getRawMany();
|
|
107
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Found ${relations.length} ONE-TO-ONE relations`);
|
|
108
126
|
for (const rel of relations) {
|
|
109
|
-
const
|
|
110
|
-
this.
|
|
111
|
-
await this.loggerService.log('debug', 'EntityJSONService', 'updateEntityJSON', `Merged related entity ${rel.target_entity_type}#${rel.target_entity_id}`);
|
|
127
|
+
const relatedData = await this.getResolvedEntityData(rel.target_entity_type, rel.target_entity_id, loggedInUser);
|
|
128
|
+
this.mergeEntityDataIntoFlatJson(flatJson, relatedData, attrMap);
|
|
112
129
|
}
|
|
113
|
-
const
|
|
114
|
-
.
|
|
115
|
-
.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
for (const linkAttr of safeAttributes.linkedAttributes) {
|
|
131
|
+
const childEntityType = linkAttr.applicable_entity_type;
|
|
132
|
+
const sourceKey = linkAttr.applicable_attribute_key;
|
|
133
|
+
const targetKey = linkAttr.target_attribute_key;
|
|
134
|
+
if (!childEntityType || !sourceKey || !targetKey)
|
|
135
|
+
continue;
|
|
136
|
+
const mappingValue = mainData?.[sourceKey] ?? null;
|
|
137
|
+
const value = await this.applyLinkedFilterUsingSavedFilter(childEntityType, linkAttr.saved_filter_code, sourceKey, mappingValue, targetKey, loggedInUser, entityId);
|
|
138
|
+
if (value !== null && value !== undefined) {
|
|
139
|
+
flatJson[targetKey] = value;
|
|
140
|
+
}
|
|
124
141
|
}
|
|
125
|
-
await this.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
142
|
+
await this.loggerService.log('info', 'EntityJSONService', 'updateEntityJSON', `Saving flat JSON for entity: ${entityType}#${entityId}`);
|
|
143
|
+
let JsonData = {
|
|
144
|
+
entity_type: entityType,
|
|
145
|
+
entity_id: entityId,
|
|
146
|
+
json_data: flatJson,
|
|
147
|
+
created_by: loggedInUser.id,
|
|
148
|
+
};
|
|
149
|
+
await this.EntityJSONRepository.create(JsonData);
|
|
129
150
|
return flatJson;
|
|
130
151
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
mergeEntityDataIntoFlatJson(flatJson, entityData, attrMap) {
|
|
153
|
+
const records = Array.isArray(entityData) ? entityData : [entityData];
|
|
154
|
+
for (const record of records) {
|
|
155
|
+
if (!record || typeof record !== 'object')
|
|
156
|
+
continue;
|
|
157
|
+
for (const key of Object.keys(record)) {
|
|
158
|
+
const flatKey = attrMap[key] || key;
|
|
159
|
+
if (flatJson.hasOwnProperty(flatKey)) {
|
|
160
|
+
flatJson[flatKey] = record[key];
|
|
161
|
+
}
|
|
135
162
|
}
|
|
136
163
|
}
|
|
137
164
|
}
|
|
138
|
-
async applyLinkedFilterUsingSavedFilter(childEntityType, savedFilterCode, childFilterAttribute, mappingValue, targetAttribute, loggedInUser) {
|
|
165
|
+
async applyLinkedFilterUsingSavedFilter(childEntityType, savedFilterCode, childFilterAttribute, mappingValue, targetAttribute, loggedInUser, entity_id) {
|
|
139
166
|
if (!savedFilterCode && (mappingValue === null || mappingValue === undefined))
|
|
140
167
|
return null;
|
|
141
168
|
const dto = {
|
|
@@ -147,16 +174,15 @@ let EntityJSONService = class EntityJSONService extends entity_service_impl_serv
|
|
|
147
174
|
};
|
|
148
175
|
if (mappingValue !== null && mappingValue !== undefined && mappingValue !== '') {
|
|
149
176
|
dto.quickFilter = [
|
|
150
|
-
{
|
|
151
|
-
filter_attribute: childFilterAttribute,
|
|
152
|
-
filter_operator: 'equal',
|
|
153
|
-
filter_value: mappingValue,
|
|
154
|
-
}
|
|
177
|
+
{ filter_attribute: childFilterAttribute, filter_operator: 'equal', filter_value: mappingValue },
|
|
155
178
|
];
|
|
156
179
|
}
|
|
180
|
+
dto.quickFilter = [
|
|
181
|
+
{ filter_attribute: 'parent_id', filter_operator: 'equal', filter_value: [entity_id] },
|
|
182
|
+
];
|
|
157
183
|
const result = await this.filterService.applyFilter(dto);
|
|
158
184
|
const rows = result?.data?.entity_list || [];
|
|
159
|
-
return rows.length ? rows[0][
|
|
185
|
+
return rows.length ? (rows[0][childFilterAttribute] ?? null) : null;
|
|
160
186
|
}
|
|
161
187
|
};
|
|
162
188
|
exports.EntityJSONService = EntityJSONService;
|
|
@@ -164,6 +190,7 @@ exports.EntityJSONService = EntityJSONService = __decorate([
|
|
|
164
190
|
(0, common_1.Injectable)(),
|
|
165
191
|
__metadata("design:paramtypes", [typeorm_1.DataSource,
|
|
166
192
|
filter_service_1.FilterService,
|
|
167
|
-
loggingUtil_service_1.LoggingService
|
|
193
|
+
loggingUtil_service_1.LoggingService,
|
|
194
|
+
entityJson_repository_1.EntityJSONRepository])
|
|
168
195
|
], EntityJSONService);
|
|
169
196
|
//# sourceMappingURL=entity_json.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_json.service.js","sourceRoot":"","sources":["../../../../src/module/entity_json/service/entity_json.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wEAAyE;AACzE,uFAAiF;AACjF,qFAA+E;AAC/E,gGAAwF;AACxF,oFAAuE;AACvE,qCAAqC;
|
|
1
|
+
{"version":3,"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AAK,IAAI,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,EAAE,EAAE,CAAC;YAC/E,GAAG,CAAC,WAAW,GAAG;gBAChB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE;aACjG,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,WAAW,GAAG;YAChB,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE;SACvF,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtE,CAAC;CACF,CAAA;AA9NY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAGoB,oBAAU;QACP,8BAAa;QACb,oCAAc;QACR,4CAAoB;GALjD,iBAAiB,CA8N7B"}
|
|
@@ -117,10 +117,10 @@ let SavedFilterRepositoryService = class SavedFilterRepositoryService {
|
|
|
117
117
|
}));
|
|
118
118
|
}
|
|
119
119
|
async getSavedFilterByCode(code, loggedInUser) {
|
|
120
|
-
const [filterMaster] = await this.dataSource.query(`SELECT id, name, code
|
|
121
|
-
FROM frm_saved_filter_master
|
|
122
|
-
WHERE code = $1 AND organization_id = $2
|
|
123
|
-
LIMIT 1
|
|
120
|
+
const [filterMaster] = await this.dataSource.query(`SELECT id, name, code
|
|
121
|
+
FROM frm_saved_filter_master
|
|
122
|
+
WHERE code = $1 AND organization_id = $2
|
|
123
|
+
LIMIT 1
|
|
124
124
|
`, [code, loggedInUser.organization_id]);
|
|
125
125
|
if (!filterMaster) {
|
|
126
126
|
return null;
|
|
@@ -20,8 +20,8 @@ let FilterEvaluatorService = class FilterEvaluatorService {
|
|
|
20
20
|
}
|
|
21
21
|
async evaluateTriggerAttributes(oldEntity, newEntity, savedFilterCode) {
|
|
22
22
|
console.log('IN FILTER EVALUATOR SERVICE');
|
|
23
|
-
const triggerFilters = await this.dataSource.query(`SELECT *
|
|
24
|
-
FROM frm_saved_filter_detail
|
|
23
|
+
const triggerFilters = await this.dataSource.query(`SELECT *
|
|
24
|
+
FROM frm_saved_filter_detail
|
|
25
25
|
WHERE mapped_filter_code = $1`, [savedFilterCode]);
|
|
26
26
|
if (!triggerFilters || triggerFilters.length === 0) {
|
|
27
27
|
return true;
|
|
@@ -63,11 +63,11 @@ let FilterService = class FilterService {
|
|
|
63
63
|
});
|
|
64
64
|
whereSQL = `WHERE ${clauseParts.join(' AND ')}`;
|
|
65
65
|
}
|
|
66
|
-
const rawSQL = `
|
|
67
|
-
SELECT ${column} AS tab_value, COUNT(*) AS tab_value_count
|
|
68
|
-
FROM ${tableName}
|
|
69
|
-
${whereSQL}
|
|
70
|
-
GROUP BY ${column}
|
|
66
|
+
const rawSQL = `
|
|
67
|
+
SELECT ${column} AS tab_value, COUNT(*) AS tab_value_count
|
|
68
|
+
FROM ${tableName}
|
|
69
|
+
${whereSQL}
|
|
70
|
+
GROUP BY ${column}
|
|
71
71
|
`;
|
|
72
72
|
const rows = await this.queryWithSchema(rawSQL, values);
|
|
73
73
|
const total = rows.reduce((sum, r) => sum + parseInt(r.tab_value_count, 10), 0);
|
|
@@ -182,21 +182,21 @@ let FilterService = class FilterService {
|
|
|
182
182
|
}
|
|
183
183
|
else if (level_type === 'SCH') {
|
|
184
184
|
baseWhere.push({
|
|
185
|
-
query: `
|
|
186
|
-
(
|
|
187
|
-
(e.level_type = 'SCH' AND e.level_id = '${loggedInUser.level_id}' AND e.organization_id = '${loggedInUser.organization_id}')
|
|
188
|
-
OR
|
|
189
|
-
(
|
|
190
|
-
e.level_type = 'ORG'
|
|
191
|
-
AND e.level_id = '${loggedInUser.organization_id}'
|
|
192
|
-
AND e.organization_id = '${loggedInUser.organization_id}'
|
|
193
|
-
AND e.code NOT IN (
|
|
194
|
-
SELECT sub.code
|
|
195
|
-
FROM frm_wf_comm_template AS sub
|
|
196
|
-
WHERE sub.level_type = 'SCH' AND sub.level_id = '${loggedInUser.level_id}'
|
|
197
|
-
)
|
|
198
|
-
)
|
|
199
|
-
)
|
|
185
|
+
query: `
|
|
186
|
+
(
|
|
187
|
+
(e.level_type = 'SCH' AND e.level_id = '${loggedInUser.level_id}' AND e.organization_id = '${loggedInUser.organization_id}')
|
|
188
|
+
OR
|
|
189
|
+
(
|
|
190
|
+
e.level_type = 'ORG'
|
|
191
|
+
AND e.level_id = '${loggedInUser.organization_id}'
|
|
192
|
+
AND e.organization_id = '${loggedInUser.organization_id}'
|
|
193
|
+
AND e.code NOT IN (
|
|
194
|
+
SELECT sub.code
|
|
195
|
+
FROM frm_wf_comm_template AS sub
|
|
196
|
+
WHERE sub.level_type = 'SCH' AND sub.level_id = '${loggedInUser.level_id}'
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
200
|
`,
|
|
201
201
|
params: {},
|
|
202
202
|
});
|
|
@@ -254,8 +254,8 @@ let FilterService = class FilterService {
|
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
console.log('🟠 [FilterService] Constructed baseWhere clauses:', baseWhere);
|
|
257
|
-
const layoutPreference = await this.dataSource.query(`SELECT mapped_json
|
|
258
|
-
FROM frm_entity_layout_pref
|
|
257
|
+
const layoutPreference = await this.dataSource.query(`SELECT mapped_json
|
|
258
|
+
FROM frm_entity_layout_pref
|
|
259
259
|
WHERE user_id = $1 AND mapped_entity_type = $2 AND mapped_level_id = $3 AND mapped_level_type = $4 AND type = 'layout'`, [user_id, entity_type, level_id, level_type]);
|
|
260
260
|
const layout = layoutPreference?.[0]?.mapped_json?.quick_tab || {};
|
|
261
261
|
const showList = layout?.show_list?.map((val) => {
|
|
@@ -586,13 +586,86 @@ let FilterService = class FilterService {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
buildDateCondition(attr, op, val, key) {
|
|
589
|
+
const dateColumn = `DATE(e.${attr})`;
|
|
590
|
+
const monthColumn = `DATE_FORMAT(e.${attr}, '%Y-%m-01')`;
|
|
591
|
+
const numVal = Number(val);
|
|
589
592
|
switch (op) {
|
|
590
593
|
case 'equal':
|
|
591
|
-
|
|
594
|
+
case 'is':
|
|
595
|
+
return {
|
|
596
|
+
query: `${dateColumn} = :${key}`,
|
|
597
|
+
params: { [key]: val },
|
|
598
|
+
};
|
|
592
599
|
case 'before':
|
|
593
|
-
|
|
600
|
+
case 'is_before':
|
|
601
|
+
return {
|
|
602
|
+
query: `${dateColumn} < :${key}`,
|
|
603
|
+
params: { [key]: val },
|
|
604
|
+
};
|
|
594
605
|
case 'after':
|
|
595
|
-
|
|
606
|
+
case 'is_after':
|
|
607
|
+
return {
|
|
608
|
+
query: `${dateColumn} > :${key}`,
|
|
609
|
+
params: { [key]: val },
|
|
610
|
+
};
|
|
611
|
+
case 'is_on_or_before':
|
|
612
|
+
return {
|
|
613
|
+
query: `${dateColumn} <= :${key}`,
|
|
614
|
+
params: { [key]: val },
|
|
615
|
+
};
|
|
616
|
+
case 'is_on_or_after':
|
|
617
|
+
return {
|
|
618
|
+
query: `${dateColumn} >= :${key}`,
|
|
619
|
+
params: { [key]: val },
|
|
620
|
+
};
|
|
621
|
+
case 'is_month_before':
|
|
622
|
+
if (!isNaN(numVal)) {
|
|
623
|
+
const target = moment()
|
|
624
|
+
.subtract(numVal, 'months')
|
|
625
|
+
.startOf('month')
|
|
626
|
+
.format('YYYY-MM-DD');
|
|
627
|
+
return {
|
|
628
|
+
query: `${monthColumn} < DATE_FORMAT(:${key}, '%Y-%m-01')`,
|
|
629
|
+
params: { [key]: target },
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
query: `${monthColumn} < DATE_FORMAT(:${key}, '%Y-%m-01')`,
|
|
634
|
+
params: { [key]: val },
|
|
635
|
+
};
|
|
636
|
+
case 'is_month_after':
|
|
637
|
+
if (!isNaN(numVal)) {
|
|
638
|
+
const target = moment()
|
|
639
|
+
.add(numVal, 'months')
|
|
640
|
+
.startOf('month')
|
|
641
|
+
.format('YYYY-MM-DD');
|
|
642
|
+
return {
|
|
643
|
+
query: `${monthColumn} > DATE_FORMAT(:${key}, '%Y-%m-01')`,
|
|
644
|
+
params: { [key]: target },
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
return {
|
|
648
|
+
query: `${monthColumn} > DATE_FORMAT(:${key}, '%Y-%m-01')`,
|
|
649
|
+
params: { [key]: val },
|
|
650
|
+
};
|
|
651
|
+
case 'is_day_before':
|
|
652
|
+
if (isNaN(numVal))
|
|
653
|
+
throw new common_1.BadRequestException('Value must be a number for is_day_before');
|
|
654
|
+
const beforeDate = moment()
|
|
655
|
+
.subtract(numVal, 'days')
|
|
656
|
+
.format('YYYY-MM-DD');
|
|
657
|
+
return {
|
|
658
|
+
query: `${dateColumn} < :${key}`,
|
|
659
|
+
params: { [key]: beforeDate },
|
|
660
|
+
};
|
|
661
|
+
case 'is_day_after':
|
|
662
|
+
if (isNaN(numVal))
|
|
663
|
+
throw new common_1.BadRequestException('Value must be a number for is_day_after');
|
|
664
|
+
const afterDate = moment().add(numVal, 'days').format('YYYY-MM-DD');
|
|
665
|
+
return {
|
|
666
|
+
query: `${dateColumn} > :${key}`,
|
|
667
|
+
params: { [key]: afterDate },
|
|
668
|
+
};
|
|
596
669
|
case 'between': {
|
|
597
670
|
if (typeof val === 'string') {
|
|
598
671
|
val = val.split(',').map((v) => v.trim());
|
|
@@ -601,11 +674,11 @@ let FilterService = class FilterService {
|
|
|
601
674
|
val.length !== 2 ||
|
|
602
675
|
val[0] === '' ||
|
|
603
676
|
val[1] === '') {
|
|
604
|
-
console.log(`Invalid value for
|
|
677
|
+
console.log(`Invalid value for between: ${val}`);
|
|
605
678
|
return null;
|
|
606
679
|
}
|
|
607
680
|
return {
|
|
608
|
-
query:
|
|
681
|
+
query: `${dateColumn} BETWEEN :${key}_start AND :${key}_end`,
|
|
609
682
|
params: {
|
|
610
683
|
[`${key}_start`]: val[0],
|
|
611
684
|
[`${key}_end`]: val[1],
|
|
@@ -613,26 +686,23 @@ let FilterService = class FilterService {
|
|
|
613
686
|
};
|
|
614
687
|
}
|
|
615
688
|
case 'today': {
|
|
616
|
-
const today =
|
|
689
|
+
const today = moment().format('YYYY-MM-DD');
|
|
617
690
|
return {
|
|
618
|
-
query:
|
|
619
|
-
params: {
|
|
620
|
-
today,
|
|
621
|
-
},
|
|
691
|
+
query: `${dateColumn} = :today`,
|
|
692
|
+
params: { today },
|
|
622
693
|
};
|
|
623
694
|
}
|
|
624
|
-
case 'empty':
|
|
695
|
+
case 'empty':
|
|
696
|
+
case 'is_empty':
|
|
625
697
|
return {
|
|
626
698
|
query: `e.${attr} IS NULL`,
|
|
627
699
|
params: {},
|
|
628
700
|
};
|
|
629
|
-
|
|
630
|
-
case 'not_empty': {
|
|
701
|
+
case 'not_empty':
|
|
631
702
|
return {
|
|
632
703
|
query: `e.${attr} IS NOT NULL`,
|
|
633
704
|
params: {},
|
|
634
705
|
};
|
|
635
|
-
}
|
|
636
706
|
default:
|
|
637
707
|
throw new common_1.BadRequestException(`Unsupported operator for date: ${op}`);
|
|
638
708
|
}
|