@simitgroup/simpleapp-generator 1.6.7-o-alpha → 2.0.0-a-alpha
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/ReleaseNote.md +4 -0
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +2 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.js +1 -1
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.js +1 -1
- package/dist/buildinschemas/documentnoformat.d.ts +3 -0
- package/dist/buildinschemas/documentnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/documentnoformat.js +58 -0
- package/dist/buildinschemas/documentnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +0 -5
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -11
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -19
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -2
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +118 -23
- package/dist/generate.js.map +1 -1
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/{autoincreament.ts → autoincreament.ts.backup} +1 -1
- package/src/buildinschemas/branch.ts +2 -0
- package/src/buildinschemas/{documentevent.ts → documentevent.ts.backup} +1 -1
- package/src/buildinschemas/{docnoformat.ts → documentnoformat.ts.backup} +3 -3
- package/src/buildinschemas/index.ts +4 -5
- package/src/buildinschemas/organization.ts +3 -19
- package/src/buildinschemas/user.ts +5 -2
- package/src/generate.ts +128 -28
- package/src/type.ts +6 -1
- package/templates/basic/nest/api.controller.ts.eta +153 -0
- package/templates/basic/nest/api.module.ts.eta +32 -0
- package/templates/basic/nest/api.resolver.ts.eta +94 -0
- package/templates/basic/nest/api.schema.ts.eta +20 -0
- package/templates/basic/nest/api.service.ts.eta +85 -0
- package/templates/basic/nest/controller.ts.eta +18 -119
- package/templates/basic/nest/default.ts.eta +16 -10
- package/templates/basic/nest/enum.ts.eta +16 -0
- package/templates/basic/nest/model.ts.eta +6 -28
- package/templates/basic/nest/module.ts.eta +25 -0
- package/templates/basic/nest/resolver.ts.eta +12 -56
- package/templates/basic/nest/schema.ts.eta +133 -0
- package/templates/basic/nest/service.ts.eta +82 -73
- package/templates/basic/nest/service.ts.eta-backup +50 -0
- package/templates/basic/nuxt/default.ts.eta +10 -8
- package/templates/basic/nuxt/pages.[id].vue.eta +2 -2
- package/templates/basic/nuxt/pages.form.vue.eta +2 -2
- package/templates/basic/nuxt/pages.viewer.vue.eta +2 -2
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +1 -1
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +7 -5
- package/templates/nest/src/app.module.ts._eta +53 -69
- package/templates/nest/src/main.ts._eta +1 -1
- package/templates/nest/src/simple-app/.core/features/auth/api-key/api-key.service.ts.eta +29 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/api-key.type.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/interface.ts.eta +7 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/mini-api-key.validator.ts.eta +30 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/static-api-key.validator.ts.eta +27 -0
- package/templates/nest/src/simple-app/.core/features/auth/auth.module.ts.eta +9 -0
- package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.enum.ts.eta +7 -7
- package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.guard.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.model.ts.eta +10 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.module.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.schema.ts.eta +119 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.service.ts.eta +65 -0
- package/templates/nest/src/simple-app/.core/features/cron/base/cron.base.ts.eta +13 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/cron-system.module.ts.eta +17 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/cron-system.service.ts.eta +37 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron.module.ts.eta +10 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.controller.ts.eta +31 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.model.ts.eta +15 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +162 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +189 -0
- package/templates/nest/src/simple-app/.core/features/event/event.module.ts.eta +9 -0
- package/templates/nest/src/simple-app/.core/features/event/event.type.ts.eta +23 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-create.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-delete.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-set-status.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-update.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-create.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-delete.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-set-status.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-update.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/index.ts.eta +8 -0
- package/templates/nest/src/simple-app/.core/features/foreign-key/foreign-key.module.ts.eta +16 -0
- package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +20 -0
- package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +68 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/api-event.schema.ts.eta +57 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +87 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.controller.ts.eta +84 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.module.ts.eta +19 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.service.ts.eta +86 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/schemas/environment.ts.eta +23 -0
- package/templates/nest/src/{simpleapp/maintenance/apischemas → simple-app/.core/features/maintenance/schemas}/index.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-bridge.service.ts.eta.eta +31 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-env-development.service.ts.eta +124 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-env-production.service.ts.eta +50 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.controller.ts.eta +41 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.schema.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.service.ts.eta +94 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/dto/developer-portal-create-app.dto.ts.eta +22 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/dto/developer-portal-publish-app.dto.ts.eta +0 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/imports.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/mini-app.ts.eta +55 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-bridge.service.ts.eta +162 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-env-development.service.ts.eta +140 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-env-production.service.ts.eta +125 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +43 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.controller.ts.eta +81 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.enum.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.error.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.processor.ts.eta +309 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +346 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.decorator.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.guard.ts.eta +43 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.service.ts.eta +101 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/types/miniApp.ts.eta +23 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/utils/mini-app.util.ts.eta +26 -0
- package/templates/nest/src/simple-app/.core/features/policy/policy.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +45 -0
- package/templates/nest/src/{simpleapp/profile/profile.controller.ts._eta → simple-app/.core/features/profile/profile.controller.ts.eta} +37 -83
- package/templates/nest/src/simple-app/.core/features/profile/profile.module.ts.eta +22 -0
- package/templates/nest/src/simple-app/.core/features/profile/profile.schema.ts.eta +165 -0
- package/templates/nest/src/{simpleapp/profile/profile.service.ts._eta → simple-app/.core/features/profile/profile.service.ts.eta} +36 -48
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +196 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.producer.ts.eta +147 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue-user-context/queue-user-context.service.ts.eta +35 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue.type.ts.eta +75 -0
- package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +51 -0
- package/templates/nest/src/{simpleapp/generate/commons/robotuser.service.ts.eta → simple-app/.core/features/user-context/robot-user.service.ts.eta} +27 -16
- package/templates/nest/src/simple-app/.core/features/user-context/user-context.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/user-context/user-context.type.ts.eta +15 -0
- package/templates/nest/src/{simpleapp/generate/commons → simple-app/.core/features/user-context}/user.context.ts.eta +469 -449
- package/templates/nest/src/{simpleapp/generate/commons/runwebhook.service.ts.eta → simple-app/.core/features/webhook/run-webhook.service.ts.eta} +7 -11
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook-log.schema.ts.eta +116 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +177 -0
- package/templates/nest/src/simple-app/.core/features/webhook/webhook.module.ts.eta +20 -0
- package/templates/nest/src/{simpleapp/generate/controllers/simpleapp.controller.ts.eta → simple-app/.core/framework/base/simple-app.controller.ts.eta} +13 -35
- package/templates/nest/src/{simpleapp/generate/processors/simpleapp.processor.ts.eta → simple-app/.core/framework/base/simple-app.service.ts.eta} +239 -139
- package/templates/nest/src/simple-app/.core/framework/custom-exception.ts.eta +26 -0
- package/templates/nest/src/simple-app/.core/framework/framework.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/index.ts.eta +3 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/others.schema.ts.eta +153 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/simple-app.schema.ts.eta +172 -0
- package/templates/nest/src/{simpleapp/generate/commons/interceptors/response.interceptor.ts.eta → simple-app/.core/framework/simple-app.interceptor.ts.eta} +12 -22
- package/templates/nest/src/{simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta → simple-app/.core/framework/simple-app.middleware.ts.eta} +28 -26
- package/templates/nest/src/simple-app/.core/readme.md.eta +3 -0
- package/templates/nest/src/simple-app/.core/resources/core-resources.module.ts.eta +38 -0
- package/templates/nest/src/simple-app/.core/simple-app-core.module.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/utils/dayjs.ts.eta +47 -0
- package/templates/nest/src/simple-app/.core/utils/locale-tool.ts.eta +11 -0
- package/templates/nest/src/simple-app/.core/utils/string-utils.ts.eta +1 -0
- package/templates/nest/src/simple-app/.resources/readme.md.eta +3 -0
- package/templates/nest/src/simple-app/.resources/resources.module.ts.eta +36 -0
- package/templates/nest/src/simple-app/apis/readme.md.eta +9 -0
- package/templates/nest/src/simple-app/apis/resource-api.module.ts.eta +37 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.module.ts._eta +20 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.service.ts._eta +43 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.type.ts._eta +7 -0
- package/templates/nest/src/simple-app/events/events.module.ts._eta +17 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.module.ts._eta +13 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.service.ts._eta +52 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.type.ts._eta +1 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.module.ts.eta +11 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.service.ts.eta +33 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.type.ts.eta +1 -0
- package/templates/nest/src/simple-app/events/readme.md.eta +76 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.module.ts_eta +12 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.service.ts_eta +30 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.type.ts_eta +1 -0
- package/templates/nest/src/{simpleapp/additional.module.ts._eta → simple-app/features/features.module.ts._eta} +8 -7
- package/templates/nest/src/{printapi/printapi.module.ts.eta → simple-app/features/print/print.module.ts.eta} +4 -4
- package/templates/nest/src/{printapi/printapi.service.ts.eta → simple-app/features/print/print.service.ts.eta} +7 -7
- package/templates/nest/src/simple-app/features/readme.md._eta +6 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +32 -0
- package/templates/nuxt/.env._eta +2 -0
- package/templates/nuxt/app.vue.eta +15 -7
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +2 -1
- package/templates/nuxt/components/image/ImageAvatar.vue._eta +63 -0
- package/templates/nuxt/components/image/ImageOrganization.vue._eta +77 -0
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +95 -20
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +20 -21
- package/templates/nuxt/components/user/UserTenantPicker.vue._eta +1 -1
- package/templates/nuxt/composables/docformat.generate.ts.eta +4 -2
- package/templates/nuxt/enums/enums.generate.ts.eta +1 -1
- package/templates/nuxt/middleware/30.acl.global.ts.eta +6 -6
- package/templates/nuxt/nuxt.config.ts._eta +1 -0
- package/templates/nuxt/pages/login.vue._eta +21 -15
- package/templates/nuxt/pages/profile.vue._eta +24 -32
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +31 -24
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +2 -2
- package/templates/nuxt/providers/my-provider.ts.eta +5 -6
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -0
- package/templates/nuxt/simpleapp/generate/defaults/index.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/types/index.ts.eta +1 -1
- package/templates/nuxt/types/schema.ts.eta +1 -0
- package/templates/nuxt/types/user.ts.eta +39 -38
- package/templates/project/build.sh.eta +2 -2
- package/templates/basic/nest/apischema.ts.eta +0 -96
- package/templates/basic/nest/processor.ts.eta +0 -86
- package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +0 -15
- package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +0 -15
- package/templates/nest/src/enums/enums.generate.ts.eta +0 -23
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +0 -85
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +0 -15
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +0 -62
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +0 -52
- package/templates/nest/src/simpleapp/generate/commons/customkeycloa.guard.ts.eta +0 -45
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +0 -129
- package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +0 -87
- package/templates/nest/src/simpleapp/generate/jsonschemas/index.ts.eta +0 -11
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +0 -27
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +0 -88
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +0 -110
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +0 -77
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +0 -110
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +0 -71
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +0 -49
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +0 -52
- package/templates/nest/src/simpleapp/generate/processors/webhooklog.processor.ts.eta +0 -45
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -7
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +0 -193
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +0 -299
- package/templates/nest/src/simpleapp/generate/types/workflow.type.ts.eta +0 -15
- package/templates/nest/src/simpleapp/generate/workflow/formschema/SimpleApproveReject.ts.eta +0 -8
- package/templates/nest/src/simpleapp/generate/workflow/formschema/index.ts.eta +0 -7
- package/templates/nest/src/simpleapp/generate/workflow/workflow.apischema.ts.eta +0 -136
- package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +0 -79
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +0 -414
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +0 -201
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +0 -641
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +0 -98
- package/templates/nest/src/simpleapp/generate/workflow/workflow.userservice.ts.eta +0 -83
- package/templates/nest/src/simpleapp/maintenance/apischemas/environment.ts.eta +0 -11
- package/templates/nest/src/simpleapp/maintenance/maintenance.controller.ts.eta +0 -72
- package/templates/nest/src/simpleapp/maintenance/maintenance.service.ts.eta +0 -88
- package/templates/nest/src/simpleapp/maintenance/models/environment.model.ts.eta +0 -16
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts._eta +0 -95
- package/templates/nest/src/simpleapp/resolvers/readme.md.eta +0 -1
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.etaxx +0 -59
- package/templates/nest/src/simpleapp/services/branch.service.ts.etaxxx +0 -83
- package/templates/nest/src/simpleapp/services/docno.service.ts.etaxxx +0 -59
- package/templates/nest/src/simpleapp/services/org.service.ts.etaxxx +0 -37
- package/templates/nest/src/simpleapp/services/perm.service.ts.etaxxx +0 -56
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +0 -43
- package/templates/nest/src/simpleapp/services/tenant.service.ts.etaxxx +0 -38
- package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +0 -118
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +0 -67
- package/templates/nest/src/simpleapp/services/webhook.service.ts._eta +0 -37
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +0 -85
- package/templates/nest/src/simpleapp/types/index.ts._eta +0 -45
- package/templates/nest/src/simpleapp/webhooks/branch.ts._eta +0 -44
- package/templates/nest/src/simpleapp/webhooks/index.ts._eta +0 -21
- package/templates/nest/src/simpleapp/workflows/bpmn/readme.md._eta +0 -1
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +0 -31
- package/templates/nest/src/simpleapp/workflows/readme.md._eta +0 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta +0 -56
- package/templates/nuxt/components/image/ImageOrganization.vue.eta +0 -66
- /package/src/buildinschemas/{webhook.ts → webhook.ts.backup} +0 -0
- /package/src/buildinschemas/{webhooklog.ts → webhooklog.ts.backup} +0 -0
- /package/templates/basic/nest/{type.ts.eta → type.ts.eta-backup} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/customkeycloak.guard.ts.eta → simple-app/.core/features/auth/keycloak/keycloak.guard.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.decorator.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.group.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/dicts/documents.ts.eta → simple-app/.core/features/document-no-format/document.dict.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/dicts/foreignkeys.ts.eta → simple-app/.core/features/foreign-key/foreignkeys.dict.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/dbupdate → simple-app/.core/features/maintenance/db-update}/1.00.00/index.ts._eta +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/dbupdate → simple-app/.core/features/maintenance/db-update}/index.ts._eta +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/apischemas/dbupdate.ts.eta → simple-app/.core/features/maintenance/schemas/db-update.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/profile/profile.types.ts.eta → simple-app/.core/features/profile/profile.types.ts.eta-backup} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/decorators → simple-app/.core/features/user-context}/appuser.decorator.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta → simple-app/.core/framework/exception-filter.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons → simple-app/.core/utils}/encryption.static.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp → simple-app}/.gitignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.gitignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.npmignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator/FILES.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator/VERSION.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator-ignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/api.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/base.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/common.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/configuration.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/git_push.sh.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/index.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/openapitools.json.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/hello.ts._eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/index.ts.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/money.ts.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/validate.ts.eta +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change
|
|
4
|
+
* last change 2025-09-01
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
8
8
|
import jsonpath from 'jsonpath';
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
|
|
@@ -14,27 +14,30 @@ import Ajv from 'ajv';
|
|
|
14
14
|
import addErrors from 'ajv-errors';
|
|
15
15
|
import addFormats from 'ajv-formats';
|
|
16
16
|
import { FilterQuery, Model, PipelineStage, mongo } from 'mongoose';
|
|
17
|
-
import { CloudApiService } from 'src/cloudapi/cloudapi.service';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
17
|
+
// import { CloudApiService } from 'src/cloudapi/cloudapi.service';
|
|
18
|
+
import { foreignkeys } from '../../features/foreign-key/foreignkeys.dict';
|
|
19
|
+
import { CustomException } from '../custom-exception';
|
|
20
|
+
|
|
21
|
+
import { camelToKebab } from 'src/simple-app/.core/utils/string-utils';
|
|
22
|
+
import { DocumentNoFormatService } from '../../features/document-no-format/document-no-format.service';
|
|
23
|
+
import { UserContext } from '../../features/user-context/user.context';
|
|
24
|
+
import { RunWebhookService } from '../../features/webhook/run-webhook.service';
|
|
25
|
+
import { UniqueKeyExistResponse, DeleteResultType, IsolationType, MoreProjectionType, SchemaFields, TextSearchBody, PatchManyRequest } from '../schemas';
|
|
26
26
|
|
|
27
27
|
@Injectable()
|
|
28
|
-
export class SimpleAppService<T extends
|
|
29
|
-
@Inject(EventEmitter2)
|
|
30
|
-
|
|
31
|
-
@Inject(CloudApiService)
|
|
32
|
-
protected cloudapi: CloudApiService;
|
|
33
|
-
@Inject(PrintApiService)
|
|
34
|
-
protected printapi: PrintApiService;
|
|
35
|
-
@Inject(RunWebhookService)
|
|
28
|
+
export class SimpleAppService<T extends SchemaFields> {
|
|
29
|
+
// @Inject(EventEmitter2)
|
|
30
|
+
// ;
|
|
31
|
+
// @Inject(CloudApiService)
|
|
32
|
+
// protected cloudapi: CloudApiService;
|
|
33
|
+
// @Inject(PrintApiService)
|
|
34
|
+
// protected printapi: PrintApiService;
|
|
35
|
+
// @Inject(RunWebhookService)
|
|
36
36
|
protected runWebHook: RunWebhookService;
|
|
37
|
-
|
|
37
|
+
// @Inject(AuditTrail)
|
|
38
|
+
// protected audittrail: AuditTrail;
|
|
39
|
+
// @Inject(DocNumberFormatGenerator)
|
|
40
|
+
protected docnogenerator: DocumentNoFormatService;
|
|
38
41
|
protected logger = new Logger();
|
|
39
42
|
protected strictIsolation = true;
|
|
40
43
|
protected jsonschema: any = {
|
|
@@ -43,6 +46,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
43
46
|
properties: {},
|
|
44
47
|
required: [],
|
|
45
48
|
};
|
|
49
|
+
|
|
46
50
|
protected documentIdentityCode = 'code';
|
|
47
51
|
protected documentIdentityLabel = 'label';
|
|
48
52
|
protected documentName = '-unknowndocname-';
|
|
@@ -56,32 +60,28 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
56
60
|
protected errorlist = [];
|
|
57
61
|
protected withDocNumberFormat = false;
|
|
58
62
|
protected foreignkeys = {};
|
|
59
|
-
|
|
60
|
-
@Inject(AuditTrail)
|
|
61
|
-
protected audittrail: AuditTrail;
|
|
62
|
-
|
|
63
|
-
@Inject(DocNumberFormatGenerator)
|
|
64
|
-
protected docnogenerator: DocNumberFormatGenerator;
|
|
63
|
+
private eventEmitter: EventEmitter2;
|
|
65
64
|
|
|
66
65
|
// protected userprovider = new UserContext() ;
|
|
67
66
|
|
|
68
|
-
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org) {
|
|
67
|
+
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org, eventEmitter: EventEmitter2, docnogenerator: DocumentNoFormatService) {
|
|
69
68
|
// console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
|
|
69
|
+
this.eventEmitter = eventEmitter;
|
|
70
70
|
this.documentType = doctype.toUpperCase();
|
|
71
71
|
this.documentName = docname;
|
|
72
72
|
this.doc = newdoc;
|
|
73
|
-
|
|
73
|
+
this.docnogenerator = docnogenerator;
|
|
74
74
|
this.isolationtype = isolationtype;
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
// this.tenantdoc = tenantdoc
|
|
77
77
|
}
|
|
78
78
|
getDocumentType = () => this.documentType;
|
|
79
79
|
getDocumentName = (capFirst: boolean = false) => (capFirst ? _.upperFirst(this.documentName) : this.documentName);
|
|
80
|
-
getRecordId = (): string => this.data
|
|
80
|
+
getRecordId = (): string => this.data?._id ?? '';
|
|
81
81
|
setSchema = (newschema) => (this.jsonschema = newschema);
|
|
82
82
|
getSchema = () => this.doc.schema.obj;
|
|
83
83
|
getJsonSchema = () => this.jsonschema;
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
getData = () => {
|
|
86
86
|
//console.log('thisdata', this.data);
|
|
87
87
|
return this.data;
|
|
@@ -141,8 +141,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
141
141
|
};
|
|
142
142
|
async getAutoComplete(appuser: UserContext, keyword: string, data?: T) {
|
|
143
143
|
try {
|
|
144
|
-
const filter1 = {};
|
|
145
|
-
const filter2 = {};
|
|
144
|
+
const filter1: any = {};
|
|
145
|
+
const filter2: any = {};
|
|
146
146
|
const filters: any[] = [];
|
|
147
147
|
if (this.jsonschema.properties[this.documentIdentityCode]['type'] == 'string') {
|
|
148
148
|
filter1[this.documentIdentityCode] = { $regex: keyword, $options: 'i' };
|
|
@@ -161,6 +161,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
161
161
|
if (this.moreAutoCompleteField) {
|
|
162
162
|
Object.assign(projections, this.moreAutoCompleteField);
|
|
163
163
|
}
|
|
164
|
+
|
|
164
165
|
const products = await this.doc.find(filterobj, projections, {
|
|
165
166
|
// limit: this.LIMITPERPAGE,
|
|
166
167
|
});
|
|
@@ -181,12 +182,12 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
181
182
|
*/
|
|
182
183
|
async searchNoIsolation(appuser: UserContext, filters: FilterQuery<T>) {
|
|
183
184
|
try {
|
|
184
|
-
if (this.hooks.beforeSearch) await this.hooks.beforeSearch(appuser, filters);
|
|
185
|
+
//if (this.hooks.beforeSearch) await this.hooks.beforeSearch(appuser, filters);
|
|
185
186
|
const products = await this.doc.find(filters);
|
|
186
187
|
const productlist = products.map((p) => {
|
|
187
188
|
return p;
|
|
188
189
|
});
|
|
189
|
-
if (this.hooks.afterSearch) await this.hooks.afterSearch(appuser, productlist);
|
|
190
|
+
//if (this.hooks.afterSearch) await this.hooks.afterSearch(appuser, productlist);
|
|
190
191
|
|
|
191
192
|
// console.log(products);
|
|
192
193
|
return productlist;
|
|
@@ -218,9 +219,18 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
218
219
|
|
|
219
220
|
Object.assign(pipeline[0]['$match'], isolationFilter);
|
|
220
221
|
this.logger.verbose(pipeline, `${this.documentName} aggregate:`);
|
|
221
|
-
|
|
222
|
+
|
|
223
|
+
// if(appuser.getId() == ''){
|
|
224
|
+
// console.log(JSON.stringify(pipeline))
|
|
225
|
+
// }
|
|
226
|
+
const res = await this.doc.aggregate(pipeline, {
|
|
222
227
|
session: appuser.getDBSession(),
|
|
223
228
|
});
|
|
229
|
+
|
|
230
|
+
// if(appuser.getId() == ''){
|
|
231
|
+
// console.log(res)
|
|
232
|
+
// }
|
|
233
|
+
return res;
|
|
224
234
|
} catch (err) {
|
|
225
235
|
throw new InternalServerErrorException(err);
|
|
226
236
|
}
|
|
@@ -236,7 +246,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
236
246
|
// console.log("initial search",filters)
|
|
237
247
|
const newfilters: FilterQuery<T> = { ...filters, ...isolationFilter };
|
|
238
248
|
|
|
239
|
-
if (this.hooks.beforeSearch) await this.hooks.beforeSearch(appuser, newfilters);
|
|
249
|
+
// if (this.hooks.beforeSearch) await this.hooks.beforeSearch(appuser, newfilters);
|
|
240
250
|
// console.log("before _find",newfilters)
|
|
241
251
|
// console.log("this.doc",this.doc)
|
|
242
252
|
let searchResults: T[] = [];
|
|
@@ -253,7 +263,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
253
263
|
return p;
|
|
254
264
|
});
|
|
255
265
|
// console.log("after map",productlist)
|
|
256
|
-
if (this.hooks.afterSearch) await this.hooks.afterSearch(appuser, list);
|
|
266
|
+
// if (this.hooks.afterSearch) await this.hooks.afterSearch(appuser, list);
|
|
257
267
|
|
|
258
268
|
// console.log(products);
|
|
259
269
|
return list;
|
|
@@ -309,10 +319,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
309
319
|
}
|
|
310
320
|
}
|
|
311
321
|
async findById(appuser: UserContext, id: string) {
|
|
312
|
-
if (this.hooks.beforeFetchRecord) await this.hooks.beforeFetchRecord(appuser, id);
|
|
322
|
+
// if (this.hooks.beforeFetchRecord) await this.hooks.beforeFetchRecord(appuser, id);
|
|
313
323
|
|
|
314
324
|
const data = await this.search(appuser, { _id: id as any });
|
|
315
|
-
if (this.hooks.afterFetchRecord) await this.hooks.afterFetchRecord(appuser, data[0]);
|
|
325
|
+
// if (this.hooks.afterFetchRecord) await this.hooks.afterFetchRecord(appuser, data[0]);
|
|
316
326
|
|
|
317
327
|
if (data.length == 1) {
|
|
318
328
|
// console.log('data0', data[0]);
|
|
@@ -323,10 +333,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
323
333
|
}
|
|
324
334
|
|
|
325
335
|
async findByIdNoIsolation(appuser: UserContext, id: string) {
|
|
326
|
-
if (this.hooks.beforeFetchRecord) await this.hooks.beforeFetchRecord(appuser, id);
|
|
336
|
+
// if (this.hooks.beforeFetchRecord) await this.hooks.beforeFetchRecord(appuser, id);
|
|
327
337
|
|
|
328
338
|
const data = await this.searchNoIsolation(appuser, { _id: id as any });
|
|
329
|
-
if (this.hooks.afterFetchRecord) await this.hooks.afterFetchRecord(appuser, data[0]);
|
|
339
|
+
// if (this.hooks.afterFetchRecord) await this.hooks.afterFetchRecord(appuser, data[0]);
|
|
330
340
|
|
|
331
341
|
if (data.length == 1) {
|
|
332
342
|
// console.log('data0', data[0]);
|
|
@@ -337,9 +347,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
337
347
|
}
|
|
338
348
|
|
|
339
349
|
async createManyWithId(appuser: UserContext, datas: T[]) {
|
|
340
|
-
|
|
341
|
-
if (Array.isArray(datas)) {
|
|
342
|
-
|
|
350
|
+
if (Array.isArray(datas)) {
|
|
343
351
|
for (let i = 0; i < datas.length; i++) {
|
|
344
352
|
const data = datas[i];
|
|
345
353
|
let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
@@ -357,7 +365,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
357
365
|
}
|
|
358
366
|
|
|
359
367
|
const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
360
|
-
await this.
|
|
368
|
+
await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
|
|
361
369
|
for (let i = 0; i < datas.length; i++) {
|
|
362
370
|
appuser.addInsertedRecordId(this.documentName, datas[i]._id);
|
|
363
371
|
}
|
|
@@ -394,16 +402,19 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
394
402
|
this.reCalculateValue(data);
|
|
395
403
|
await this.validateData(appuser, data);
|
|
396
404
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
397
|
-
|
|
405
|
+
|
|
406
|
+
//new way of hook
|
|
407
|
+
await this.runEvent(appuser, this.setHookName('beforeCreate'), { data: data }, false);
|
|
408
|
+
|
|
398
409
|
const newdoc = new this.doc(data);
|
|
399
410
|
|
|
400
411
|
try {
|
|
401
412
|
result = await newdoc.save({ session: dbsession });
|
|
402
|
-
await this.
|
|
413
|
+
await this.addAuditEvent(appuser, this.documentName, result._id, 'create', data);
|
|
403
414
|
appuser.addInsertedRecordId(this.documentName, result._id);
|
|
404
415
|
} catch (err) {
|
|
405
416
|
this.logger.error(err);
|
|
406
|
-
const processdata = await this.
|
|
417
|
+
const processdata = await this.runEvent(appuser, 'processdata.processError', {
|
|
407
418
|
err: err,
|
|
408
419
|
});
|
|
409
420
|
|
|
@@ -415,7 +426,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
415
426
|
}
|
|
416
427
|
|
|
417
428
|
try {
|
|
418
|
-
|
|
429
|
+
//new way of hook
|
|
430
|
+
await this.runEvent(appuser, this.setHookName('afterCreate'), { data: data }, false);
|
|
419
431
|
await this.callWebhook(appuser, 'create', result);
|
|
420
432
|
|
|
421
433
|
// return result as T;
|
|
@@ -450,8 +462,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
450
462
|
if (dbsession && !dbsession.inTransaction()) {
|
|
451
463
|
dbsession.startTransaction({ readPreference: 'primary' });
|
|
452
464
|
}
|
|
453
|
-
const result = await this.doc.insertMany(datas,{session:dbsession});
|
|
454
|
-
await this.
|
|
465
|
+
const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
466
|
+
await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
|
|
455
467
|
return result;
|
|
456
468
|
} else {
|
|
457
469
|
throw new BadRequestException(this.getDocumentType() + ': create many only support array');
|
|
@@ -486,17 +498,20 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
486
498
|
this.logger.debug(data, `after create validation`);
|
|
487
499
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
488
500
|
|
|
489
|
-
|
|
501
|
+
//new way of hook
|
|
502
|
+
|
|
503
|
+
await this.runEvent(appuser, this.setHookName('beforeCreate'), { data: data }, false);
|
|
504
|
+
|
|
490
505
|
this.logger.debug(data, `Create Record ${this.documentName}`);
|
|
491
506
|
const newdoc = new this.doc(data);
|
|
492
507
|
await this.identifyForeignKeys(appuser, data);
|
|
493
508
|
try {
|
|
494
509
|
result = await newdoc.save({ session: dbsession });
|
|
495
|
-
await this.
|
|
510
|
+
await this.addAuditEvent(appuser, this.documentName, result._id, 'create', data);
|
|
496
511
|
appuser.addInsertedRecordId(this.documentName, result._id);
|
|
497
512
|
} catch (err) {
|
|
498
513
|
this.logger.error(err);
|
|
499
|
-
const processdata = await this.
|
|
514
|
+
const processdata = await this.runEvent(appuser, 'processdata.processError', {
|
|
500
515
|
err: err,
|
|
501
516
|
});
|
|
502
517
|
|
|
@@ -508,7 +523,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
508
523
|
}
|
|
509
524
|
|
|
510
525
|
try {
|
|
511
|
-
|
|
526
|
+
//new way of hook
|
|
527
|
+
await this.runEvent(appuser, this.setHookName('afterCreate'), { data: result }, false);
|
|
528
|
+
|
|
512
529
|
await this.callWebhook(appuser, 'create', result);
|
|
513
530
|
return result as T;
|
|
514
531
|
} catch (err) {
|
|
@@ -545,17 +562,19 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
545
562
|
this.logger.debug(data, `after create validation`);
|
|
546
563
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
547
564
|
|
|
548
|
-
|
|
565
|
+
//new way of hook
|
|
566
|
+
await this.runEvent(appuser, this.setHookName('beforeCreate'), { data: data }, false);
|
|
567
|
+
|
|
549
568
|
this.logger.debug(data, `Create Record ${this.documentName}`);
|
|
550
569
|
const newdoc = new this.doc(data);
|
|
551
570
|
await this.identifyForeignKeys(appuser, data);
|
|
552
571
|
try {
|
|
553
572
|
result = await newdoc.save({ session: dbsession });
|
|
554
|
-
await this.
|
|
573
|
+
await this.addAuditEvent(appuser, this.documentName, result._id, 'create', data);
|
|
555
574
|
appuser.addInsertedRecordId(this.documentName, result._id);
|
|
556
575
|
} catch (err) {
|
|
557
576
|
this.logger.error(err);
|
|
558
|
-
const processdata = await this.
|
|
577
|
+
const processdata = await this.runEvent(appuser, 'processdata.processError', {
|
|
559
578
|
err: err,
|
|
560
579
|
});
|
|
561
580
|
|
|
@@ -567,7 +586,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
567
586
|
}
|
|
568
587
|
|
|
569
588
|
try {
|
|
570
|
-
|
|
589
|
+
//new way of hook
|
|
590
|
+
await this.runEvent(appuser, this.setHookName('afterCreate'), { data: result }, false);
|
|
591
|
+
|
|
571
592
|
await this.callWebhook(appuser, 'create', result);
|
|
572
593
|
return result as T;
|
|
573
594
|
} catch (err) {
|
|
@@ -612,9 +633,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
612
633
|
ajv.addKeyword({ keyword: 'x-simpleapp-config', schemaType: 'object' });
|
|
613
634
|
this.logger.debug('run hook during validation');
|
|
614
635
|
let issuccess = true;
|
|
615
|
-
if (this.hooks.beforeValidation) {
|
|
616
|
-
|
|
617
|
-
}
|
|
636
|
+
// if (this.hooks.beforeValidation) {
|
|
637
|
+
// issuccess = await this.hooks.beforeValidation(appuser, data, _id);
|
|
638
|
+
// }
|
|
618
639
|
// const issuccess = await this.hook(appuser, HookType.beforeValidation, data);
|
|
619
640
|
if (!issuccess) {
|
|
620
641
|
const errormsg: string[] = [];
|
|
@@ -638,8 +659,6 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
638
659
|
this.logger.error(JSON.stringify(validate.errors), 'validate errors:');
|
|
639
660
|
throw new BadRequestException('Data validation failed', validate.errors as HttpExceptionOptions);
|
|
640
661
|
}
|
|
641
|
-
//no check for duplicate those
|
|
642
|
-
if (this.hooks.afterValidation) await this.hooks.afterValidation(appuser, data, _id);
|
|
643
662
|
}
|
|
644
663
|
|
|
645
664
|
polishIsolationFilter = (filterIsolation: any, data: any = {}) => {
|
|
@@ -681,7 +700,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
681
700
|
|
|
682
701
|
let dependency;
|
|
683
702
|
try {
|
|
684
|
-
|
|
703
|
+
//new way of hook
|
|
704
|
+
await this.runEvent(appuser, this.setHookName('beforeDelete'), { id: id, deleteData: deletedata }, false);
|
|
705
|
+
|
|
706
|
+
// if (this.hooks.beforeDelete) await this.hooks.beforeDelete(appuser, id, deletedata);
|
|
685
707
|
this.logger.debug('delete record', this.documentName, id);
|
|
686
708
|
dependency = await this.getRelatedRecords(appuser, id);
|
|
687
709
|
//console.log('dependency', dependency);
|
|
@@ -692,7 +714,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
692
714
|
filterIsolation['_id'] = id;
|
|
693
715
|
this.logger.debug('delete filter', filterIsolation);
|
|
694
716
|
const result = await this.doc.deleteOne(filterIsolation).session(dbsession);
|
|
695
|
-
|
|
717
|
+
|
|
718
|
+
await this.addAuditEvent(appuser, this.documentName, id, 'delete', deletedata);
|
|
696
719
|
|
|
697
720
|
appuser.addDeletedRecordId(this.documentName, id);
|
|
698
721
|
const deleteresult: DeleteResultType<T> = {
|
|
@@ -702,13 +725,14 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
702
725
|
this.logger.debug(deleteresult, ' delete result' + this.doc.collection.name);
|
|
703
726
|
// this.doc.findByIdAndDelete(id)
|
|
704
727
|
|
|
705
|
-
|
|
706
|
-
|
|
728
|
+
//new way of hook
|
|
729
|
+
await this.runEvent(appuser, this.setHookName('afterDelete'), { id: id, deleteData: deletedata }, false);
|
|
730
|
+
|
|
707
731
|
await this.callWebhook(appuser, 'delete', deletedata);
|
|
708
732
|
return deleteresult;
|
|
709
733
|
} else {
|
|
710
734
|
this.logger.debug('reject query', dependency);
|
|
711
|
-
|
|
735
|
+
console.log(this.documentName, ' dependency :id=', id, dependency);
|
|
712
736
|
throw new ForbiddenException(`This system detected that the [${this.documentName}] data has been used in other record`, 'Foreignkey constraint');
|
|
713
737
|
}
|
|
714
738
|
} catch (err) {
|
|
@@ -743,7 +767,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
743
767
|
|
|
744
768
|
await this.identifyForeignKeys(appuser, data);
|
|
745
769
|
|
|
746
|
-
|
|
770
|
+
//new way of hook
|
|
771
|
+
await this.runEvent(appuser, `${this.documentName}.beforeUpdate`, { id: id, prevData: existingdata, newData: data }, false);
|
|
772
|
+
|
|
773
|
+
// if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
|
|
747
774
|
|
|
748
775
|
const dbsession = appuser.getDBSession();
|
|
749
776
|
if (dbsession && !dbsession.inTransaction() && !noStartTransaction) {
|
|
@@ -768,10 +795,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
768
795
|
session: dbsession,
|
|
769
796
|
new: true,
|
|
770
797
|
});
|
|
771
|
-
await this.
|
|
798
|
+
await this.addAuditEvent(appuser, this.documentName, id, 'update', data);
|
|
772
799
|
|
|
773
800
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
774
|
-
|
|
801
|
+
await this.runEvent(appuser, this.setHookName('afterUpdate'), { id: id, prevData: existingdata, newData: data }, false);
|
|
802
|
+
|
|
775
803
|
await this.callWebhook(appuser, 'update', result);
|
|
776
804
|
return result; // await this.findById(appuser, id);
|
|
777
805
|
} catch (err) {
|
|
@@ -799,7 +827,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
799
827
|
|
|
800
828
|
await this.identifyForeignKeys(appuser, data);
|
|
801
829
|
|
|
802
|
-
|
|
830
|
+
await this.runEvent(appuser, `${this.documentName}.beforeUpdate`, { data: data }, false);
|
|
831
|
+
|
|
832
|
+
// if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
|
|
803
833
|
|
|
804
834
|
const dbsession = appuser.getDBSession();
|
|
805
835
|
if (dbsession && !dbsession.inTransaction()) {
|
|
@@ -824,10 +854,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
824
854
|
session: dbsession,
|
|
825
855
|
new: true,
|
|
826
856
|
});
|
|
827
|
-
await this.
|
|
857
|
+
await this.addAuditEvent(appuser, this.documentName, id, 'update', data);
|
|
828
858
|
|
|
859
|
+
await this.runEvent(appuser, this.setHookName('afterUpdate'), { id: id, prevData: existingdata, newData: result }, false);
|
|
829
860
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
830
|
-
|
|
861
|
+
|
|
831
862
|
await this.callWebhook(appuser, 'update', result);
|
|
832
863
|
return result; // await this.findById(appuser, id);
|
|
833
864
|
} catch (err) {
|
|
@@ -837,64 +868,91 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
837
868
|
};
|
|
838
869
|
|
|
839
870
|
findIdThenPatch = async (appuser: UserContext, id: string, data: Partial<T>, session: mongo.ClientSession = undefined, skipLog: boolean = false) => {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
871
|
+
try {
|
|
872
|
+
const existingdata = await this.findById(appuser, id);
|
|
873
|
+
if (!existingdata) {
|
|
874
|
+
throw new NotFoundException(`${id} not found`, 'not found');
|
|
875
|
+
}
|
|
876
|
+
if (typeof data.__v == 'number' && data.__v != existingdata.__v) {
|
|
877
|
+
throw new BadRequestException(`You submit older version data "v${data.__v}"" but latest version = "v${existingdata.__v}"`);
|
|
878
|
+
}
|
|
847
879
|
|
|
848
|
-
|
|
880
|
+
if (typeof existingdata.__v !== 'number') {
|
|
881
|
+
existingdata.__v = 0;
|
|
882
|
+
}
|
|
883
|
+
data.__v = existingdata.__v + 1;
|
|
849
884
|
|
|
850
|
-
|
|
885
|
+
await this.identifyForeignKeys(appuser, data);
|
|
851
886
|
|
|
852
|
-
|
|
853
|
-
|
|
887
|
+
//patch not suitable trigger afterupdate
|
|
888
|
+
// if (this.hooks.beforeUpdate) await this.hooks.beforeUpdate(appuser, id, existingdata, data);
|
|
854
889
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
delete data['_id'];
|
|
890
|
+
const dbsession = appuser.getDBSession();
|
|
891
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
892
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
893
|
+
}
|
|
894
|
+
// try {
|
|
895
|
+
Object.assign(data, appuser.getUpdateFilter());
|
|
896
|
+
delete data['_id'];
|
|
863
897
|
|
|
864
|
-
|
|
865
|
-
|
|
898
|
+
//patch not suitable trigger afterupdate
|
|
899
|
+
// this.reCalculateValue(data);
|
|
866
900
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
901
|
+
// existingdata['_id']=''
|
|
902
|
+
// console.log("newdata",data)
|
|
903
|
+
//path record no validation
|
|
904
|
+
// await this.validateData(appuser, data);
|
|
871
905
|
|
|
872
|
-
|
|
873
|
-
|
|
906
|
+
const isolationFilter = { ...this.getIsolationFilter(appuser) };
|
|
907
|
+
this.polishIsolationFilter(isolationFilter);
|
|
874
908
|
|
|
875
|
-
|
|
876
|
-
|
|
909
|
+
isolationFilter['_id'] = id;
|
|
910
|
+
this.applyNestedDateTime(appuser, data, 'update');
|
|
911
|
+
// console.log('findid patch ', data);
|
|
877
912
|
|
|
878
|
-
try {
|
|
879
913
|
const result = await this.doc.findOneAndUpdate(isolationFilter, data, {
|
|
880
914
|
session: dbsession,
|
|
881
915
|
new: true,
|
|
882
916
|
});
|
|
883
917
|
//skip audit trail, useful when want to patch x-foreignkey code,label
|
|
884
918
|
if (!skipLog) {
|
|
885
|
-
await this.
|
|
919
|
+
await this.addAuditEvent(appuser, this.documentName, id, 'patch', data);
|
|
886
920
|
}
|
|
887
921
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
888
922
|
|
|
889
|
-
//patch not suitable trigger afterupdate
|
|
890
|
-
// if (this.hooks.afterUpdate) await this.hooks.afterUpdate(appuser, id, existingdata, result);
|
|
891
|
-
// await this.callWebhook(appuser, 'update', result);
|
|
892
923
|
return result; //await this.findById(appuser, id);
|
|
893
924
|
} catch (err) {
|
|
925
|
+
this.logger.error(err.message, 'findIdThenPath error');
|
|
926
|
+
console.error(err);
|
|
894
927
|
throw new InternalServerErrorException(err.message);
|
|
895
928
|
}
|
|
896
929
|
};
|
|
897
930
|
|
|
931
|
+
async patchMany<T>(appuser: UserContext, data: PatchManyRequest<T>) {
|
|
932
|
+
// filter = {
|
|
933
|
+
// _id: '7eb2661a-6ea6-406e-b868-2e8b19c4658b',
|
|
934
|
+
// 'tuitionClass._id': '5aa69cee-f651-45f4-bad8-0f52a3fb92b5',
|
|
935
|
+
// };
|
|
936
|
+
|
|
937
|
+
const filter = data.filter;
|
|
938
|
+
const patch = data.data as Object;
|
|
939
|
+
|
|
940
|
+
const isolationFilter = { ...this.getIsolationFilter(appuser), ...(filter || {}) };
|
|
941
|
+
this.polishIsolationFilter(isolationFilter);
|
|
942
|
+
this.applyNestedDateTime(appuser, patch, 'update');
|
|
943
|
+
|
|
944
|
+
// Get DB Session
|
|
945
|
+
const dbsession = appuser.getDBSession();
|
|
946
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
947
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
const result = await this.doc.updateMany(isolationFilter, { $set: patch }, { session: dbsession });
|
|
951
|
+
await this.addManyAuditEvents(appuser, this.documentName, 'patchMany', [patch]);
|
|
952
|
+
|
|
953
|
+
return result;
|
|
954
|
+
}
|
|
955
|
+
|
|
898
956
|
//find what foreign key constraint
|
|
899
957
|
async getRelatedRecords(appuser: UserContext, id: string) {
|
|
900
958
|
this.logger.debug('get foreignkey for delete:', id);
|
|
@@ -965,19 +1023,22 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
965
1023
|
}
|
|
966
1024
|
data['documentStatus'] = docstatus;
|
|
967
1025
|
// await this.hook(appuser, HookType.beforeSetStatus, data);
|
|
968
|
-
|
|
1026
|
+
await this.runEvent(appuser, this.setHookName('beforeSetStatus'), { docStatus: docstatus, prevData: existdata, newData: data }, false);
|
|
1027
|
+
|
|
1028
|
+
// if (this.hooks.beforeSetStatus) await this.hooks.beforeSetStatus(appuser, docstatus, data, existdata);
|
|
969
1029
|
|
|
970
1030
|
if (data && !data['created']) {
|
|
971
1031
|
const createresult = await this.create(appuser, data);
|
|
972
|
-
|
|
973
|
-
await this.
|
|
1032
|
+
await this.runEvent(appuser, this.setHookName('afterSetStatus'), { docStatus: docstatus, data: createresult }, false);
|
|
1033
|
+
// if (this.hooks.afterSetStatus) await this.hooks.afterSetStatus(appuser, docstatus, createresult);
|
|
1034
|
+
await this.addAuditEvent(appuser, this.documentName, id, docstatus, data);
|
|
974
1035
|
|
|
975
1036
|
return createresult;
|
|
976
1037
|
} else {
|
|
977
1038
|
const updateresult = await this.findIdThenPatch(appuser, id, data);
|
|
978
|
-
const finaldata = await this.findById(appuser, id);
|
|
979
|
-
|
|
980
|
-
await this.
|
|
1039
|
+
const finaldata = await this.findById(appuser, id);
|
|
1040
|
+
await this.runEvent(appuser, this.setHookName('afterSetStatus'), { docStatus: docstatus, data: finaldata }, false);
|
|
1041
|
+
await this.addAuditEvent(appuser, this.documentName, id, docstatus, data);
|
|
981
1042
|
|
|
982
1043
|
await this.callWebhook(appuser, docstatus, finaldata);
|
|
983
1044
|
return updateresult;
|
|
@@ -985,7 +1046,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
985
1046
|
}
|
|
986
1047
|
|
|
987
1048
|
/**
|
|
988
|
-
* similar like
|
|
1049
|
+
* similar like runEvent, but it is syncronizely add event into queue and return.
|
|
989
1050
|
* No result will return from this method, it also lose appuser db's transaction
|
|
990
1051
|
* due out of request flow
|
|
991
1052
|
*
|
|
@@ -998,7 +1059,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
998
1059
|
}
|
|
999
1060
|
|
|
1000
1061
|
/**
|
|
1001
|
-
*
|
|
1062
|
+
* runEvent design with 2 purpose
|
|
1002
1063
|
* 1. we wish developer develop complex programming flow in worker class instead
|
|
1003
1064
|
* of service class. We wish service class remain simple and easy to understand
|
|
1004
1065
|
* it wish to do hook and api only
|
|
@@ -1013,28 +1074,40 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
1013
1074
|
* @param {any} data The data
|
|
1014
1075
|
* @return {Promise} { description_of_the_return_value }
|
|
1015
1076
|
*/
|
|
1016
|
-
async
|
|
1017
|
-
|
|
1018
|
-
if (!this.eventEmitter.hasListeners(eventName)) {
|
|
1019
|
-
throw new InternalServerErrorException(`${eventName} seems no listener`);
|
|
1020
|
-
}
|
|
1021
|
-
if (!res) {
|
|
1022
|
-
throw new InternalServerErrorException(`${eventName} is invalid worker`);
|
|
1023
|
-
}
|
|
1077
|
+
async runEvent(appuser: UserContext, eventName: string, payloads: any, enforce: boolean = true) {
|
|
1078
|
+
try {
|
|
1024
1079
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1080
|
+
if (enforce && !this.eventEmitter.hasListeners(eventName)) {
|
|
1081
|
+
throw new InternalServerErrorException(`${eventName} seems no listener`);
|
|
1082
|
+
} else if (this.eventEmitter.hasListeners(eventName)) {
|
|
1083
|
+
const res = await this.eventEmitter.emitAsync(eventName, appuser, payloads);
|
|
1084
|
+
|
|
1085
|
+
if (!res) {
|
|
1086
|
+
throw new InternalServerErrorException(`${eventName} is invalid worker`);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
const result = res[0];
|
|
1090
|
+
if (result?.name && result?.name.includes('Exception')) throw result;
|
|
1091
|
+
return result;
|
|
1092
|
+
}
|
|
1093
|
+
} catch (e) {
|
|
1094
|
+
console.error(e);
|
|
1095
|
+
throw e;
|
|
1096
|
+
}
|
|
1031
1097
|
}
|
|
1098
|
+
// startWorkflow(appuser: UserContext, processName: WorkflowName, workflowData: any) {
|
|
1099
|
+
// return this.eventEmitter.emit('workflow.start', appuser, processName, workflowData);
|
|
1100
|
+
// }
|
|
1032
1101
|
|
|
1033
1102
|
async genNewDocNo(appuser: UserContext, data: T) {
|
|
1034
1103
|
this.logger.debug('genNewDocNo');
|
|
1104
|
+
// console.log('before genNewDocNo');
|
|
1035
1105
|
const result = await this.docnogenerator.generateNextNumberFromDocument(appuser, this.documentType, data);
|
|
1106
|
+
// console.log('after genNewDocNo');
|
|
1036
1107
|
this.logger.debug(result, 'genNewDocNo');
|
|
1037
|
-
|
|
1108
|
+
|
|
1109
|
+
// been for to convert become object
|
|
1110
|
+
(data as any)[this.documentIdentityCode] = result;
|
|
1038
1111
|
}
|
|
1039
1112
|
async runDefault(appuser: UserContext): Promise<unknown> {
|
|
1040
1113
|
return 'Hello this is ' + this.getDocumentType() + ': ' + this.getDocumentName();
|
|
@@ -1125,13 +1198,15 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
1125
1198
|
}
|
|
1126
1199
|
}
|
|
1127
1200
|
|
|
1128
|
-
async print(appuser: UserContext, id: string,
|
|
1129
|
-
const pdfresult = await this.printapi.getBase64Pdf(appuser, formatid, id);
|
|
1130
|
-
|
|
1201
|
+
async print(appuser: UserContext, id: string, formatId: string) {
|
|
1202
|
+
// const pdfresult = await this.printapi.getBase64Pdf(appuser, formatid, id);
|
|
1203
|
+
const pdfresult = await this.runEvent(appuser, 'print.getbase64pdf', { id: id, formatId: formatId }, true);
|
|
1204
|
+
// return pdfresult;
|
|
1205
|
+
return Promise.resolve('ok');
|
|
1131
1206
|
}
|
|
1132
1207
|
|
|
1133
|
-
async
|
|
1134
|
-
const response:
|
|
1208
|
+
async checkUniqueKeyExist(appuser: UserContext, data: string[]): Promise<UniqueKeyExistResponse[]> {
|
|
1209
|
+
const response: UniqueKeyExistResponse[] = [];
|
|
1135
1210
|
const unionKey = this.getDocumentIdentityCode();
|
|
1136
1211
|
const searchQuery: any = { [unionKey]: { $in: data } };
|
|
1137
1212
|
// search for multiple union exist
|
|
@@ -1192,12 +1267,37 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
1192
1267
|
return pipelines;
|
|
1193
1268
|
}
|
|
1194
1269
|
|
|
1270
|
+
setHookName(hookName) {
|
|
1271
|
+
const resourceName = this.jsonschema['x-simpleapp-config']['resourceName'];
|
|
1272
|
+
return camelToKebab(resourceName) + '.' + camelToKebab(hookName);
|
|
1273
|
+
}
|
|
1195
1274
|
//only realtime webhook supported at this moment
|
|
1196
1275
|
async callWebhook(appuser: UserContext, actionName: string, data: any) {
|
|
1197
1276
|
try {
|
|
1198
|
-
await this.runWebHook.run(appuser, this.documentName, actionName, data);
|
|
1277
|
+
// await this.runWebHook.run(appuser, this.documentName, actionName, data);
|
|
1278
|
+
// await this.runEvent(appuser, 'webhook.run', {
|
|
1279
|
+
// documentName: this.documentName,
|
|
1280
|
+
// actionName: actionName,
|
|
1281
|
+
// data: data,
|
|
1282
|
+
// });
|
|
1199
1283
|
} catch (e) {
|
|
1200
1284
|
throw new InternalServerErrorException(e);
|
|
1201
1285
|
}
|
|
1202
1286
|
}
|
|
1287
|
+
|
|
1288
|
+
async addAuditEvent(appuser: UserContext, documentName: string, id: string, eventType: string, data: any) {
|
|
1289
|
+
// await this.runEvent(appuser, 'audittrail.add', {
|
|
1290
|
+
// documentName: documentName,
|
|
1291
|
+
// id: id,
|
|
1292
|
+
// eventType: eventType,
|
|
1293
|
+
// data: data,
|
|
1294
|
+
// });
|
|
1295
|
+
}
|
|
1296
|
+
async addManyAuditEvents(appuser: UserContext, documentName: string, eventType: string, datas: any) {
|
|
1297
|
+
// await this.runEvent(appuser, 'audittrail.add', {
|
|
1298
|
+
// documentName: documentName,
|
|
1299
|
+
// eventType: eventType,
|
|
1300
|
+
// datas: datas,
|
|
1301
|
+
// });
|
|
1302
|
+
}
|
|
1203
1303
|
}
|