@simitgroup/simpleapp-generator 1.6.6-h-alpha → 1.6.6-j-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 +13 -1
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/webhook.d.ts.map +1 -1
- package/dist/buildinschemas/webhook.js +1 -0
- package/dist/buildinschemas/webhook.js.map +1 -1
- package/dist/buildinschemas/webhookhistory.d.ts +3 -0
- package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
- package/dist/buildinschemas/webhookhistory.js +44 -0
- package/dist/buildinschemas/webhookhistory.js.map +1 -0
- package/dist/createproject.js +138 -0
- package/dist/createproject.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +28 -3
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/index2.js +118 -0
- package/dist/index2.js.map +1 -0
- package/dist/installdependency.js +20 -0
- package/dist/installdependency.js.map +1 -0
- package/dist/installnest.js +2 -0
- package/dist/installnest.js.map +1 -0
- package/dist/installnuxt.js +2 -0
- package/dist/installnuxt.js.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/package.json +1 -1
- package/src/buildinschemas/webhook.ts +1 -0
- package/src/framework.ts +31 -4
- package/templates/basic/nest/controller.ts.eta +6 -5
- package/templates/basic/nest/resolver.ts.eta +4 -2
- package/templates/basic/nest/service.ts.eta +5 -2
- package/templates/nest/.env._eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +99 -107
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +3 -15
- package/templates/nuxt/assets/css/style.css._eta +74 -28
- package/templates/nuxt/components/calendar/CalendarInput.vue.eta +1 -1
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +7 -7
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +2 -3
- package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +3 -3
- package/templates/nuxt/components/header/button/task/HeaderButtonTaskList.vue.eta +2 -2
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +1 -1
- package/templates/nuxt/components/list/ListMessages.vue.eta +2 -2
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +3 -3
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +2 -2
- package/templates/nuxt/components/page/PageDocList.vue.eta +3 -3
- package/templates/nuxt/components/renderer/RendererDateAge.vue.eta +19 -0
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +4 -4
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +3 -3
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +2 -3
- package/templates/nuxt/components/simpleApp/SimpleAppJsonSchemaForm.vue.eta +2 -15
- package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +2 -2
- package/templates/nuxt/nuxt.config.ts._eta +6 -5
- package/templates/nuxt/pages/index.vue._eta +1 -1
- package/templates/nuxt/plugins/40.pusher.ts.eta +8 -2
- package/templates/nuxt/presets/lara/accordion/index.js +79 -0
- package/templates/nuxt/presets/lara/accordioncontent/index.js +3 -0
- package/templates/nuxt/presets/lara/accordionheader/index.js +11 -0
- package/templates/nuxt/presets/lara/accordionpanel/index.js +18 -0
- package/templates/nuxt/presets/lara/autocomplete/index.js +208 -0
- package/templates/nuxt/presets/lara/avatar/index.js +43 -0
- package/templates/nuxt/presets/lara/avatargroup/index.js +5 -0
- package/templates/nuxt/presets/lara/badge/index.js +47 -0
- package/templates/nuxt/presets/lara/badgedirective/index.js +43 -0
- package/templates/nuxt/presets/lara/blockui/index.js +4 -0
- package/templates/nuxt/presets/lara/breadcrumb/index.js +64 -0
- package/templates/nuxt/presets/lara/button/index.js +238 -0
- package/templates/nuxt/presets/lara/buttongroup/index.js +12 -0
- package/templates/nuxt/presets/lara/card/index.js +37 -0
- package/templates/nuxt/presets/lara/carousel/index.js +103 -0
- package/templates/nuxt/presets/lara/cascadeselect/index.js +199 -0
- package/templates/nuxt/presets/lara/checkbox/index.js +104 -0
- package/templates/nuxt/presets/lara/chip/index.js +42 -0
- package/templates/nuxt/presets/lara/colorpicker/index.js +123 -0
- package/templates/nuxt/presets/lara/confirmdialog/index.js +3 -0
- package/templates/nuxt/presets/lara/confirmpopup/index.js +56 -0
- package/templates/nuxt/presets/lara/contextmenu/index.js +126 -0
- package/templates/nuxt/presets/lara/datatable/index.js +403 -0
- package/templates/nuxt/presets/lara/dataview/index.js +28 -0
- package/templates/nuxt/presets/lara/datepicker/index.js +435 -0
- package/templates/nuxt/presets/lara/deferred/index.js +3 -0
- package/templates/nuxt/presets/lara/dialog/index.js +148 -0
- package/templates/nuxt/presets/lara/divider/index.js +67 -0
- package/templates/nuxt/presets/lara/dock/index.js +86 -0
- package/templates/nuxt/presets/lara/drawer/index.js +149 -0
- package/templates/nuxt/presets/lara/fieldset/index.js +84 -0
- package/templates/nuxt/presets/lara/fileupload/index.js +95 -0
- package/templates/nuxt/presets/lara/floatlabel/index.js +26 -0
- package/templates/nuxt/presets/lara/galleria/index.js +308 -0
- package/templates/nuxt/presets/lara/global.js +90 -0
- package/templates/nuxt/presets/lara/iconfield/index.js +27 -0
- package/templates/nuxt/presets/lara/image/index.js +206 -0
- package/templates/nuxt/presets/lara/index.js +234 -0
- package/templates/nuxt/presets/lara/inplace/index.js +27 -0
- package/templates/nuxt/presets/lara/inputgroup/index.js +5 -0
- package/templates/nuxt/presets/lara/inputgroupaddon/index.js +28 -0
- package/templates/nuxt/presets/lara/inputmask/index.js +39 -0
- package/templates/nuxt/presets/lara/inputnumber/index.js +167 -0
- package/templates/nuxt/presets/lara/inputotp/index.js +10 -0
- package/templates/nuxt/presets/lara/inputswitch/index.js +80 -0
- package/templates/nuxt/presets/lara/inputtext/index.js +54 -0
- package/templates/nuxt/presets/lara/knob/index.js +44 -0
- package/templates/nuxt/presets/lara/listbox/index.js +117 -0
- package/templates/nuxt/presets/lara/megamenu/index.js +198 -0
- package/templates/nuxt/presets/lara/menu/index.js +96 -0
- package/templates/nuxt/presets/lara/menubar/index.js +176 -0
- package/templates/nuxt/presets/lara/message/index.js +92 -0
- package/templates/nuxt/presets/lara/metergroup/index.js +96 -0
- package/templates/nuxt/presets/lara/multiselect/index.js +201 -0
- package/templates/nuxt/presets/lara/orderlist/index.js +13 -0
- package/templates/nuxt/presets/lara/organizationchart/index.js +137 -0
- package/templates/nuxt/presets/lara/overlaybadge/index.js +18 -0
- package/templates/nuxt/presets/lara/paginator/index.js +178 -0
- package/templates/nuxt/presets/lara/panel/index.js +91 -0
- package/templates/nuxt/presets/lara/panelmenu/index.js +127 -0
- package/templates/nuxt/presets/lara/password/index.js +72 -0
- package/templates/nuxt/presets/lara/picklist/index.js +52 -0
- package/templates/nuxt/presets/lara/popover/index.js +31 -0
- package/templates/nuxt/presets/lara/progressbar/index.js +55 -0
- package/templates/nuxt/presets/lara/progressspinner/index.js +51 -0
- package/templates/nuxt/presets/lara/radiobutton/index.js +104 -0
- package/templates/nuxt/presets/lara/rating/index.js +63 -0
- package/templates/nuxt/presets/lara/ripple/index.js +6 -0
- package/templates/nuxt/presets/lara/scrollpanel/index.js +77 -0
- package/templates/nuxt/presets/lara/scrolltop/index.js +26 -0
- package/templates/nuxt/presets/lara/select/index.js +240 -0
- package/templates/nuxt/presets/lara/selectbutton/index.js +16 -0
- package/templates/nuxt/presets/lara/skeleton/index.js +16 -0
- package/templates/nuxt/presets/lara/slider/index.js +137 -0
- package/templates/nuxt/presets/lara/speeddial/index.js +57 -0
- package/templates/nuxt/presets/lara/splitbutton/index.js +19 -0
- package/templates/nuxt/presets/lara/splitter/index.js +61 -0
- package/templates/nuxt/presets/lara/splitterpanel/index.js +5 -0
- package/templates/nuxt/presets/lara/step/index.js +62 -0
- package/templates/nuxt/presets/lara/stepitem/index.js +11 -0
- package/templates/nuxt/presets/lara/steplist/index.js +3 -0
- package/templates/nuxt/presets/lara/steppanels/index.js +3 -0
- package/templates/nuxt/presets/lara/stepper/index.js +13 -0
- package/templates/nuxt/presets/lara/steps/index.js +111 -0
- package/templates/nuxt/presets/lara/tab/index.js +42 -0
- package/templates/nuxt/presets/lara/tablist/index.js +8 -0
- package/templates/nuxt/presets/lara/tabmenu/index.js +73 -0
- package/templates/nuxt/presets/lara/tabpanel/index.js +3 -0
- package/templates/nuxt/presets/lara/tabpanels/index.js +3 -0
- package/templates/nuxt/presets/lara/tabs/index.js +5 -0
- package/templates/nuxt/presets/lara/tabview/index.js +156 -0
- package/templates/nuxt/presets/lara/tag/index.js +38 -0
- package/templates/nuxt/presets/lara/terminal/index.js +60 -0
- package/templates/nuxt/presets/lara/textarea/index.js +39 -0
- package/templates/nuxt/presets/lara/tieredmenu/index.js +121 -0
- package/templates/nuxt/presets/lara/timeline/index.js +81 -0
- package/templates/nuxt/presets/lara/toast/index.js +102 -0
- package/templates/nuxt/presets/lara/togglebutton/index.js +45 -0
- package/templates/nuxt/presets/lara/toggleswitch/index.js +80 -0
- package/templates/nuxt/presets/lara/toolbar/index.js +28 -0
- package/templates/nuxt/presets/lara/tooltip/index.js +46 -0
- package/templates/nuxt/presets/lara/tree/index.js +101 -0
- package/templates/nuxt/presets/lara/treeselect/index.js +102 -0
- package/templates/nuxt/presets/lara/treetable/index.js +305 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +2 -16
- package/templates/nuxt/tailwind.config.ts._eta +4 -15
- package/templates/project/sharelibs/validate.ts.eta +23 -0
- /package/templates/nuxt/components/image/{ImageAvatar.vue.eta._vue → ImageAvatar.vue.eta} +0 -0
- /package/templates/nuxt/components/image/{ImageOrganization.vue.eta.vue → ImageOrganization.vue.eta} +0 -0
- /package/templates/nuxt/components/image/{ImageToBase64Uploader.vue.eta.vue → ImageToBase64Uploader.vue.eta} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simplemasterdata = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
exports.simplemasterdata = {
|
|
6
|
+
type: "object",
|
|
7
|
+
"x-simpleapp-config": {
|
|
8
|
+
isolationType: type_1.IsolationType.org,
|
|
9
|
+
pageType: "crud",
|
|
10
|
+
schemaType: type_1.SupportedSchemaType.simplemasterdata,
|
|
11
|
+
documentType: '',
|
|
12
|
+
documentName: '',
|
|
13
|
+
},
|
|
14
|
+
properties: {
|
|
15
|
+
_id: { type: 'string' },
|
|
16
|
+
tenantId: { type: 'integer', default: 1, description: "system field" },
|
|
17
|
+
orgId: { type: 'integer', default: 1, description: "system field" },
|
|
18
|
+
branchId: { type: 'integer', default: 1, description: "system field" },
|
|
19
|
+
created: { type: 'string', description: "system field" },
|
|
20
|
+
updated: { type: 'string', description: "system field" },
|
|
21
|
+
createdby: { type: 'string', description: "system field" },
|
|
22
|
+
updatedby: { type: 'string', description: "system field" },
|
|
23
|
+
},
|
|
24
|
+
definitions: {
|
|
25
|
+
foreignkey: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: { _id: { "type": "string" }, label: { "type": "string" }, code: { "type": "string" } }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=simplemasterdata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplemasterdata.js","sourceRoot":"","sources":["../../src/schematype/simplemasterdata.ts"],"names":[],"mappings":";;;AAAA,kCAAoE;AACvD,QAAA,gBAAgB,GAAc;IACvC,IAAI,EAAC,QAAQ;IACb,oBAAoB,EAAC;QACnB,aAAa,EAAE,oBAAa,CAAC,GAAG;QAChC,QAAQ,EAAC,MAAM;QACf,UAAU,EAAE,0BAAmB,CAAC,gBAAgB;QAChD,YAAY,EAAC,EAAE;QACf,YAAY,EAAC,EAAE;KAChB;IACD,UAAU,EAAC;QACP,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACnB,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,KAAK,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC3D,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QACpD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;KACtD;IACD,WAAW,EAAC;QACX,UAAU,EAAE;YACV,IAAI,EAAC,QAAQ;YACb,UAAU,EAAE,EAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,IAAI,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC;SACzF;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transaction = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
exports.transaction = {
|
|
6
|
+
type: "object",
|
|
7
|
+
"x-simpleapp-config": {
|
|
8
|
+
isolationType: type_1.IsolationType.org,
|
|
9
|
+
requiredRoles: [],
|
|
10
|
+
documentType: '',
|
|
11
|
+
documentName: '',
|
|
12
|
+
pageType: "crud",
|
|
13
|
+
uniqueKey: "documentNo",
|
|
14
|
+
documentTitle: "documentTitle",
|
|
15
|
+
generateDocumentNumber: true,
|
|
16
|
+
documentDate: "documentDate",
|
|
17
|
+
allStatus: [
|
|
18
|
+
{ "status": "D", statusName: "Draft", "readOnly": true, "actions": ["confirm", "void"] },
|
|
19
|
+
{ "status": "CO", statusName: "Confirmed", "readOnly": true, "actions": ["revert", "void"] },
|
|
20
|
+
{ "status": "V", statusName: "Void", "readOnly": true, "actions": ["revert"] },
|
|
21
|
+
],
|
|
22
|
+
additionalApis: [{
|
|
23
|
+
action: "confirm",
|
|
24
|
+
entrypoint: ":id/confirm",
|
|
25
|
+
requiredrole: [],
|
|
26
|
+
method: type_1.RESTMethods.post,
|
|
27
|
+
execute: "setDocumentStatus",
|
|
28
|
+
description: "confirm document and change status to CO"
|
|
29
|
+
}, {
|
|
30
|
+
action: "void",
|
|
31
|
+
entrypoint: ":id/void",
|
|
32
|
+
querypara: ["reason"],
|
|
33
|
+
requiredrole: [],
|
|
34
|
+
method: type_1.RESTMethods.post,
|
|
35
|
+
execute: "setDocumentStatus",
|
|
36
|
+
description: "confirm document and change status to V"
|
|
37
|
+
}, {
|
|
38
|
+
action: "revert",
|
|
39
|
+
entrypoint: ":id/revert",
|
|
40
|
+
requiredrole: [],
|
|
41
|
+
method: type_1.RESTMethods.post,
|
|
42
|
+
execute: "setDocumentStatus",
|
|
43
|
+
description: "revert document and change status to D"
|
|
44
|
+
}],
|
|
45
|
+
// simple => pure model and service(no page,api),
|
|
46
|
+
// default => force masterdata property,
|
|
47
|
+
// transaction => force masterdata property
|
|
48
|
+
schemaType: type_1.SupportedSchemaType.transaction,
|
|
49
|
+
},
|
|
50
|
+
properties: {
|
|
51
|
+
_id: { type: 'string', description: "system field" },
|
|
52
|
+
tenantId: { type: 'integer', default: 1, description: "system field" },
|
|
53
|
+
orgId: { type: 'integer', default: 1, description: "system field" },
|
|
54
|
+
branchId: { type: 'integer', default: 1, description: "system field" },
|
|
55
|
+
created: { type: 'string', description: "system field" },
|
|
56
|
+
updated: { type: 'string', description: "system field" },
|
|
57
|
+
createdby: { type: 'string', description: "system field" },
|
|
58
|
+
updatedby: { type: 'string', description: "system field" },
|
|
59
|
+
docNoFormat: {
|
|
60
|
+
type: "object",
|
|
61
|
+
"x-foreignkey": "docnoformat",
|
|
62
|
+
properties: { _id: { "type": "string" }, label: { "type": "string" } },
|
|
63
|
+
description: "system field"
|
|
64
|
+
},
|
|
65
|
+
docStatus: { type: "string", description: "system field" }
|
|
66
|
+
},
|
|
67
|
+
definitions: {
|
|
68
|
+
foreignkey: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: { _id: { "type": "string" }, label: { "type": "string" }, code: { "type": "string" } }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/schematype/transaction.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
package/src/framework.ts
CHANGED
|
@@ -4,6 +4,7 @@ import _ from 'lodash'
|
|
|
4
4
|
import { Logger, ILogObj } from "tslog";
|
|
5
5
|
import * as constants from './constant'
|
|
6
6
|
import {Eta} from 'eta';
|
|
7
|
+
import path from 'path';
|
|
7
8
|
const log: Logger<ILogObj> = new Logger();
|
|
8
9
|
|
|
9
10
|
let config = {
|
|
@@ -76,7 +77,7 @@ export const prepareNest = (callback:Function)=>{
|
|
|
76
77
|
|
|
77
78
|
//@nestjs/graphql @nestjs/apollo graphql apollo-server-express apollo-server-core
|
|
78
79
|
//@nestjs/graphql graphql-tools graphql apollo-server-express
|
|
79
|
-
exec(`cd ${targetfolder};pnpm install --save @nestjs/graphql country-to-currency graphql-type-json countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
|
|
80
|
+
exec(`cd ${targetfolder};pnpm install --save @nestjs/graphql mustache country-to-currency graphql-type-json countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
|
|
80
81
|
// log.info(`dependency installed`)
|
|
81
82
|
if(!error){
|
|
82
83
|
// fs.mkdirSync(`${targetfolder}/public_html`,{recursive:true})
|
|
@@ -164,11 +165,37 @@ export const prepareNuxt = (callback:Function)=>{
|
|
|
164
165
|
const targetfolder = config.frontendFolder
|
|
165
166
|
if(!fs.existsSync(`${targetfolder}/.env`)){
|
|
166
167
|
//asume no environment. prepare now
|
|
167
|
-
exec(`cd ${targetfolder};pnpm install;pnpm install -D @nuxtjs/apollo@next dayjs-nuxt @nuxtjs/device @nuxtjs/color-mode @types/json-schema @nuxtjs/i18n@next
|
|
168
|
+
exec(`cd ${targetfolder};pnpm install;pnpm install -D @nuxtjs/apollo@next dayjs-nuxt @nuxtjs/device @nuxtjs/color-mode @types/json-schema @nuxtjs/i18n@next @nuxtjs/tailwindcss @types/jsonpath @sidebase/nuxt-auth @types/node @vueuse/nuxt @sidebase/nuxt-auth @vueuse/core prettier @primevue/core primevue tailwindcss-primeui`, (error, stdout, stderr)=>{
|
|
168
169
|
//;pnpm install
|
|
169
170
|
console.log(error, stdout, stderr)
|
|
170
|
-
exec(`cd ${targetfolder};pnpm install --save vue-camera-lib vue-pdf-embed dayjs pusher-js country-code-dateformat chart.js tailwind-merge @iconify-json/heroicons json-schema @vueuse/core ts-md5 primeicons memory-cache jsonpath pinia @pinia/nuxt @nuxt/kit lodash @types/lodash @darkwolf/base64url next-auth@4.21.1 @darkwolf/base64url @nuxt/ui ajv ajv-formats ajv-errors dotenv @fullcalendar/core @fullcalendar/vue3 quill prettier axios json-schema mitt `, (error, stdout, stderr)=>{
|
|
171
|
-
|
|
171
|
+
exec(`cd ${targetfolder};pnpm install --save vue-camera-lib vue-pdf-embed dayjs pusher-js country-code-dateformat chart.js tailwind-merge @iconify-json/heroicons json-schema @vueuse/core ts-md5 primeicons memory-cache jsonpath pinia @pinia/nuxt @nuxt/kit lodash @types/lodash @darkwolf/base64url next-auth@4.21.1 @darkwolf/base64url @nuxt/ui ajv ajv-formats ajv-errors dotenv @fullcalendar/core @fullcalendar/vue3 quill prettier axios json-schema mitt @primevue/nuxt-module lru-cache vue-advanced-cropper@vue-3`, (error, stdout, stderr)=> {
|
|
172
|
+
console.log(error, stdout, stderr)
|
|
173
|
+
|
|
174
|
+
// copy nuxt primevue tailwind preset to folder
|
|
175
|
+
const copyFolderRecursiveSync = (source: string, target: string) => {
|
|
176
|
+
// Check if folder needs to be created or integrated
|
|
177
|
+
const targetFolder = path.join(target, path.basename(source));
|
|
178
|
+
if (!fs.existsSync(targetFolder)) {
|
|
179
|
+
fs.mkdirSync(targetFolder, { recursive: true });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Copy
|
|
183
|
+
if (fs.lstatSync(source).isDirectory()) {
|
|
184
|
+
const files = fs.readdirSync(source);
|
|
185
|
+
files.forEach((file) => {
|
|
186
|
+
const curSource = path.join(source, file);
|
|
187
|
+
if (fs.lstatSync(curSource).isDirectory()) {
|
|
188
|
+
copyFolderRecursiveSync(curSource, targetFolder);
|
|
189
|
+
} else {
|
|
190
|
+
fs.copyFileSync(curSource, path.join(targetFolder, file));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// Define source and target folders
|
|
197
|
+
const sourceFolder = path.join(constants.templatedir, 'nuxt', 'presets');
|
|
198
|
+
copyFolderRecursiveSync(sourceFolder, config.frontendFolder);
|
|
172
199
|
|
|
173
200
|
// fs.mkdirSync(`${targetfolder}/assets/css/`,{recursive:true})
|
|
174
201
|
// fs.mkdirSync(`${targetfolder}/layouts`,{recursive:true})
|
|
@@ -36,8 +36,9 @@ import {AppUser} from '../commons/decorators/appuser.decorator'
|
|
|
36
36
|
import {UserContext} from '../commons/user.context'
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
<% const getFieldType =(proptype, typename)=>{
|
|
39
|
+
<% const getFieldType =(proptype, typename,actionname)=>{
|
|
40
40
|
const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
|
|
41
|
+
if(!typename) throw actionname +" undefine schema";
|
|
41
42
|
let tmptypename = typename.replace('[','').replace(']','')
|
|
42
43
|
|
|
43
44
|
if(systemtypes.includes(tmptypename)){
|
|
@@ -192,12 +193,12 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
192
193
|
<%}%>
|
|
193
194
|
<% if(['post','put','patch'].includes(api.method)){ %>
|
|
194
195
|
@ApiBody({ description: 'Request Body',
|
|
195
|
-
type: <%= getFieldType('schema',api.schema)%>
|
|
196
|
+
type: <%= getFieldType('schema',api.schema,api.action)%>
|
|
196
197
|
|
|
197
198
|
})
|
|
198
199
|
<%}%>
|
|
199
200
|
@ApiResponse({status: 200,description: '<%=api.description%>'
|
|
200
|
-
,type: <%= getFieldType('schema',api.responseType)%>
|
|
201
|
+
,type: <%= getFieldType('schema',api.responseType,api.action)%>
|
|
201
202
|
})
|
|
202
203
|
@ApiOperation({ operationId: 'run<%=capitalizeFirstLetter(api.action)%>' })
|
|
203
204
|
<% if(api.queryPara && api.queryPara.length>0) {%>
|
|
@@ -208,7 +209,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
208
209
|
async <%=capitalizeFirstLetter(api.action) %>(
|
|
209
210
|
@AppUser() appuser: UserContext,
|
|
210
211
|
<%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
|
|
211
|
-
@Body() data:<%= getFieldType('type',api.schema)%>,
|
|
212
|
+
@Body() data:<%= getFieldType('type',api.schema,api.action)%>,
|
|
212
213
|
//@Body() data:any,
|
|
213
214
|
<%}%>
|
|
214
215
|
<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
@@ -230,7 +231,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
230
231
|
){
|
|
231
232
|
|
|
232
233
|
|
|
233
|
-
const res:<%= getFieldType('type',api.responseType)%> = await this.service.run<%=capitalizeFirstLetter(api.action)%>(appuser,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
234
|
+
const res:<%= getFieldType('type',api.responseType,api.action)%> = await this.service.run<%=capitalizeFirstLetter(api.action)%>(appuser,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
234
235
|
<%let subpath = api.entryPoint.split('/')%>
|
|
235
236
|
<% for(let a=0;a<subpath.length;a++){%>
|
|
236
237
|
<%const partstr = subpath[a]%>
|
|
@@ -14,8 +14,10 @@ import { Role } from '../commons/roles/roles.enum';
|
|
|
14
14
|
|
|
15
15
|
import { Request } from '@nestjs/common';
|
|
16
16
|
|
|
17
|
-
<% const getFieldType =(proptype, typename)=>{
|
|
17
|
+
<% const getFieldType =(proptype, typename,actionname)=>{
|
|
18
18
|
const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
|
|
19
|
+
if(!typename) throw actionname +" undefine schema";
|
|
20
|
+
|
|
19
21
|
let tmptypename = typename.replace('[','').replace(']','')
|
|
20
22
|
|
|
21
23
|
if(systemtypes.includes(tmptypename)){
|
|
@@ -89,7 +91,7 @@ export class <%= it.typename %>Resolver {
|
|
|
89
91
|
<%}%>
|
|
90
92
|
)
|
|
91
93
|
<%}%>
|
|
92
|
-
@Query(()=> <%= getFieldType('schema',api.responseType)%>)
|
|
94
|
+
@Query(()=> <%= getFieldType('schema',api.responseType,api.action)%>)
|
|
93
95
|
|
|
94
96
|
|
|
95
97
|
|
|
@@ -13,8 +13,11 @@ import { <%= it.typename %>Processor } from '../generate/processors/<%= it.docty
|
|
|
13
13
|
//import { <%= it.typename %>,<%= it.typename %>Hooks} from '../generate/types';
|
|
14
14
|
import * as types from '../generate/types';
|
|
15
15
|
export { <%= it.typename %>} from '../generate/types';
|
|
16
|
-
<% const getFieldType =(proptype, typename)=>{
|
|
16
|
+
<% const getFieldType =(proptype, typename,actionname)=>{
|
|
17
17
|
const systemtypes = ['Boolean','boolean','string','String','number','Number','object','Object','integer','Integer']
|
|
18
|
+
console.log("run service typename----",typename)
|
|
19
|
+
if(!typename) throw actionname +" undefine schema";
|
|
20
|
+
|
|
18
21
|
let tmptypename = typename.replace('[','').replace(']','')
|
|
19
22
|
|
|
20
23
|
if(systemtypes.includes(tmptypename)){
|
|
@@ -69,7 +72,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
|
|
|
69
72
|
<%}%>
|
|
70
73
|
|
|
71
74
|
<%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
|
|
72
|
-
data:<%= getFieldType('schema',api.schema)%>,
|
|
75
|
+
data:<%= getFieldType('schema',api.schema,api.action)%>,
|
|
73
76
|
<%}%>
|
|
74
77
|
|
|
75
78
|
){
|
package/templates/nest/.env._eta
CHANGED
|
@@ -69,9 +69,9 @@ export class TenantMiddleware implements NestMiddleware {
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
//if APIKEY defined, and there is api key and secret supplied. use robot user
|
|
72
|
-
if(process.env.
|
|
72
|
+
if(process.env.X_API_KEY &&req.headers['x-api-key'] && req.headers['x-api-secret']){
|
|
73
73
|
|
|
74
|
-
if(req.headers['x-api-key']==process.env.
|
|
74
|
+
if(req.headers['x-api-key']==process.env.X_API_KEY &&
|
|
75
75
|
req.headers['x-api-secret']==process.env.X_API_SECRET){
|
|
76
76
|
|
|
77
77
|
u.setAsStaticUser(
|
|
@@ -11,27 +11,22 @@ import {
|
|
|
11
11
|
Webhook,
|
|
12
12
|
WebhookService,
|
|
13
13
|
} from 'src/simpleapp/services/webhook.service';
|
|
14
|
-
import {alldocuments} from 'src/simpleapp/generate/commons/dicts/documents'
|
|
14
|
+
import { alldocuments } from 'src/simpleapp/generate/commons/dicts/documents';
|
|
15
15
|
|
|
16
16
|
@Injectable()
|
|
17
17
|
export class RunWebhookService {
|
|
18
|
-
private webhookApiKey = process.env.WEBHOOK_SERVER_APIKEY
|
|
19
|
-
private webhookAppId=process.env.WEBHOOK_SERVER_APP_ID
|
|
18
|
+
private webhookApiKey = process.env.WEBHOOK_SERVER_APIKEY;
|
|
19
|
+
private webhookAppId = process.env.WEBHOOK_SERVER_APP_ID;
|
|
20
20
|
private webhookurl = process.env.WEBHOOK_SERVER_URL;
|
|
21
|
-
private webhookprefix = process.env.PROJECT_CODE+'.'
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private webhooksync:boolean = process.env.WEBHOOKER_SYNC_EVENTTYPE=='true'
|
|
21
|
+
private webhookprefix = process.env.PROJECT_CODE + '.';
|
|
22
|
+
private webhookeventurl = `${process.env.WEBHOOK_SERVER_URL}/event/`;
|
|
23
|
+
private webhookeventtypeurl = `${process.env.WEBHOOK_SERVER_URL}/event_types/`;
|
|
24
|
+
private webhooksync: boolean = process.env.WEBHOOKER_SYNC_EVENTTYPE == 'true';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
public constructor(
|
|
29
|
-
private webhookService: WebhookService,
|
|
30
|
-
) {
|
|
31
|
-
if(this.webhooksync) this.syncEventTypes()
|
|
26
|
+
public constructor(private webhookService: WebhookService) {
|
|
27
|
+
if (this.webhooksync) this.syncEventTypes();
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
|
|
35
30
|
@OnEvent('webhook')
|
|
36
31
|
async loadWebhook(
|
|
37
32
|
appuser: UserContext,
|
|
@@ -39,18 +34,16 @@ export class RunWebhookService {
|
|
|
39
34
|
actionName: string,
|
|
40
35
|
data?: any,
|
|
41
36
|
) {
|
|
42
|
-
|
|
43
37
|
//no webhook server implemented
|
|
44
|
-
if(!this.webhookApiKey) return true
|
|
45
|
-
|
|
38
|
+
if (!this.webhookApiKey) return true;
|
|
46
39
|
|
|
47
40
|
const filter = {
|
|
48
|
-
eventTypes: documentName + '.' + actionName
|
|
41
|
+
eventTypes: documentName + '.' + actionName,
|
|
49
42
|
active: true,
|
|
50
|
-
}
|
|
51
|
-
console.log(
|
|
43
|
+
};
|
|
44
|
+
console.log('Load webhook', documentName, actionName, filter);
|
|
52
45
|
const webhooks = await this.webhookService.search(appuser, filter);
|
|
53
|
-
console.log(
|
|
46
|
+
console.log('Loaded webhook', webhooks);
|
|
54
47
|
if (webhooks.length == 0) return;
|
|
55
48
|
|
|
56
49
|
for (let i = 0; i < webhooks.length; i++) {
|
|
@@ -74,128 +67,127 @@ export class RunWebhookService {
|
|
|
74
67
|
webhook: Webhook,
|
|
75
68
|
documentName: string,
|
|
76
69
|
actionName: string,
|
|
77
|
-
|
|
70
|
+
oridata: any,
|
|
78
71
|
) {
|
|
79
|
-
|
|
80
72
|
const headers = {};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
headers
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
73
|
+
|
|
74
|
+
try{
|
|
75
|
+
|
|
76
|
+
console.log('Run webhook ', documentName, actionName);
|
|
77
|
+
const Mustache = require('mustache');
|
|
78
|
+
const data = Mustache.render(webhook.body,oridata)
|
|
79
|
+
if (Array.isArray(webhook.headers)) {
|
|
80
|
+
webhook.headers.forEach((h) => {
|
|
81
|
+
headers[h.name] = h.value;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
headers['accept'] = 'application/json';
|
|
85
|
+
headers['content-type'] = 'application/json';
|
|
86
|
+
headers['Authorization'] = this.webhookApiKey;
|
|
87
|
+
const eventname = `${this.webhookprefix}${documentName}.${actionName}`;
|
|
88
|
+
const options = {
|
|
89
|
+
method: webhook.requestMethod.toUpperCase(),
|
|
90
|
+
headers: headers,
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
labels: {
|
|
93
|
+
tenantId: appuser.getTenantId().toString(),
|
|
94
|
+
},
|
|
95
|
+
metadata: {
|
|
96
|
+
src: process.env.PROJECT_NAME,
|
|
97
|
+
user: appuser.getFullname(),
|
|
98
|
+
},
|
|
99
|
+
application_id: this.webhookAppId,
|
|
100
|
+
event_type: eventname,
|
|
101
|
+
event_id: crypto.randomUUID(),
|
|
102
|
+
occurred_at: new Date().toISOString(),
|
|
103
|
+
payload: data, //JSON.stringify(),
|
|
104
|
+
payload_content_type: 'application/json',
|
|
105
|
+
}),
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
console.log('webhook request ', this.webhookeventurl, options);
|
|
113
109
|
const req = await fetch(this.webhookeventurl, options);
|
|
114
110
|
const statusCode = req.status;
|
|
115
|
-
if(statusCode>=300){
|
|
116
|
-
throw new InternalServerErrorException(
|
|
111
|
+
if (statusCode >= 300) {
|
|
112
|
+
throw new InternalServerErrorException(
|
|
113
|
+
`create event ${eventname} failed to webhook server`,
|
|
114
|
+
);
|
|
117
115
|
}
|
|
118
|
-
|
|
116
|
+
|
|
119
117
|
// const body = req.body;
|
|
120
118
|
} catch (e) {
|
|
121
|
-
return e
|
|
119
|
+
return e;
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
async syncEventTypes(){
|
|
123
|
+
async syncEventTypes() {
|
|
128
124
|
const options = {
|
|
129
|
-
method: 'GET',
|
|
125
|
+
method: 'GET',
|
|
130
126
|
headers: {
|
|
131
127
|
accept: 'application/json',
|
|
132
|
-
Authorization: this.webhookApiKey
|
|
133
|
-
}
|
|
128
|
+
Authorization: this.webhookApiKey,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
134
131
|
// {
|
|
135
132
|
// "service_name": "billing",
|
|
136
133
|
// "resource_type_name": "invoice",
|
|
137
134
|
// "verb_name": "documentno",
|
|
138
135
|
// "event_type_name": "billing.invoice.documentno"
|
|
139
136
|
// },
|
|
140
|
-
try{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
137
|
+
try {
|
|
138
|
+
const res = await fetch(
|
|
139
|
+
`${this.webhookeventtypeurl}?application_id=${this.webhookAppId}`,
|
|
140
|
+
options,
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const locallist = this.getSchemaEventTypes();
|
|
144
|
+
const eventlist = (await res.json()).map((item) => item.event_type_name);
|
|
145
|
+
|
|
146
|
+
for (let i = 0; i < locallist.length; i++) {
|
|
147
|
+
const item = locallist[i];
|
|
148
|
+
if (!eventlist.includes(item)) {
|
|
149
|
+
//create remote event type
|
|
150
|
+
await this.createEventType(item);
|
|
151
|
+
}
|
|
155
152
|
}
|
|
153
|
+
} catch (e) {
|
|
154
|
+
throw new InternalServerErrorException(e);
|
|
156
155
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}catch(e){
|
|
160
|
-
throw new InternalServerErrorException(e)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
156
|
}
|
|
165
157
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const para = eventname.split('.')
|
|
158
|
+
async createEventType(eventname: string) {
|
|
159
|
+
const para = eventname.split('.');
|
|
169
160
|
const options = {
|
|
170
161
|
method: 'POST',
|
|
171
162
|
headers: {
|
|
172
163
|
accept: 'application/json',
|
|
173
164
|
'content-type': 'application/json',
|
|
174
|
-
Authorization: this.webhookApiKey
|
|
165
|
+
Authorization: this.webhookApiKey,
|
|
175
166
|
},
|
|
176
167
|
body: JSON.stringify({
|
|
177
168
|
application_id: this.webhookAppId,
|
|
178
169
|
resource_type: para[0],
|
|
179
170
|
service: para[1],
|
|
180
|
-
verb: para[2]
|
|
181
|
-
})
|
|
171
|
+
verb: para[2],
|
|
172
|
+
}),
|
|
182
173
|
};
|
|
183
174
|
|
|
184
|
-
await fetch(this.webhookeventtypeurl, options)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
175
|
+
await fetch(this.webhookeventtypeurl, options);
|
|
176
|
+
// .then(response => response.json())
|
|
177
|
+
// .then(response => console.log(response))
|
|
178
|
+
// .catch(err => console.error(err));
|
|
188
179
|
}
|
|
189
|
-
getSchemaEventTypes(){
|
|
190
|
-
const alleventtypes:string[] = []
|
|
191
|
-
alldocuments
|
|
192
|
-
.
|
|
193
|
-
|
|
180
|
+
getSchemaEventTypes() {
|
|
181
|
+
const alleventtypes: string[] = [];
|
|
182
|
+
alldocuments
|
|
183
|
+
.filter((item) => Array.isArray(item.webhook))
|
|
184
|
+
.forEach((item) => {
|
|
185
|
+
item.webhook.forEach((h) => {
|
|
194
186
|
alleventtypes.push(
|
|
195
|
-
`${this.webhookprefix}${item.docName.toLowerCase()}.${h}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
187
|
+
`${this.webhookprefix}${item.docName.toLowerCase()}.${h}`,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
return alleventtypes;
|
|
200
192
|
}
|
|
201
193
|
}
|
|
@@ -525,7 +525,7 @@ export class UserContext {
|
|
|
525
525
|
this.logger.log(result, 'accept invitation 1');
|
|
526
526
|
//set permission of all user under this.user_id
|
|
527
527
|
const updateresult = await this.permmodel
|
|
528
|
-
.updateMany({ uid: '',
|
|
528
|
+
.updateMany({ uid: '', userId: res._id }, { uid: this.getUid() })
|
|
529
529
|
.session(this.dbsession);
|
|
530
530
|
this.logger.log(updateresult, 'update all permission');
|
|
531
531
|
return true;
|
|
@@ -534,7 +534,7 @@ export class UserContext {
|
|
|
534
534
|
.deleteOne({ _id: id })
|
|
535
535
|
.session(this.dbsession);
|
|
536
536
|
await this.permmodel
|
|
537
|
-
.deleteMany({ uid: '',
|
|
537
|
+
.deleteMany({ uid: '', userId: res._id })
|
|
538
538
|
.session(this.dbsession);
|
|
539
539
|
return true;
|
|
540
540
|
}
|
|
@@ -20,9 +20,7 @@ import {
|
|
|
20
20
|
FilterQuery,
|
|
21
21
|
ProjectionType,
|
|
22
22
|
} from 'mongoose';
|
|
23
|
-
import
|
|
24
|
-
import addFormats from 'ajv-formats';
|
|
25
|
-
import addErrors from 'ajv-errors';
|
|
23
|
+
import { getValidateService } from 'src/simpleapp/generate/sharelibs/validate';
|
|
26
24
|
import {
|
|
27
25
|
NotFoundException,
|
|
28
26
|
HttpException,
|
|
@@ -461,18 +459,8 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
461
459
|
}
|
|
462
460
|
};
|
|
463
461
|
async validateData(appuser: UserContext, data: T, _id?: string) {
|
|
464
|
-
const ajv =
|
|
465
|
-
|
|
466
|
-
addErrors(ajv);
|
|
467
|
-
|
|
468
|
-
ajv.addFormat('tel', /^$|^\d{7,15}$/gm);
|
|
469
|
-
ajv.addFormat('text', /.*$/);
|
|
470
|
-
ajv.addFormat('html', /.*$/);
|
|
471
|
-
ajv.addFormat('documentno', /.*$/);
|
|
472
|
-
ajv.addFormat('money', /.*$/);
|
|
473
|
-
|
|
474
|
-
ajv.addKeyword({ keyword: 'x-foreignkey', schemaType: 'string' });
|
|
475
|
-
ajv.addKeyword({ keyword: 'x-simpleapp-config', schemaType: 'object' });
|
|
462
|
+
const ajv = getValidateService();
|
|
463
|
+
|
|
476
464
|
this.logger.debug('run hook during validation');
|
|
477
465
|
let issuccess = true;
|
|
478
466
|
if (this.hooks.beforeValidation) {
|