@simitgroup/simpleapp-generator 1.6.7-o-alpha → 2.0.0-b-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 +9 -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 +31 -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 +26 -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 +86 -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} +20 -17
- 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 +21 -0
- package/templates/nest/src/{simpleapp/generate/controllers/simpleapp.controller.ts.eta → simple-app/.core/framework/base/simple-app.controller.ts.eta} +20 -35
- package/templates/nest/src/{simpleapp/generate/processors/simpleapp.processor.ts.eta → simple-app/.core/framework/base/simple-app.service.ts.eta} +228 -140
- 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,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-02-23
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { ApiProperty, ApiExtraModels } from '@nestjs/swagger';
|
|
9
|
-
export class ApiKeyValuePair {
|
|
10
|
-
@ApiProperty({
|
|
11
|
-
type: Object,
|
|
12
|
-
required: false,
|
|
13
|
-
example: [{"field1": "1"}],
|
|
14
|
-
default: '',
|
|
15
|
-
})
|
|
16
|
-
field1: any;
|
|
17
|
-
}
|
|
18
|
-
export class SortItem {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export class ApiSearchBody {
|
|
24
|
-
@ApiProperty({
|
|
25
|
-
type: Object,
|
|
26
|
-
required: false,
|
|
27
|
-
example: [{"field1": "1"}],
|
|
28
|
-
default: { field1: 'ok', field2: true },
|
|
29
|
-
})
|
|
30
|
-
filter?: Object;
|
|
31
|
-
@ApiProperty({
|
|
32
|
-
type: [String],
|
|
33
|
-
required: false,
|
|
34
|
-
example: ['["field1","field2"]'],
|
|
35
|
-
default: ['field1', 'field2'],
|
|
36
|
-
})
|
|
37
|
-
fields?: string[];
|
|
38
|
-
@ApiProperty({
|
|
39
|
-
type: 'array',
|
|
40
|
-
required: false,
|
|
41
|
-
items:{
|
|
42
|
-
type: 'array',
|
|
43
|
-
items:{
|
|
44
|
-
type:'string'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
example: ['[[ "field1", "asc" ]]'],
|
|
48
|
-
default: [['field1', 'asc']],
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
sorts?: string[][];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
@ApiProperty({ type: () => Object, required: false })
|
|
55
|
-
lookup: Object;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@ApiExtraModels()
|
|
59
|
-
export class NoParam {}
|
|
60
|
-
|
|
61
|
-
@ApiExtraModels()
|
|
62
|
-
export class DynamicParam {}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2023-10-28
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { InjectModel } from '@nestjs/mongoose';
|
|
8
|
-
import { Injectable } from '@nestjs/common';
|
|
9
|
-
import { UserContext } from '../commons/user.context';
|
|
10
|
-
import { Model } from 'mongoose';
|
|
11
|
-
import * as types from 'src/simpleapp/generate/types';
|
|
12
|
-
|
|
13
|
-
@Injectable()
|
|
14
|
-
export class AuditTrail {
|
|
15
|
-
constructor(
|
|
16
|
-
@InjectModel('Documentevent') private doc: Model<types.Documentevent>,
|
|
17
|
-
) {}
|
|
18
|
-
|
|
19
|
-
// addEvent(data: any) {
|
|
20
|
-
// console.log('Add event into db:', data);
|
|
21
|
-
// }
|
|
22
|
-
async addEvent(
|
|
23
|
-
appuser: UserContext,
|
|
24
|
-
documentName: string,
|
|
25
|
-
id: string,
|
|
26
|
-
eventType: string,
|
|
27
|
-
data: any,
|
|
28
|
-
) {
|
|
29
|
-
const eventdata: types.Documentevent = {
|
|
30
|
-
_id: crypto.randomUUID(),
|
|
31
|
-
documentName: documentName,
|
|
32
|
-
documentId: id,
|
|
33
|
-
eventType: eventType,
|
|
34
|
-
eventdata: data,
|
|
35
|
-
};
|
|
36
|
-
Object.assign(eventdata, appuser.getCreateFilter());
|
|
37
|
-
// console.log('add event', documentName, id, eventType);
|
|
38
|
-
// console.log('Add event into db:', eventdata);
|
|
39
|
-
const newdoc = new this.doc(eventdata);
|
|
40
|
-
const dbsession = appuser.getDBSession();
|
|
41
|
-
const result = await newdoc.save({ session: dbsession });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async addManyEvents(
|
|
45
|
-
appuser: UserContext,
|
|
46
|
-
documentName: string,
|
|
47
|
-
eventType: string,
|
|
48
|
-
data: any[],
|
|
49
|
-
) {
|
|
50
|
-
// console.log('add many event', documentName, eventType);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-04-17
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { Injectable, CanActivate, ExecutionContext, UnauthorizedException } from '@nestjs/common';
|
|
8
|
-
import { Reflector } from '@nestjs/core';
|
|
9
|
-
import { ResourceGuard } from 'nest-keycloak-connect';
|
|
10
|
-
|
|
11
|
-
@Injectable()
|
|
12
|
-
export class CustomKeycloakGuard implements CanActivate {
|
|
13
|
-
constructor(
|
|
14
|
-
private reflector: Reflector,
|
|
15
|
-
private resourceGuard: ResourceGuard,
|
|
16
|
-
) {}
|
|
17
|
-
|
|
18
|
-
async canActivate(context: ExecutionContext): Promise<boolean> {
|
|
19
|
-
const request = context.switchToHttp().getRequest();
|
|
20
|
-
|
|
21
|
-
//graphql no http request, exclude from capability of x-apikey
|
|
22
|
-
if (request?.headers) {
|
|
23
|
-
const apiKey = request.headers['x-apikey'];
|
|
24
|
-
const apiSecret = request.headers['x-apisecret'];
|
|
25
|
-
// validate apikey and apisecret at middleware level, reach here mean approved as robot
|
|
26
|
-
if (apiKey && apiSecret) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// If API key is not present, fall back to Keycloak authentication
|
|
32
|
-
try {
|
|
33
|
-
const canActivate = await this.resourceGuard.canActivate(context);
|
|
34
|
-
return canActivate as boolean;
|
|
35
|
-
} catch (error) {
|
|
36
|
-
throw new UnauthorizedException('Invalid API key or Keycloak token');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private validateApiKey(apiKey: string, apiSecret: string): boolean {
|
|
41
|
-
// Implement your API key and secret validation logic here
|
|
42
|
-
// This is just a simple example
|
|
43
|
-
return apiKey === 'your-valid-api-key' && apiSecret === 'your-valid-api-secret';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2023-10-28
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { UserContext } from './user.context';
|
|
8
|
-
import { InjectModel } from '@nestjs/mongoose';
|
|
9
|
-
import { Model } from 'mongoose';
|
|
10
|
-
import { DocNumberFormatResult } from '../types';
|
|
11
|
-
import { Docnoformat } from '../types/docno.type';
|
|
12
|
-
import {
|
|
13
|
-
Injectable,
|
|
14
|
-
InternalServerErrorException,
|
|
15
|
-
BadRequestException,
|
|
16
|
-
} from '@nestjs/common';
|
|
17
|
-
// import moment from 'moment';
|
|
18
|
-
import dayjs from 'dayjs';
|
|
19
|
-
import { ForeignKey } from '../types';
|
|
20
|
-
|
|
21
|
-
export class DocNumberFormatGenerator {
|
|
22
|
-
constructor(
|
|
23
|
-
@InjectModel('Docnoformat') private docformat: Model<Docnoformat>,
|
|
24
|
-
) {}
|
|
25
|
-
|
|
26
|
-
async generateNextNumberFromDocument(
|
|
27
|
-
appuser: UserContext,
|
|
28
|
-
docType: string,
|
|
29
|
-
data: any,
|
|
30
|
-
) {
|
|
31
|
-
let formatId = '';
|
|
32
|
-
if (data.docNoFormat && data.docNoFormat._id) {
|
|
33
|
-
formatId = data.docNoFormat._id;
|
|
34
|
-
}
|
|
35
|
-
const docnoobj = await this.generateNextNo(appuser, docType, formatId);
|
|
36
|
-
const result: ForeignKey = {
|
|
37
|
-
_id: String(docnoobj.formatId),
|
|
38
|
-
label: docnoobj.formatName,
|
|
39
|
-
};
|
|
40
|
-
data.docNoFormat = result;
|
|
41
|
-
return docnoobj.result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
generateNextNo = async (
|
|
45
|
-
appuser: UserContext,
|
|
46
|
-
doctype: string,
|
|
47
|
-
id: string = '',
|
|
48
|
-
) => {
|
|
49
|
-
doctype = doctype.toUpperCase();
|
|
50
|
-
const filter = { docNoType: doctype, active: true };
|
|
51
|
-
if (id) {
|
|
52
|
-
filter['_id'] = id;
|
|
53
|
-
}
|
|
54
|
-
//
|
|
55
|
-
Object.assign(filter, appuser.getBranchFilter());
|
|
56
|
-
const result = await this.docformat
|
|
57
|
-
.find(filter)
|
|
58
|
-
.session(appuser.getDBSession());
|
|
59
|
-
//search(appuser, filter);
|
|
60
|
-
if (result && result.length > 0) {
|
|
61
|
-
const d: Docnoformat = result[0];
|
|
62
|
-
const recordId = d._id;
|
|
63
|
-
const newdocno = DocNumberFormatGenerator.previewDocNo(d);
|
|
64
|
-
const newnextnumber = d.nextNumber + 1;
|
|
65
|
-
const updatedata = { nextNumber: newnextnumber } as Docnoformat;
|
|
66
|
-
const updateresult = await this.docformat
|
|
67
|
-
.findByIdAndUpdate(recordId, updatedata)
|
|
68
|
-
.session(appuser.getDBSession());
|
|
69
|
-
|
|
70
|
-
if (updateresult) {
|
|
71
|
-
const result: DocNumberFormatResult = {
|
|
72
|
-
formatId: d._id,
|
|
73
|
-
formatName: d.docNoFormatName,
|
|
74
|
-
result: newdocno,
|
|
75
|
-
};
|
|
76
|
-
return result;
|
|
77
|
-
//;
|
|
78
|
-
} else {
|
|
79
|
-
throw new InternalServerErrorException(
|
|
80
|
-
`Update document format ${doctype}/${recordId} to next number (${newnextnumber}) failed`,
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
throw new BadRequestException(
|
|
85
|
-
`No active document number found for ${doctype}. Please update in Settings > Document Numbering Format`,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
static previewDocNo = (s: Docnoformat) => {
|
|
90
|
-
try {
|
|
91
|
-
const pattern = s.docNoPattern;
|
|
92
|
-
const numberReg: RegExp = /\[(.*?)\]/g;
|
|
93
|
-
const dateReg: RegExp = /\{(.*?)\}/g;
|
|
94
|
-
let newvalue = pattern;
|
|
95
|
-
const numberpattern: string[] = pattern.match(numberReg);
|
|
96
|
-
const datepattern: string[] = pattern.match(dateReg);
|
|
97
|
-
|
|
98
|
-
if (numberpattern && numberpattern.length > 0) {
|
|
99
|
-
const numberlength = numberpattern[0]
|
|
100
|
-
.replace('[', '')
|
|
101
|
-
.replace(']', '').length;
|
|
102
|
-
|
|
103
|
-
let nextnumber = s.nextNumber.toString();
|
|
104
|
-
|
|
105
|
-
const numberdiff = numberlength - nextnumber.length;
|
|
106
|
-
|
|
107
|
-
for (let n = 0; n < numberdiff; n++) {
|
|
108
|
-
nextnumber = '0' + nextnumber;
|
|
109
|
-
}
|
|
110
|
-
newvalue = newvalue.replace(numberpattern[0], nextnumber);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (datepattern && datepattern.length > 0) {
|
|
114
|
-
for (let d = 0; d < datepattern.length; d++) {
|
|
115
|
-
const dpattern = datepattern[d];
|
|
116
|
-
const date = new Date();
|
|
117
|
-
const formatteddate = dayjs().format(
|
|
118
|
-
dpattern.replace('{', '').replace('}', ''),
|
|
119
|
-
);
|
|
120
|
-
newvalue = newvalue.replace(dpattern, formatteddate);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return newvalue;
|
|
124
|
-
} catch (e) {
|
|
125
|
-
const errors = `Format ${s.docNoFormatName} error ${e}`;
|
|
126
|
-
throw new InternalServerErrorException(errors);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2023-10-28
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { BPMNClient } from "bpmn-client";
|
|
8
|
-
import { UserContext } from './user.context';
|
|
9
|
-
import { Injectable,Scope } from '@nestjs/common';
|
|
10
|
-
|
|
11
|
-
export const WorkflowProviderFactory = {
|
|
12
|
-
provide:'WorkflowProvider',
|
|
13
|
-
useFactory:()=>(new WorkflowProvider()),
|
|
14
|
-
scope:Scope.REQUEST
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type UserTaskActorOptions={
|
|
18
|
-
userId:string
|
|
19
|
-
actGroups?:string[]
|
|
20
|
-
actUsers?:string[]
|
|
21
|
-
}
|
|
22
|
-
@Injectable()
|
|
23
|
-
export class WorkflowProvider{
|
|
24
|
-
// private static instance: Workflow;
|
|
25
|
-
server:BPMNClient
|
|
26
|
-
|
|
27
|
-
constructor(){
|
|
28
|
-
this.server= new BPMNClient(process.env.BPMN_HOST, process.env.BPMN_PORT, process.env.BPMN_API_KEY);
|
|
29
|
-
}
|
|
30
|
-
// public static getInstance(): Workflow {
|
|
31
|
-
// if (!Workflow.instance) {
|
|
32
|
-
// Workflow.instance = new Workflow();
|
|
33
|
-
// }
|
|
34
|
-
// return Workflow.instance;
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
async executeWorkFlow(id: string, bpmnname: string, docstatus: string,data:any) {
|
|
38
|
-
const workflowactoroptions : UserTaskActorOptions ={
|
|
39
|
-
userId: 'id',
|
|
40
|
-
actGroups:[],
|
|
41
|
-
actUsers:[]
|
|
42
|
-
}
|
|
43
|
-
var instance = await this.server.engine.start(bpmnname, data,null,workflowactoroptions);
|
|
44
|
-
const res = {instanceId:instance.id,data:instance.data,name:instance.name,status:instance.status}
|
|
45
|
-
return Promise.resolve(res);
|
|
46
|
-
}
|
|
47
|
-
async getMyUserTask(){
|
|
48
|
-
const uid = 'id'
|
|
49
|
-
const groups = 'group'
|
|
50
|
-
// 'assignments.candidateUsers': User.getInstance().getUid(),
|
|
51
|
-
// 'assignments.candidateGroups': User.getInstance().getGroups
|
|
52
|
-
|
|
53
|
-
let anyof:any = [
|
|
54
|
-
{'items.assignments.assignee':uid},
|
|
55
|
-
]
|
|
56
|
-
let usersfilter={}
|
|
57
|
-
usersfilter[uid]={$in: 'items.assignments.candidateUsers'}
|
|
58
|
-
anyof.push(usersfilter)
|
|
59
|
-
//{'data.tenantId': 1,'$or':[{
|
|
60
|
-
// 'items.assignments.assignee': 'b2a49a8f-a943-4814-8087-60b1ef2f304f'
|
|
61
|
-
// }]}
|
|
62
|
-
//any of the group
|
|
63
|
-
for(let i=0;i<groups.length;i++){
|
|
64
|
-
const gname = groups[i]
|
|
65
|
-
const tmp = {}
|
|
66
|
-
tmp[gname]={ $in: 'items.assignments.candidateGroups'}
|
|
67
|
-
anyof.push(tmp)
|
|
68
|
-
}
|
|
69
|
-
const filters = {
|
|
70
|
-
'data.tenantId': 1,
|
|
71
|
-
'$or':anyof
|
|
72
|
-
}
|
|
73
|
-
console.dir(filters)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// 'assignments.assignee': User.getInstance().getUid(),
|
|
77
|
-
const client = new BPMNClient(process.env.BPMN_HOST, process.env.BPMN_PORT, process.env.BPMN_API_KEY);
|
|
78
|
-
const items = await client.datastore.findItems(filters)
|
|
79
|
-
let data=[]
|
|
80
|
-
for(let i=0;i<items.length;i++){
|
|
81
|
-
if(items[i].status=='wait'){
|
|
82
|
-
data.push(items[i])
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return Promise.resolve(data);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-02-23
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
<%for(let i=0; i<it.modules.length;i++){ %>
|
|
9
|
-
<% const d = it.modules[i] %>
|
|
10
|
-
export * from './<%= d['doctype']%>.jsonschema'
|
|
11
|
-
<%}%>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2023-10-28
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Schema } from 'mongoose';
|
|
9
|
-
import { BranchOrganization, Branch, } from '../types/branch.type';
|
|
10
|
-
const schemasetting = {
|
|
11
|
-
_id: {type:String},
|
|
12
|
-
created: {type: String},
|
|
13
|
-
updated: {type: String},
|
|
14
|
-
duration:{type: Number},
|
|
15
|
-
createdBy: {type: String},
|
|
16
|
-
path:{type:String},
|
|
17
|
-
ip:{type:String},
|
|
18
|
-
method:{type:String},
|
|
19
|
-
headers:{type: Object},
|
|
20
|
-
data: {type: Object},
|
|
21
|
-
statusCode: {type: Number},
|
|
22
|
-
status:{type:String},
|
|
23
|
-
errMsg:{type:String},
|
|
24
|
-
errData: {type: Object},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const ApiEventMongoSchema = new Schema(schemasetting,{collection: 'apievent'})
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-07-10
|
|
5
|
-
* Author: Yong Xiang
|
|
6
|
-
*/
|
|
7
|
-
import { UserContext } from '../commons/user.context';
|
|
8
|
-
import * as sharelibs from '../sharelibs';
|
|
9
|
-
import { Injectable, Inject, InternalServerErrorException } from '@nestjs/common';
|
|
10
|
-
import { InjectModel } from '@nestjs/mongoose';
|
|
11
|
-
import jsonpath from 'jsonpath';
|
|
12
|
-
import { Model } from 'mongoose';
|
|
13
|
-
import { AutoincreamentJsonSchema } from '../jsonschemas/autoinc.jsonschema';
|
|
14
|
-
import { SimpleAppService } from './simpleapp.processor';
|
|
15
|
-
import { IsolationType } from '../types';
|
|
16
|
-
import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
|
|
17
|
-
import { Autoincreament } from '../types/autoinc.type';
|
|
18
|
-
import { DefaultAutoincreament } from '../defaults/autoinc.default';
|
|
19
|
-
|
|
20
|
-
@Injectable()
|
|
21
|
-
export class AutoincreamentProcessor extends SimpleAppService<Autoincreament> {
|
|
22
|
-
protected documentIdentityCode = '';
|
|
23
|
-
protected documentIdentityLabel = '';
|
|
24
|
-
|
|
25
|
-
protected foreignkeys = {};
|
|
26
|
-
constructor(mydoc: Model<Autoincreament>) {
|
|
27
|
-
super('AUTOINC', 'autoincreament', mydoc, IsolationType.none);
|
|
28
|
-
this.setSchema(AutoincreamentJsonSchema);
|
|
29
|
-
this.setData(DefaultAutoincreament(crypto.randomUUID()));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
reCalculateValue(data: Autoincreament) {
|
|
33
|
-
//console.log('trigger new recalculate')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async runGenerateNextNo(
|
|
37
|
-
appuser: UserContext,
|
|
38
|
-
collection: string,
|
|
39
|
-
field: string,
|
|
40
|
-
) {
|
|
41
|
-
// console.log('run generate');
|
|
42
|
-
const res = await this.search(appuser, {
|
|
43
|
-
collectionName: collection,
|
|
44
|
-
fieldName: field,
|
|
45
|
-
});
|
|
46
|
-
// console.log(res)
|
|
47
|
-
let data;
|
|
48
|
-
if (res.length > 0) {
|
|
49
|
-
// console.log("FOUND RESULT------")
|
|
50
|
-
const tmp = res[0];
|
|
51
|
-
const nextno = tmp.nextNo;
|
|
52
|
-
data = { collectionName: collection, fieldName: field, nextno: nextno };
|
|
53
|
-
|
|
54
|
-
// console.log('updatehere');
|
|
55
|
-
|
|
56
|
-
// this.findIdThenUpdate(appuser, tmp._id, {
|
|
57
|
-
// collectionName: collection,
|
|
58
|
-
// fieldName: field,
|
|
59
|
-
// nextNo: tmp.nextNo + 1,
|
|
60
|
-
// });
|
|
61
|
-
// await this.doc.findByIdAndUpdate(tmp._id,{
|
|
62
|
-
// collectionName: collection,
|
|
63
|
-
// fieldName: field,
|
|
64
|
-
// nextNo: tmp.nextNo + 1,
|
|
65
|
-
// })
|
|
66
|
-
await this.doc.updateOne({_id:tmp._id},{
|
|
67
|
-
collectionName: collection,
|
|
68
|
-
fieldName: field,
|
|
69
|
-
nextNo: tmp.nextNo + 1,
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
} else {
|
|
73
|
-
// console.log('createupdate')
|
|
74
|
-
// console.log("CREATE ROW------")
|
|
75
|
-
this.data = { collectionName: collection, fieldName: field, nextNo: 2 };
|
|
76
|
-
const createResult = await this.create(appuser, this.data);
|
|
77
|
-
data = {
|
|
78
|
-
_id: crypto.randomUUID(),
|
|
79
|
-
collectionName: collection,
|
|
80
|
-
fieldName: field,
|
|
81
|
-
nextno: 1,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
/***************************** additional execute *****************************************/
|
|
88
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-07-10
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
* Last Modified By: Yong Xiang
|
|
7
|
-
*/
|
|
8
|
-
import { UserContext } from '../commons/user.context';
|
|
9
|
-
import * as sharelibs from '../sharelibs';
|
|
10
|
-
import {
|
|
11
|
-
Injectable,
|
|
12
|
-
Inject,
|
|
13
|
-
InternalServerErrorException,
|
|
14
|
-
} from '@nestjs/common';
|
|
15
|
-
import { InjectModel } from '@nestjs/mongoose';
|
|
16
|
-
import jsonpath from 'jsonpath';
|
|
17
|
-
import { Model } from 'mongoose';
|
|
18
|
-
import { BranchJsonSchema } from '../jsonschemas/branch.jsonschema';
|
|
19
|
-
import { SimpleAppService } from './simpleapp.processor';
|
|
20
|
-
import { IsolationType } from '../types';
|
|
21
|
-
import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
|
|
22
|
-
import { AutoincreamentService } from '../../services/autoinc.service';
|
|
23
|
-
import { alldocuments } from '../commons/dicts/documents';
|
|
24
|
-
import { Docnoformat, DocnoformatService } from '../../services/docno.service';
|
|
25
|
-
import { BranchOrganization, Branch, BranchHooks } from '../types/branch.type';
|
|
26
|
-
import {
|
|
27
|
-
DefaultBranchOrganization,
|
|
28
|
-
DefaultBranch,
|
|
29
|
-
} from '../defaults/branch.default';
|
|
30
|
-
|
|
31
|
-
@Injectable()
|
|
32
|
-
export class BranchProcessor extends SimpleAppService<Branch> {
|
|
33
|
-
@Inject(AutoincreamentService)
|
|
34
|
-
protected increament: AutoincreamentService;
|
|
35
|
-
@Inject(DocnoformatService)
|
|
36
|
-
private docnoservice: DocnoformatService;
|
|
37
|
-
protected strictIsolation = false;
|
|
38
|
-
protected documentIdentityCode = 'branchCode';
|
|
39
|
-
protected documentIdentityLabel = 'branchName';
|
|
40
|
-
protected hooks: BranchHooks = {
|
|
41
|
-
beforeCreate: async (appuser: UserContext, data: Branch) =>
|
|
42
|
-
await this.branchBeforeCreate(appuser, data),
|
|
43
|
-
afterCreate: async (appuser: UserContext, data: Branch) =>
|
|
44
|
-
await this.branchAfterCreate(appuser, data),
|
|
45
|
-
};
|
|
46
|
-
protected foreignkeys = { organization: ['$.organization._id'] };
|
|
47
|
-
constructor(mydoc: Model<Branch>) {
|
|
48
|
-
super('BRANCH', 'branch', mydoc, IsolationType.org);
|
|
49
|
-
this.setSchema(BranchJsonSchema);
|
|
50
|
-
this.setData(DefaultBranch(crypto.randomUUID()));
|
|
51
|
-
this.addAutoCompleteField({
|
|
52
|
-
branchId: 'branchId',
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
reCalculateValue(data: Branch) {
|
|
57
|
-
//console.log('trigger new recalculate')
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/***************************** additional execute *****************************************/
|
|
61
|
-
async branchBeforeCreate(appuser: UserContext, data: Branch) {
|
|
62
|
-
const searchresult = await this.increament.runGenerateNextNo(
|
|
63
|
-
appuser,
|
|
64
|
-
'branch',
|
|
65
|
-
'branchId',
|
|
66
|
-
);
|
|
67
|
-
data.branchId = searchresult.nextno;
|
|
68
|
-
}
|
|
69
|
-
async branchAfterCreate(appuser: UserContext, data: Branch) {
|
|
70
|
-
await this.generateDefaultDocNumbers(appuser, data);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
generateDefaultDocNumbers = async (appuser, data) => {
|
|
74
|
-
const branchName = data.branchName;
|
|
75
|
-
const branchCode = data.branchCode;
|
|
76
|
-
const recordId = data._id;
|
|
77
|
-
const branchId = data.branchId;
|
|
78
|
-
const orgId = data.orgId;
|
|
79
|
-
const tenantId = data.tenantId;
|
|
80
|
-
const docformats = alldocuments.filter((item) => item.docNumber);
|
|
81
|
-
for (let i = 0; i < docformats.length; i++) {
|
|
82
|
-
const doc = docformats[i];
|
|
83
|
-
const pattern = doc.docNoPattern.replace('@BranchCode',branchCode);
|
|
84
|
-
const formatdata: Docnoformat = {
|
|
85
|
-
_id: crypto.randomUUID(),
|
|
86
|
-
docNoFormatNo: `${doc.docType}-${branchCode}`,
|
|
87
|
-
docNoFormatName: `Default ${doc.docType} - ${branchCode}`,
|
|
88
|
-
docNoType: doc.docType,
|
|
89
|
-
docNoPattern: pattern,
|
|
90
|
-
branch: { _id: recordId, branchId: branchId, label: branchName },
|
|
91
|
-
branchId: branchId,
|
|
92
|
-
orgId: orgId,
|
|
93
|
-
tenantId: tenantId,
|
|
94
|
-
nextNumber: 1,
|
|
95
|
-
} as Docnoformat;
|
|
96
|
-
try {
|
|
97
|
-
const result = await this.docnoservice.create(appuser, formatdata);
|
|
98
|
-
if (!result) {
|
|
99
|
-
throw new InternalServerErrorException(
|
|
100
|
-
`Generate default document number for "${branchCode}" failed. Pattern: ${pattern}`,
|
|
101
|
-
'generateDefaultDocNumbers',
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
} catch (err) {
|
|
105
|
-
this.logger.error(err);
|
|
106
|
-
throw new InternalServerErrorException(err);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-07-10
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
* Last Modified By: Yong Xiang
|
|
7
|
-
*/
|
|
8
|
-
import { UserContext } from '../commons/user.context';
|
|
9
|
-
import * as sharelibs from '../sharelibs';
|
|
10
|
-
import { Injectable,Inject } from '@nestjs/common';
|
|
11
|
-
import { InjectModel } from '@nestjs/mongoose';
|
|
12
|
-
import jsonpath from 'jsonpath';
|
|
13
|
-
import { Model } from 'mongoose';
|
|
14
|
-
import { DocnoformatJsonSchema } from '../jsonschemas/docno.jsonschema';
|
|
15
|
-
import { SimpleAppService } from './simpleapp.processor';
|
|
16
|
-
import { IsolationType } from '../types';
|
|
17
|
-
import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
|
|
18
|
-
import { DocnoformatBranch, Docnoformat } from '../types/docno.type';
|
|
19
|
-
import {
|
|
20
|
-
DefaultDocnoformatBranch,
|
|
21
|
-
DefaultDocnoformat,
|
|
22
|
-
} from '../defaults/docno.default';
|
|
23
|
-
|
|
24
|
-
@Injectable()
|
|
25
|
-
export class DocnoformatProcessor extends SimpleAppService<Docnoformat> {
|
|
26
|
-
protected strictIsolation = false;
|
|
27
|
-
protected documentIdentityCode = 'docNoFormatNo';
|
|
28
|
-
protected documentIdentityLabel = 'docNoFormatName';
|
|
29
|
-
|
|
30
|
-
protected foreignkeys = { branch: ['$.branch._id'] };
|
|
31
|
-
constructor(mydoc: Model<Docnoformat>) {
|
|
32
|
-
super('DOCNO', 'docnoformat', mydoc, IsolationType.org);
|
|
33
|
-
this.setSchema(DocnoformatJsonSchema);
|
|
34
|
-
this.setData(DefaultDocnoformat(crypto.randomUUID()));
|
|
35
|
-
this.addAutoCompleteField({
|
|
36
|
-
default: 'default',
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
reCalculateValue(data: Docnoformat) {
|
|
41
|
-
//console.log('trigger new recalculate')
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/***************************** additional execute *****************************************/
|
|
45
|
-
/**
|
|
46
|
-
* list document number format and prepare sample of docformat
|
|
47
|
-
* @param appuser
|
|
48
|
-
* @param doctype
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
async runListDocFormats(appuser: UserContext, doctype: string) {
|
|
52
|
-
doctype = doctype.toUpperCase();
|
|
53
|
-
const searchresult = await this.search(
|
|
54
|
-
appuser,
|
|
55
|
-
{ docNoType: doctype,'branch.branchId':appuser.getBranchId() },
|
|
56
|
-
undefined,
|
|
57
|
-
{default:'desc'}
|
|
58
|
-
);
|
|
59
|
-
//console.log('searchresult',searchresult);
|
|
60
|
-
let data: any = [];
|
|
61
|
-
for (let i = 0; i < searchresult.length; i++) {
|
|
62
|
-
const s = searchresult[i];
|
|
63
|
-
if (s.active && s.docNoPattern) {
|
|
64
|
-
data.push({
|
|
65
|
-
_id: s._id,
|
|
66
|
-
docNoFormatNo: s.docNoFormatNo,
|
|
67
|
-
docNoFormatName: s.docNoFormatName,
|
|
68
|
-
docNoPattern: s.docNoPattern,
|
|
69
|
-
nextNumber: s.nextNumber,
|
|
70
|
-
default: s.default,
|
|
71
|
-
sample: DocNumberFormatGenerator.previewDocNo(s),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
}
|