@simitgroup/simpleapp-generator 1.0.21 → 1.0.23
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/README copy.md +882 -0
- package/README.md +53 -824
- package/definations/category.cat.jsonschema.json +11 -13
- package/definations/level.lvl.jsonschema.json +48 -0
- package/definations/product.prd.jsonschema.json +8 -2
- package/dist/framework.js +42 -23
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +3 -3
- package/dist/generate.js.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/openapitools.json +7 -0
- package/package.json +1 -1
- package/sampleconfig.json +3 -0
- package/src/framework.ts +37 -19
- package/src/generate.ts +3 -3
- package/src/index.ts +8 -7
- package/templates/nest/nest.env.eta +7 -0
- package/templates/{nest.main.eta → nest/nest.main.eta} +1 -1
- package/templates/nuxt/env.eta +5 -3
- package/backend1/.env +0 -5
- package/backend1/.eslintrc.js +0 -25
- package/backend1/.prettierrc +0 -4
- package/backend1/README.md +0 -73
- package/backend1/nest-cli.json +0 -8
- package/backend1/package.json +0 -75
- package/backend1/pnpm-lock.yaml +0 -5459
- package/backend1/src/app.controller.js +0 -71
- package/backend1/src/app.controller.js.map +0 -1
- package/backend1/src/app.controller.spec.js +0 -21
- package/backend1/src/app.controller.spec.js.map +0 -1
- package/backend1/src/app.controller.spec.ts +0 -22
- package/backend1/src/app.controller.ts +0 -12
- package/backend1/src/app.module.js +0 -67
- package/backend1/src/app.module.js.map +0 -1
- package/backend1/src/app.module.ts +0 -10
- package/backend1/src/app.service.js +0 -64
- package/backend1/src/app.service.js.map +0 -1
- package/backend1/src/app.service.ts +0 -8
- package/backend1/src/class/SimpleAppController.js +0 -38
- package/backend1/src/class/SimpleAppController.js.map +0 -1
- package/backend1/src/class/SimpleAppController.ts +0 -69
- package/backend1/src/class/SimpleAppService.js +0 -264
- package/backend1/src/class/SimpleAppService.js.map +0 -1
- package/backend1/src/class/SimpleAppService.ts +0 -213
- package/backend1/src/main.js +0 -22
- package/backend1/src/main.js.map +0 -1
- package/backend1/src/main.ts +0 -20
- package/backend1/test/app.e2e-spec.js +0 -45
- package/backend1/test/app.e2e-spec.js.map +0 -1
- package/backend1/test/app.e2e-spec.ts +0 -24
- package/backend1/test/jest-e2e.json +0 -9
- package/backend1/tsconfig.build.json +0 -4
- package/backend1/tsconfig.json +0 -1
- package/frontend1/README.md +0 -63
- package/frontend1/app.vue +0 -8
- package/frontend1/assets/css/tailwind.css +0 -28
- package/frontend1/components/CrudSimple.vue +0 -112
- package/frontend1/components/DebugDocumentData.vue +0 -20
- package/frontend1/components/EventMonitor.vue +0 -79
- package/frontend1/components/Menus.vue +0 -18
- package/frontend1/layouts/default.vue +0 -10
- package/frontend1/nuxt.config.js +0 -42
- package/frontend1/nuxt.config.js.map +0 -1
- package/frontend1/nuxt.config.ts +0 -42
- package/frontend1/package-lock.json +0 -11877
- package/frontend1/package.json +0 -38
- package/frontend1/pages/index.vue +0 -3
- package/frontend1/plugins/simpleapp.js +0 -73
- package/frontend1/plugins/simpleapp.js.map +0 -1
- package/frontend1/plugins/simpleapp.ts +0 -73
- package/frontend1/pnpm-lock.yaml +0 -8339
- package/frontend1/public/favicon.ico +0 -0
- package/frontend1/server/api/[...].js +0 -117
- package/frontend1/server/api/[...].js.map +0 -1
- package/frontend1/server/api/[...].ts +0 -131
- package/frontend1/server/tsconfig.json +0 -3
- package/frontend1/tailwind.config.js +0 -10
- package/frontend1/tailwind.config.js.map +0 -1
- package/frontend1/tailwind.config.ts +0 -9
- package/frontend1/tsconfig.json +0 -4
- package/src/installdependency.ts +0 -4
- package/templates/SimpleAppClient.eta +0 -116
- package/templates/app.vue.eta +0 -21
- package/templates/nest.env.eta +0 -5
- /package/src/{index2.ts → index2.ts-old} +0 -0
- /package/templates/{SimpleAppController.eta → nest/SimpleAppController.eta} +0 -0
- /package/templates/{SimpleAppService.eta → nest/SimpleAppService.eta} +0 -0
- /package/templates/{app.module.eta → nest/app.module.eta} +0 -0
|
Binary file
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const axios_1 = __importDefault(require("axios"));
|
|
7
|
-
// import { getServerSession } from '#auth'
|
|
8
|
-
// import type { Session } from 'next-auth';
|
|
9
|
-
exports.default = defineEventHandler(async (event) => {
|
|
10
|
-
// let session: Session | null = null
|
|
11
|
-
// try {
|
|
12
|
-
// session = await getServerSession(event)
|
|
13
|
-
// } catch (error) {
|
|
14
|
-
// return sendRedirect(event, '/login', 401)
|
|
15
|
-
// }
|
|
16
|
-
return new Promise(async (resolve, reject) => {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f;
|
|
18
|
-
// if(!session || !session.accessToken) {
|
|
19
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
20
|
-
// throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
21
|
-
// }
|
|
22
|
-
// console.log("------hihi------")
|
|
23
|
-
const seperateSymbol = '.';
|
|
24
|
-
// const seperateSymbol = '&';
|
|
25
|
-
const key = (_b = (_a = event.context.params) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '';
|
|
26
|
-
const platform = (_d = (_c = event.context.params) === null || _c === void 0 ? void 0 : _c.platform) !== null && _d !== void 0 ? _d : '';
|
|
27
|
-
const otherLink = (_f = (_e = event.context.params) === null || _e === void 0 ? void 0 : _e._) !== null && _f !== void 0 ? _f : '';
|
|
28
|
-
// console.error("event.context???",event.context)
|
|
29
|
-
// const accessToken = session?.accessToken;
|
|
30
|
-
// const allowPlatform = ['report-api', 'cloudapi'];
|
|
31
|
-
// if(!key || !platform || !allowPlatform.includes(platform) || !accessToken) {
|
|
32
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
33
|
-
// // throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
34
|
-
// }
|
|
35
|
-
// let tenantKey = '', organizationKey = '';
|
|
36
|
-
// let xOrg = '';
|
|
37
|
-
// if(key !== 'system') {
|
|
38
|
-
// [tenantKey, organizationKey] = key.split(seperateSymbol);
|
|
39
|
-
// xOrg = `${tenantKey}/${organizationKey}/`;
|
|
40
|
-
// }
|
|
41
|
-
// if(key === 'system' && platform == 'cloudapi') {
|
|
42
|
-
// // xOrg = 'MC0wLTA'
|
|
43
|
-
// }
|
|
44
|
-
let forwardData = {};
|
|
45
|
-
const req = event.node.req;
|
|
46
|
-
if (req.method == 'POST' || req.method == 'PUT') {
|
|
47
|
-
forwardData = await readBody(event);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
forwardData = getQuery(event);
|
|
51
|
-
}
|
|
52
|
-
// if(typeof forwardData === "object" && "_branch" in forwardData) {
|
|
53
|
-
// xOrg = xOrg + forwardData._branch;
|
|
54
|
-
// delete forwardData._branch;
|
|
55
|
-
// }
|
|
56
|
-
const frontEndRes = event.node.res;
|
|
57
|
-
const url = process.env.SIMPLEAPP_BACKEND_URL + platform + '/' + otherLink;
|
|
58
|
-
// console.warn('backend server-----',req.method,url,forwardData)
|
|
59
|
-
const axiosConfig = {
|
|
60
|
-
method: req.method,
|
|
61
|
-
url: url,
|
|
62
|
-
headers: {
|
|
63
|
-
// Authorization: `Bearer ${accessToken}`,
|
|
64
|
-
// 'X-Org': `${xOrg}`,
|
|
65
|
-
},
|
|
66
|
-
data: forwardData,
|
|
67
|
-
params: forwardData,
|
|
68
|
-
};
|
|
69
|
-
// if(key === 'system') {
|
|
70
|
-
// axiosConfig.headers["X-Global"] = true;
|
|
71
|
-
// delete axiosConfig.headers["X-Org"];
|
|
72
|
-
// }
|
|
73
|
-
// if(otherLink.includes('avatar')) {
|
|
74
|
-
// axiosConfig.responseType = 'arraybuffer';
|
|
75
|
-
// // axiosConfig.headers['Acceptable'] = 'text/html,image/avif,image/webp,image/apng';
|
|
76
|
-
// }
|
|
77
|
-
(0, axios_1.default)(axiosConfig).then((res) => {
|
|
78
|
-
if (res.headers['content-type'] === 'image/png') {
|
|
79
|
-
// Set the response headers for the image
|
|
80
|
-
frontEndRes.setHeader('Content-Type', 'image/png');
|
|
81
|
-
frontEndRes.setHeader('Content-Disposition', 'inline');
|
|
82
|
-
// Send the image data as the response body
|
|
83
|
-
frontEndRes.end(Buffer.from(res.data, 'binary'));
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// For non-image responses, set the Content-Type header and send the response body
|
|
87
|
-
// setHeader(event, 'Content-type', <string>res.headers['Content-Type']);
|
|
88
|
-
frontEndRes.statusCode = res.status;
|
|
89
|
-
if (res.statusText) {
|
|
90
|
-
frontEndRes.statusMessage = res.statusText;
|
|
91
|
-
}
|
|
92
|
-
resolve(res.data);
|
|
93
|
-
}
|
|
94
|
-
}).catch((error) => {
|
|
95
|
-
// console.log("==============================================================")
|
|
96
|
-
// console.log('@@@@@@@@@@@@@ API error', error)
|
|
97
|
-
// console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
|
|
98
|
-
// console.log('######### response', error.response)
|
|
99
|
-
// console.log('#####################################')
|
|
100
|
-
// console.log(axiosConfig);
|
|
101
|
-
// console.log('#####################################')
|
|
102
|
-
var _a;
|
|
103
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) && error.response.status == '401') {
|
|
104
|
-
return reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
105
|
-
// throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
106
|
-
}
|
|
107
|
-
// reject(error.data)
|
|
108
|
-
reject({ statusMessage: error.response.statusText, statusCode: error.response.status });
|
|
109
|
-
// resolve({ status: 'ok' })
|
|
110
|
-
// throw createError({ statusMessage: 'Bad Requests', statusCode: 404 })
|
|
111
|
-
});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W,CAAC,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC;gBACpC,IAAG,GAAG,CAAC,UAAU,EAAE;oBACf,WAAW,CAAC,aAAa,GAAG,GAAG,CAAC,UAAU,CAAC;iBAC9C;gBAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACrB;QAEL,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,gFAAgF;YAChF,gDAAgD;YAChD,iFAAiF;YACjF,oDAAoD;YACpD,uDAAuD;YACvD,4BAA4B;YAC5B,uDAAuD;;YAEvD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,KAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,KAAK,EAAE;gBAC1D,OAAO,MAAM,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;gBAClE,wEAAwE;aAC3E;YAED,qBAAqB;YACrB,MAAM,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACxF,4BAA4B;YAC5B,wEAAwE;QAC5E,CAAC,CAAC,CAAA;QAEF,YAAY;QACZ,mBAAmB;QACnB,KAAK;IACT,CAAC,CAAC,CAAA;AAEN,CAAC,CAAC,CAAA"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
// import { getServerSession } from '#auth'
|
|
3
|
-
// import type { Session } from 'next-auth';
|
|
4
|
-
|
|
5
|
-
export default defineEventHandler(async (event) => {
|
|
6
|
-
// let session: Session | null = null
|
|
7
|
-
// try {
|
|
8
|
-
// session = await getServerSession(event)
|
|
9
|
-
// } catch (error) {
|
|
10
|
-
// return sendRedirect(event, '/login', 401)
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
return new Promise<any>(async (resolve, reject) => {
|
|
14
|
-
// if(!session || !session.accessToken) {
|
|
15
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
16
|
-
// throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
17
|
-
// }
|
|
18
|
-
// console.log("------hihi------")
|
|
19
|
-
const seperateSymbol = '.';
|
|
20
|
-
// const seperateSymbol = '&';
|
|
21
|
-
const key = event.context.params?.key ?? ''
|
|
22
|
-
const platform = event.context.params?.platform ?? ''
|
|
23
|
-
const otherLink = event.context.params?._ ?? ''
|
|
24
|
-
|
|
25
|
-
// console.error("event.context???",event.context)
|
|
26
|
-
// const accessToken = session?.accessToken;
|
|
27
|
-
|
|
28
|
-
// const allowPlatform = ['report-api', 'cloudapi'];
|
|
29
|
-
// if(!key || !platform || !allowPlatform.includes(platform) || !accessToken) {
|
|
30
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
31
|
-
// // throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
// let tenantKey = '', organizationKey = '';
|
|
35
|
-
// let xOrg = '';
|
|
36
|
-
|
|
37
|
-
// if(key !== 'system') {
|
|
38
|
-
// [tenantKey, organizationKey] = key.split(seperateSymbol);
|
|
39
|
-
// xOrg = `${tenantKey}/${organizationKey}/`;
|
|
40
|
-
// }
|
|
41
|
-
|
|
42
|
-
// if(key === 'system' && platform == 'cloudapi') {
|
|
43
|
-
// // xOrg = 'MC0wLTA'
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
let forwardData: any = {};
|
|
47
|
-
|
|
48
|
-
const req = event.node.req;
|
|
49
|
-
|
|
50
|
-
if(req.method == 'POST' || req.method == 'PUT') {
|
|
51
|
-
|
|
52
|
-
forwardData = await readBody(event);
|
|
53
|
-
} else {
|
|
54
|
-
forwardData = getQuery(event);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// if(typeof forwardData === "object" && "_branch" in forwardData) {
|
|
58
|
-
// xOrg = xOrg + forwardData._branch;
|
|
59
|
-
// delete forwardData._branch;
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
const frontEndRes = event.node.res;
|
|
63
|
-
const url = process.env.SIMPLEAPP_BACKEND_URL +platform + '/' + otherLink;
|
|
64
|
-
// console.warn('backend server-----',req.method,url,forwardData)
|
|
65
|
-
const axiosConfig: any = {
|
|
66
|
-
method: req.method,
|
|
67
|
-
url: url,
|
|
68
|
-
headers: {
|
|
69
|
-
// Authorization: `Bearer ${accessToken}`,
|
|
70
|
-
// 'X-Org': `${xOrg}`,
|
|
71
|
-
},
|
|
72
|
-
data: forwardData,
|
|
73
|
-
params: forwardData,
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// if(key === 'system') {
|
|
77
|
-
// axiosConfig.headers["X-Global"] = true;
|
|
78
|
-
// delete axiosConfig.headers["X-Org"];
|
|
79
|
-
// }
|
|
80
|
-
|
|
81
|
-
// if(otherLink.includes('avatar')) {
|
|
82
|
-
// axiosConfig.responseType = 'arraybuffer';
|
|
83
|
-
// // axiosConfig.headers['Acceptable'] = 'text/html,image/avif,image/webp,image/apng';
|
|
84
|
-
// }
|
|
85
|
-
|
|
86
|
-
axios(axiosConfig).then((res) => {
|
|
87
|
-
if (res.headers['content-type'] === 'image/png') {
|
|
88
|
-
// Set the response headers for the image
|
|
89
|
-
frontEndRes.setHeader('Content-Type', 'image/png');
|
|
90
|
-
frontEndRes.setHeader('Content-Disposition', 'inline');
|
|
91
|
-
|
|
92
|
-
// Send the image data as the response body
|
|
93
|
-
frontEndRes.end(Buffer.from(res.data, 'binary'));
|
|
94
|
-
} else {
|
|
95
|
-
// For non-image responses, set the Content-Type header and send the response body
|
|
96
|
-
// setHeader(event, 'Content-type', <string>res.headers['Content-Type']);
|
|
97
|
-
|
|
98
|
-
frontEndRes.statusCode = res.status;
|
|
99
|
-
if(res.statusText) {
|
|
100
|
-
frontEndRes.statusMessage = res.statusText;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
resolve(res.data);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}).catch((error) => {
|
|
107
|
-
// console.log("==============================================================")
|
|
108
|
-
// console.log('@@@@@@@@@@@@@ API error', error)
|
|
109
|
-
// console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
|
|
110
|
-
// console.log('######### response', error.response)
|
|
111
|
-
// console.log('#####################################')
|
|
112
|
-
// console.log(axiosConfig);
|
|
113
|
-
// console.log('#####################################')
|
|
114
|
-
|
|
115
|
-
if (error.response?.status && error.response.status == '401') {
|
|
116
|
-
return reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
117
|
-
// throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// reject(error.data)
|
|
121
|
-
reject({ statusMessage: error.response.statusText, statusCode: error.response.status });
|
|
122
|
-
// resolve({ status: 'ok' })
|
|
123
|
-
// throw createError({ statusMessage: 'Bad Requests', statusCode: 404 })
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
// resolve({
|
|
127
|
-
// status: 'ok'
|
|
128
|
-
// })
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Default are on https://tailwindcss.nuxtjs.org/tailwind/config#default-configuration
|
|
4
|
-
exports.default = {
|
|
5
|
-
theme: {},
|
|
6
|
-
plugins: [],
|
|
7
|
-
content: [],
|
|
8
|
-
darkMode: 'class',
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=tailwind.config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.config.js","sourceRoot":"","sources":["tailwind.config.ts"],"names":[],"mappings":";;AAEA,sFAAsF;AACtF,kBAAgC;IAC9B,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,OAAO;CAClB,CAAA"}
|
package/frontend1/tsconfig.json
DELETED
package/src/installdependency.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
|
-
import addFormats from 'ajv-formats';
|
|
3
|
-
import { ref, Ref } from 'vue';
|
|
4
|
-
import { AxiosResponse } from 'axios';
|
|
5
|
-
import { JSONSchema7 } from 'json-schema';
|
|
6
|
-
import { Configuration } from '../openapi';
|
|
7
|
-
type crudType = {
|
|
8
|
-
runFindOne: Function;
|
|
9
|
-
runCreate: Function;
|
|
10
|
-
runUpdate: Function;
|
|
11
|
-
runList: Function;
|
|
12
|
-
runDelete: Function;
|
|
13
|
-
};
|
|
14
|
-
export class SimpleAppClient<
|
|
15
|
-
TData extends { _id?: string },
|
|
16
|
-
TApi extends crudType,
|
|
17
|
-
defaultTimeout:number = 5000;
|
|
18
|
-
> {
|
|
19
|
-
protected docapi;
|
|
20
|
-
protected data = <Ref<TData>>ref({} as TData);
|
|
21
|
-
public schema = {}; //cant define data type, cause it make autocomplete gone.
|
|
22
|
-
protected doctype = '';
|
|
23
|
-
protected errorlist = ref({});
|
|
24
|
-
constructor(apiobj: TApi) {
|
|
25
|
-
this.docapi = apiobj;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setDocType = (doctype: string) => (this.doctype = doctype);
|
|
29
|
-
setSchema = (schema: any) => (this.schema = schema);
|
|
30
|
-
getSchema = () => this.schema;
|
|
31
|
-
getErrors = () => this.errorlist;
|
|
32
|
-
getData = () => this.data.value;
|
|
33
|
-
getReactiveData = () => this.data;
|
|
34
|
-
setData = (data: any) => {
|
|
35
|
-
// this.data.value = data;
|
|
36
|
-
Object.assign(this.data.value, data);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
async getById(id: string) {
|
|
40
|
-
return await this.docapi.runFindOne(id,{timeout:this.defaultTimeout}).then((res: AxiosResponse) => {
|
|
41
|
-
// this.data.value = { ...res.data };
|
|
42
|
-
Object.assign(this.data.value, res.data);
|
|
43
|
-
return res;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async create() {
|
|
47
|
-
const errors = this.validateFailed();
|
|
48
|
-
if (errors) {
|
|
49
|
-
return await Promise.reject(errors);
|
|
50
|
-
} else {
|
|
51
|
-
return await this.docapi
|
|
52
|
-
.runCreate(this.data.value,{timeout:this.defaultTimeout})
|
|
53
|
-
.then((res: AxiosResponse) => {
|
|
54
|
-
this.data.value = { ...res.data };
|
|
55
|
-
return res;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async update() {
|
|
60
|
-
const recordid: string = this.data.value._id ?? '';
|
|
61
|
-
const errors = this.validateFailed();
|
|
62
|
-
if (errors) {
|
|
63
|
-
return await Promise.reject(errors);
|
|
64
|
-
} else {
|
|
65
|
-
return await this.docapi
|
|
66
|
-
.runUpdate(recordid, this.data.value,{timeout:this.defaultTimeout})
|
|
67
|
-
.then((res: AxiosResponse) => {
|
|
68
|
-
return res;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async delete(id: string) {
|
|
73
|
-
return await this.docapi.runDelete(id,{timeout:this.defaultTimeout});
|
|
74
|
-
}
|
|
75
|
-
async list() {
|
|
76
|
-
return await this.docapi.runList({timeout:this.defaultTimeout});
|
|
77
|
-
}
|
|
78
|
-
find() {}
|
|
79
|
-
hook(type: string, data: TData) {
|
|
80
|
-
console.log('internal save hook');
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
validateFailed() {
|
|
84
|
-
const ajv = new Ajv({ allErrors: true });
|
|
85
|
-
ajv.addKeyword({
|
|
86
|
-
keyword:'autocompletesrc',
|
|
87
|
-
type:'string'
|
|
88
|
-
});
|
|
89
|
-
addFormats(ajv);
|
|
90
|
-
this.errorlist.value = {};
|
|
91
|
-
this.hook('pre-validation', this.data.value);
|
|
92
|
-
const validate = ajv.compile(this.schema);
|
|
93
|
-
const valid = validate(this.data.value);
|
|
94
|
-
if (!valid) {
|
|
95
|
-
const errors = validate.errors;
|
|
96
|
-
const tmp: { [key: string]: any } = {};
|
|
97
|
-
if (errors) {
|
|
98
|
-
for (let i = 0; i < errors?.length; i++) {
|
|
99
|
-
const key: string = errors[i]['instancePath'];
|
|
100
|
-
if (!tmp[key]) {
|
|
101
|
-
tmp[key] = [];
|
|
102
|
-
}
|
|
103
|
-
tmp[key].push(errors[i]);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// console.error(tmp);
|
|
107
|
-
this.errorlist.value = tmp;
|
|
108
|
-
// console.error(this.errorlist);
|
|
109
|
-
|
|
110
|
-
return validate.errors;
|
|
111
|
-
} else {
|
|
112
|
-
this.hook('post-validation', this.data.value);
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
package/templates/app.vue.eta
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div>
|
|
4
|
-
<label>Firstname</label>
|
|
5
|
-
<input v-model="reactivedata.name.firstName">{{ reactivedata }}
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<button @click="person.create().then((res)=>console.log(res.data))">try</button>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
import {PersonDoc} from './server/docs/PersonDoc'
|
|
13
|
-
const person = new PersonDoc()
|
|
14
|
-
|
|
15
|
-
// person.update().then((res)=>console.log("dosomething"))
|
|
16
|
-
// person.delete('record-id').then((res)=>console.log("dosomething"))
|
|
17
|
-
// person.getById('record-id').then((res)=>console.log("dosomething"))
|
|
18
|
-
// person.list().then((res)=>console.log(res))
|
|
19
|
-
const noreactivedata = person.getData()
|
|
20
|
-
const reactivedata = person.getReactiveData()
|
|
21
|
-
</script>
|
package/templates/nest.env.eta
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|