@isxiaoyuan/elpis 1.0.0
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/.eslintignore +3 -0
- package/.eslintrc +52 -0
- package/.vscode/settings.json +8 -0
- package/REMADE.md +228 -0
- package/app/controller/base.js +43 -0
- package/app/controller/project.js +106 -0
- package/app/controller/view.js +21 -0
- package/app/extend/logger.js +36 -0
- package/app/middleware/api-params-verify.js +73 -0
- package/app/middleware/api-sign-verify.js +43 -0
- package/app/middleware/error-handler.js +33 -0
- package/app/middleware/project-handle.js +26 -0
- package/app/middleware.js +41 -0
- package/app/pages/asserts/custom.css +11 -0
- package/app/pages/boot.js +43 -0
- package/app/pages/common/curl.js +88 -0
- package/app/pages/common/utils.js +2 -0
- package/app/pages/dashboard/complex-view/header-view/complex-view/sub-menu/sub-menu.vue +19 -0
- package/app/pages/dashboard/complex-view/header-view/header-view.vue +138 -0
- package/app/pages/dashboard/complex-view/iframe-view/iframe-view.vue +51 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue +41 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue +128 -0
- package/app/pages/dashboard/complex-view/schema-view/components/component-config.js +20 -0
- package/app/pages/dashboard/complex-view/schema-view/components/create-form/create-form.vue +95 -0
- package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue +98 -0
- package/app/pages/dashboard/complex-view/schema-view/components/edit-form/edit-form.vue +123 -0
- package/app/pages/dashboard/complex-view/schema-view/hook/schema.js +129 -0
- package/app/pages/dashboard/complex-view/schema-view/schema-view.vue +98 -0
- package/app/pages/dashboard/complex-view/silder-view/silder-view.vue +127 -0
- package/app/pages/dashboard/dashboard.vue +96 -0
- package/app/pages/dashboard/entry.dashboard.js +48 -0
- package/app/pages/store/index.js +5 -0
- package/app/pages/store/menu.js +70 -0
- package/app/pages/store/project.js +17 -0
- package/app/pages/widgets/header-container/asserts/avatar.png +0 -0
- package/app/pages/widgets/header-container/asserts/logo.png +0 -0
- package/app/pages/widgets/header-container/header-container.vue +102 -0
- package/app/pages/widgets/schema-form/complex-view/input/input.vue +137 -0
- package/app/pages/widgets/schema-form/complex-view/input-number/input-number.vue +136 -0
- package/app/pages/widgets/schema-form/complex-view/select/select.vue +122 -0
- package/app/pages/widgets/schema-form/form-item-config.js +20 -0
- package/app/pages/widgets/schema-form/schema-form.vue +136 -0
- package/app/pages/widgets/schema-search-bar/complex-view/date-range/date-range.vue +55 -0
- package/app/pages/widgets/schema-search-bar/complex-view/dynamic-select/dynamic-select.vue +69 -0
- package/app/pages/widgets/schema-search-bar/complex-view/input/input.vue +45 -0
- package/app/pages/widgets/schema-search-bar/complex-view/select/select.vue +53 -0
- package/app/pages/widgets/schema-search-bar/schema-item-config.js +24 -0
- package/app/pages/widgets/schema-search-bar/schema-search-bar.vue +115 -0
- package/app/pages/widgets/schema-table/schema-table.vue +255 -0
- package/app/pages/widgets/sider-container/complex-view/sub-menu/sub-menu.vue +18 -0
- package/app/pages/widgets/sider-container/sider-container.vue +29 -0
- package/app/public/dist/entry.dashboard.tpl +27 -0
- package/app/public/dist/entry.page1.tpl +25 -0
- package/app/public/dist/entry.page2.tpl +25 -0
- package/app/public/dist/entry.project-list.tpl +27 -0
- package/app/public/static/logo.png +0 -0
- package/app/public/static/normalize.css +239 -0
- package/app/router/project.js +12 -0
- package/app/router/view.js +7 -0
- package/app/router-schema/project.js +30 -0
- package/app/service/base.js +13 -0
- package/app/service/project.js +58 -0
- package/app/view/entry.tpl +27 -0
- package/app/webpack/config/webpack.base.js +305 -0
- package/app/webpack/config/webpack.dev.js +62 -0
- package/app/webpack/config/webpack.prod.js +120 -0
- package/app/webpack/dev.js +62 -0
- package/app/webpack/libs/blank.js +1 -0
- package/app/webpack/prod.js +22 -0
- package/config/config.beta.js +3 -0
- package/config/config.default.js +3 -0
- package/config/config.prod.js +3 -0
- package/elpis-core/env.js +20 -0
- package/elpis-core/index.js +97 -0
- package/elpis-core/loader/config.js +66 -0
- package/elpis-core/loader/controller.js +86 -0
- package/elpis-core/loader/extend.js +66 -0
- package/elpis-core/loader/middleware.js +74 -0
- package/elpis-core/loader/router-schema.js +56 -0
- package/elpis-core/loader/router.js +49 -0
- package/elpis-core/loader/service.js +82 -0
- package/index.js +42 -0
- package/model/index.js +109 -0
- package/package.json +92 -0
- package/test/controller/project.test.js +188 -0
package/model/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { sep } = path;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
|
|
6
|
+
// project 继承 model
|
|
7
|
+
const projectExtendModel = (model, project) => {
|
|
8
|
+
return _.mergeWith({}, model, project, (modelValue, projectValue) => {
|
|
9
|
+
if (Array.isArray(modelValue) && Array.isArray(projectValue)) {
|
|
10
|
+
let result = [];
|
|
11
|
+
|
|
12
|
+
//project 数组项 继承 model 数组项
|
|
13
|
+
// project 有的键值,model也有 =》 修改
|
|
14
|
+
// project 有的键值,model没有 =》 新增
|
|
15
|
+
// model 有的键值,project没有 =》 保留
|
|
16
|
+
|
|
17
|
+
// 修改
|
|
18
|
+
for (let i = 0; i < modelValue.length; i++) {
|
|
19
|
+
let modelItem = modelValue[i];
|
|
20
|
+
const projItem = projectValue.find(
|
|
21
|
+
(projItem) => projItem.key === modelItem.key,
|
|
22
|
+
);
|
|
23
|
+
// project 有的键值,model也有 递归调用 projectExtendModel 覆盖
|
|
24
|
+
result.push(
|
|
25
|
+
projItem ? projectExtendModel(modelItem, projItem) : modelItem,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 新增
|
|
30
|
+
for (let i = 0; i < projectValue.length; i++) {
|
|
31
|
+
let projItem = projectValue[i];
|
|
32
|
+
const modelItem = modelValue.find(
|
|
33
|
+
(modelItem) => modelItem.key === projItem.key,
|
|
34
|
+
);
|
|
35
|
+
if (!modelItem) {
|
|
36
|
+
result.push(projItem);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 解析 model 配置,并返回组织且继承后的数据结构
|
|
47
|
+
[{
|
|
48
|
+
model: ${model}
|
|
49
|
+
project: {
|
|
50
|
+
proj1: ${proj1},
|
|
51
|
+
proj2: ${proj2},
|
|
52
|
+
}
|
|
53
|
+
},...]
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
module.exports = (app) => {
|
|
58
|
+
const modelList = [];
|
|
59
|
+
|
|
60
|
+
//遍历当前文件夹,构造模型数据结构,挂在到 modelList 上
|
|
61
|
+
const modelPath = path.resolve(app.baseDir, `.${sep}model`);
|
|
62
|
+
const fileList = glob.sync(path.resolve(modelPath, `.${sep}**${sep}**.js`));
|
|
63
|
+
|
|
64
|
+
fileList.forEach((file) => {
|
|
65
|
+
if (file.indexOf("index.js") > -1) return;
|
|
66
|
+
|
|
67
|
+
// 区分配置类型 (model / project)
|
|
68
|
+
// const type = file.indexOf(`${sep}project${sep}`) > -1 ? "project" : "model";
|
|
69
|
+
const projectReg = /[\\/]model[\\/].*?[\\/]project[\\/]/;
|
|
70
|
+
const type = projectReg.test(file) ? "project" : "model";
|
|
71
|
+
|
|
72
|
+
if (type === "project") {
|
|
73
|
+
const modelKey = file.match(/\/model\/(.*?)\/project/)?.[1];
|
|
74
|
+
// 兼容性处理
|
|
75
|
+
const projectKey = file.match(/\/model\/.*?\/project\/(.*?)\.js/)?.[1];
|
|
76
|
+
|
|
77
|
+
let modelItem = modelList.find((item) => item.model?.key === modelKey);
|
|
78
|
+
if (!modelItem) {
|
|
79
|
+
modelItem = {};
|
|
80
|
+
modelList.push(modelItem);
|
|
81
|
+
}
|
|
82
|
+
if (!modelItem.project) {
|
|
83
|
+
modelItem.project = {};
|
|
84
|
+
}
|
|
85
|
+
modelItem.project[projectKey] = require(path.resolve(file));
|
|
86
|
+
modelItem.project[projectKey].key = projectKey;
|
|
87
|
+
modelItem.project[projectKey].modelKey = modelKey;
|
|
88
|
+
}
|
|
89
|
+
if (type === "model") {
|
|
90
|
+
const modelKey = file.match(/\/model\/(.*?)\/model\.js/)?.[1];
|
|
91
|
+
let modelItem = modelList.find((item) => item.model?.key === modelKey);
|
|
92
|
+
if (!modelItem) {
|
|
93
|
+
modelItem = {};
|
|
94
|
+
modelList.push(modelItem);
|
|
95
|
+
}
|
|
96
|
+
modelItem.model = require(path.resolve(file));
|
|
97
|
+
modelItem.model.key = modelKey;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// 数据进一步处理: project => 继承 model
|
|
102
|
+
modelList.forEach((item) => {
|
|
103
|
+
const { model, project } = item;
|
|
104
|
+
for (const key in project) {
|
|
105
|
+
project[key] = projectExtendModel(model, project[key]);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return modelList;
|
|
109
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@isxiaoyuan/elpis",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint --quiet --ext js,vue .",
|
|
8
|
+
"test": "set _ENV=local&&mocha 'test/**/*.js'"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://git.code.tencent.com/isYuan/Elpis.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "isYuan",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@babel/core": "^7.24.0",
|
|
18
|
+
"@babel/runtime": "^7.28.6",
|
|
19
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
20
|
+
"ajv": "^6.10.2",
|
|
21
|
+
"axios": "^0.19.2",
|
|
22
|
+
"echarts": "^5.5.0",
|
|
23
|
+
"element-plus": "^2.3.7",
|
|
24
|
+
"generate-password": "^1.7.1",
|
|
25
|
+
"glob": "^7.1.4",
|
|
26
|
+
"jsonwebtoken": "^9.0.2",
|
|
27
|
+
"knex": "^0.19.0",
|
|
28
|
+
"koa": "2.7.0",
|
|
29
|
+
"koa-bodyparser": "^4.2.1",
|
|
30
|
+
"koa-nunjucks-2": "^3.0.2",
|
|
31
|
+
"koa-router": "^7.4.0",
|
|
32
|
+
"koa-static": "^5.0.0",
|
|
33
|
+
"koa-useragent": "2.0.0",
|
|
34
|
+
"koa2-cors": "^2.0.6",
|
|
35
|
+
"less": "^3.8.1",
|
|
36
|
+
"lodash": "^4.17.21",
|
|
37
|
+
"log4js": "^6.9.1",
|
|
38
|
+
"md5": "^2.2.1",
|
|
39
|
+
"moment": "^2.29.4",
|
|
40
|
+
"mysql": "^2.18.1",
|
|
41
|
+
"node-schedule": "^2.1.1",
|
|
42
|
+
"nodemon": "^1.19.2",
|
|
43
|
+
"path": "^0.12.7",
|
|
44
|
+
"pinia": "^2.1.6",
|
|
45
|
+
"superagent": "^8.1.2",
|
|
46
|
+
"vue": "^3.3.4",
|
|
47
|
+
"vue-json-viewer": "^3.0.4",
|
|
48
|
+
"vue-router": "^4.2.4",
|
|
49
|
+
"vuex": "^4.1.0",
|
|
50
|
+
"@babel/plugin-transform-runtime": "^7.1.0",
|
|
51
|
+
"@babel/preset-env": "^7.4.5",
|
|
52
|
+
"babel-loader": "^8.0.4",
|
|
53
|
+
"clean-webpack-plugin": "^0.1.19",
|
|
54
|
+
"consoler": "^0.2.0",
|
|
55
|
+
"css-loader": "^0.23.1",
|
|
56
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
57
|
+
"directory-named-webpack-plugin": "^4.0.1",
|
|
58
|
+
"express": "^4.18.2",
|
|
59
|
+
"file-loader": "^6.2.0",
|
|
60
|
+
"happypack": "^5.0.1",
|
|
61
|
+
"html-webpack-inject-attributes-plugin": "^1.0.1",
|
|
62
|
+
"html-webpack-plugin": "^5.5.3",
|
|
63
|
+
"less-loader": "^11.1.3",
|
|
64
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
65
|
+
"style-loader": "^0.14.1",
|
|
66
|
+
"terser-webpack-plugin": "^2.3.5",
|
|
67
|
+
"url-loader": "^4.1.1",
|
|
68
|
+
"vue-loader": "^17.2.2",
|
|
69
|
+
"vue-style-loader": "^4.1.2",
|
|
70
|
+
"webpack": "^5.88.1",
|
|
71
|
+
"webpack-dev-middleware": "^6.1.1",
|
|
72
|
+
"webpack-hot-middleware": "^2.25.4",
|
|
73
|
+
"webpack-merge": "^4.2.1"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"assert": "^2.0.0",
|
|
77
|
+
"babel-eslint": "^10.0.2",
|
|
78
|
+
"eslint": "^7.32.0",
|
|
79
|
+
"eslint-plugin-import": "^2.28.1",
|
|
80
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
81
|
+
"ghooks": "~1.0.3",
|
|
82
|
+
"mocha": "^6.1.4",
|
|
83
|
+
"supertest": "^4.0.2",
|
|
84
|
+
"validate-commit-msg": "~2.14.0"
|
|
85
|
+
},
|
|
86
|
+
"config": {
|
|
87
|
+
"ghooks": {
|
|
88
|
+
"commit-msg": "validate-commit-msg",
|
|
89
|
+
"pre-commit": "npm run lint"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
const assert = require("assert");
|
|
2
|
+
const supertest = require("supertest");
|
|
3
|
+
const md5 = require("md5");
|
|
4
|
+
const elpisCore = require("../../elpis-core");
|
|
5
|
+
|
|
6
|
+
const signKey = "isyuankkkkkll123kasd2444";
|
|
7
|
+
const st = Date.now();
|
|
8
|
+
|
|
9
|
+
describe("测试 project 相关接口", function () {
|
|
10
|
+
this.timeout(10000);
|
|
11
|
+
|
|
12
|
+
let modelList;
|
|
13
|
+
const projectList = [];
|
|
14
|
+
|
|
15
|
+
let request;
|
|
16
|
+
|
|
17
|
+
it("启动服务", async () => {
|
|
18
|
+
const app = await elpisCore.start();
|
|
19
|
+
modelList = require("../../model/index.js")(app);
|
|
20
|
+
modelList.forEach((modelItem) => {
|
|
21
|
+
const { project } = modelItem;
|
|
22
|
+
for (const pKey in project) {
|
|
23
|
+
projectList.push(project[pKey]);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
request = supertest(app.listen());
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("GET /api/project without proj_key", async () => {
|
|
31
|
+
let res = await request
|
|
32
|
+
.get("/api/project")
|
|
33
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
34
|
+
.set("s_t", st);
|
|
35
|
+
assert(res.body.success === false);
|
|
36
|
+
const resBody = res.body;
|
|
37
|
+
assert(resBody.code === 442);
|
|
38
|
+
assert(
|
|
39
|
+
resBody.message.indexOf(
|
|
40
|
+
`request validate fail: data should have required property 'proj_key'`,
|
|
41
|
+
) > -1,
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
it("GET /api/project fail", async () => {
|
|
45
|
+
let res = await request
|
|
46
|
+
.get("/api/project")
|
|
47
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
48
|
+
.set("s_t", st)
|
|
49
|
+
.query({ proj_key: "xxxxxxxxxxxxx" });
|
|
50
|
+
assert(res.body.success === false);
|
|
51
|
+
const resBody = res.body;
|
|
52
|
+
assert(resBody.code === 50000);
|
|
53
|
+
assert(resBody.message === "获取项目异常");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("GET /api/project with proj_key", async () => {
|
|
57
|
+
for (let i = 0; i < projectList.length; ++i) {
|
|
58
|
+
const { key: projKey } = projectList[i];
|
|
59
|
+
let res = await request
|
|
60
|
+
.get("/api/project")
|
|
61
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
62
|
+
.set("s_t", st)
|
|
63
|
+
.query({ proj_key: projKey });
|
|
64
|
+
assert(res.body.success === true);
|
|
65
|
+
const resData = res.body.data;
|
|
66
|
+
assert(resData.key === projKey);
|
|
67
|
+
assert(resData.modelKey);
|
|
68
|
+
assert(resData.name);
|
|
69
|
+
assert(resData.desc !== undefined);
|
|
70
|
+
assert(resData.homePage !== undefined);
|
|
71
|
+
const { menu } = resData;
|
|
72
|
+
menu.forEach((menuItem) => {
|
|
73
|
+
checkMenuItem(menuItem);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// 检查menu菜单
|
|
77
|
+
function checkMenuItem(menuItem) {
|
|
78
|
+
assert(menuItem.name);
|
|
79
|
+
assert(menuItem.menuType);
|
|
80
|
+
assert(menuItem.key);
|
|
81
|
+
if (menuItem.menuType === "group") {
|
|
82
|
+
assert(menuItem.subMenu !== undefined);
|
|
83
|
+
menuItem.subMenu.forEach((subMenuItem) => {
|
|
84
|
+
checkMenuItem(subMenuItem);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (menuItem.menuType === "module") {
|
|
88
|
+
checkModule(menuItem);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// 检查 module 菜单配置
|
|
92
|
+
function checkModule(menuItem) {
|
|
93
|
+
const { moduleType } = menuItem;
|
|
94
|
+
assert(moduleType);
|
|
95
|
+
if (moduleType === "sider") {
|
|
96
|
+
const { siderConfig } = menuItem;
|
|
97
|
+
assert(siderConfig);
|
|
98
|
+
assert(siderConfig.menu);
|
|
99
|
+
siderConfig.menu.forEach((item) => {
|
|
100
|
+
checkMenuItem(item);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (moduleType === "iframe") {
|
|
104
|
+
const { iframeConfig } = menuItem;
|
|
105
|
+
assert(iframeConfig);
|
|
106
|
+
assert(iframeConfig.path !== undefined);
|
|
107
|
+
}
|
|
108
|
+
if (moduleType === "custom") {
|
|
109
|
+
const { customConfig } = menuItem;
|
|
110
|
+
assert(customConfig);
|
|
111
|
+
assert(customConfig.path !== undefined);
|
|
112
|
+
}
|
|
113
|
+
if (moduleType === "schema") {
|
|
114
|
+
const { schemaConfig } = menuItem;
|
|
115
|
+
assert(schemaConfig);
|
|
116
|
+
assert(schemaConfig.api !== undefined);
|
|
117
|
+
assert(schemaConfig.schema);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("GET /api/project/list without proj_key", async () => {
|
|
123
|
+
let res = await request
|
|
124
|
+
.get("/api/project/list")
|
|
125
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
126
|
+
.set("s_t", st);
|
|
127
|
+
assert(res.body.success === true);
|
|
128
|
+
const resData = res.body.data;
|
|
129
|
+
assert(resData.length === projectList.length);
|
|
130
|
+
for (let i = 0; i < resData.length; ++i) {
|
|
131
|
+
const item = resData[i];
|
|
132
|
+
assert(item.modelKey);
|
|
133
|
+
assert(item.key);
|
|
134
|
+
assert(item.name);
|
|
135
|
+
assert(item.desc !== undefined);
|
|
136
|
+
assert(item.homePage !== undefined);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("GET /api/project/list with proj_key", async () => {
|
|
141
|
+
const { key: projKey } =
|
|
142
|
+
projectList[Math.floor(Math.random() * projectList.length)];
|
|
143
|
+
const { modelKey } = projectList.find((item) => item.key === projKey);
|
|
144
|
+
|
|
145
|
+
let res = await request
|
|
146
|
+
.get("/api/project/list")
|
|
147
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
148
|
+
.set("s_t", st)
|
|
149
|
+
.query({ proj_key: projKey });
|
|
150
|
+
assert(res.body.success === true);
|
|
151
|
+
const resData = res.body.data;
|
|
152
|
+
assert(
|
|
153
|
+
projectList.filter((item) => item.modelKey === modelKey).length ===
|
|
154
|
+
resData.length,
|
|
155
|
+
);
|
|
156
|
+
for (let i = 0; i < resData.length; ++i) {
|
|
157
|
+
const item = resData[i];
|
|
158
|
+
assert(item.modelKey);
|
|
159
|
+
assert(item.key);
|
|
160
|
+
assert(item.name);
|
|
161
|
+
assert(item.desc !== undefined);
|
|
162
|
+
assert(item.homePage !== undefined);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("GET /api/project/model_list", async () => {
|
|
167
|
+
const res = await request
|
|
168
|
+
.get("/api/project/model_list")
|
|
169
|
+
.set("s_sign", md5(`${signKey}_${st}`))
|
|
170
|
+
.set("s_t", st);
|
|
171
|
+
assert(res.body.success === true);
|
|
172
|
+
const resData = res.body.data;
|
|
173
|
+
assert.equal(res.status, 200);
|
|
174
|
+
assert(resData.length > 0);
|
|
175
|
+
|
|
176
|
+
for (let i = 0; i < resData.length; i++) {
|
|
177
|
+
const model = resData[i];
|
|
178
|
+
assert(model.model);
|
|
179
|
+
assert(model.model.name);
|
|
180
|
+
assert(model.model.key);
|
|
181
|
+
assert(model.project);
|
|
182
|
+
for (const projKey in model.project) {
|
|
183
|
+
assert(model.project[projKey].key);
|
|
184
|
+
assert(model.project[projKey].name);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|