Bläddra i källkod

[新建]代码作业实体类设计

soleil 7 år sedan
förälder
incheckning
522dec1a39

+ 25 - 0
mock/serializers/codeHomework/BuildSerializer.js

@@ -0,0 +1,25 @@
+const makeId = require("../../util/makeId");
+
+/**
+ * @description 代码一次构建的基本信息
+ * @typedef {Object} BuildSerializerType
+ * @property {number | string} id 代码一次构建的id
+ * @property {number | string} branchId 分支id
+ * @property {string} buildState 构建输出的信息
+ * @property {number | string} mirrorId 镜像id
+ * @property {string} commitMessage commit信息
+ */
+
+/**
+ * @description 生成代码构建信息
+ * @returns {BuildSerializerType}
+ */
+module.exports = () => {
+  return {
+    id: makeId(),
+    branchId: makeId(),
+    buildState: "构建中......",
+    mirrorId: makeId(),
+    commitMessage: "commit信息...."
+  };
+};

+ 25 - 0
mock/serializers/codeHomework/DeploySerializer.js

@@ -0,0 +1,25 @@
+const makeId = require("../../util/makeId");
+
+/**
+ * @description 代码一次部署的基本信息
+ * @typedef {Object} DeploySerializerType
+ * @property {number | string} id 代码一次部署的id
+ * @property {number} deployState 部署状态
+ * @property {string} deployMessage 部署输出的信息
+ * @property {string} config 配置信息TBD
+ * @property {string} pageUrl 项目部署的url
+ */
+
+/**
+ * @description 生成代码构建信息
+ * @returns {DeploySerializerType}
+ */
+module.exports = () => {
+  return {
+    id: makeId(),
+    deployState: 1,
+    deployMessage: "部署信息....",
+    config: "部署信息TBD...",
+    pageUrl: "http://47.100.18.120:3000/SEEC-II-DOC/API-DOC"
+  };
+};

+ 28 - 0
mock/serializers/codeHomework/FunctionalTestSerializer.js

@@ -0,0 +1,28 @@
+const makeId = require("../../util/makeId");
+const oneFunctionalTestSerializer = require("./OneFunctionalSerializer");
+
+/**
+ * @description 代码一次功能测试的基本信息
+ * @typedef {Object} FunctionTestSerializerType
+ * @property {number | string} id 代码一次功能测试的id
+ * @property {number} time 测试时间
+ * @property {number | string} deployId 对应的部署id
+ * @property {oneFunctionalTestSerializer[]} detail 未通过的测试用例列表
+ */
+
+/**
+ * @description 生成代码构建信息
+ * @returns {FunctionTestSerializerType}
+ */
+module.exports = () => {
+  return {
+    id: makeId(),
+    time: 3,
+    deployId: makeId(),
+    detail: [
+      oneFunctionalTestSerializer(),
+      oneFunctionalTestSerializer(),
+      oneFunctionalTestSerializer()
+    ]
+  };
+};

+ 21 - 0
mock/serializers/codeHomework/OneFunctionalSerializer.js

@@ -0,0 +1,21 @@
+const makeId = require("../../util/makeId");
+
+/**
+ * @description 代码作业一次页面功能测试一个测试用例的基本信息
+ * @typedef {Object} OneFunctionalSerializerType
+ * @property {number | string} id 一个测试用例的id
+ * @property {boolean} isPass 是否通过
+ * @property {string} message 输出
+ */
+
+/**
+ * @description 生成代码作业一次页面功能测试一个测试用例的基本信息
+ * @returns {OneFunctionalSerializerType}
+ */
+module.exports = () => {
+  return {
+    id: makeId(),
+    isPass: true,
+    message: "输出错误,正确输出为3 0 1 2,您的输出为 1 0 2 3"
+  };
+};

+ 31 - 0
mock/serializers/codeHomework/ProjectSerializer.js

@@ -0,0 +1,31 @@
+const makeId = require("../../util/makeId");
+
+/**
+ * @description 代码作业项目的基本信息
+ * @typedef {Object} ProjectSerializerType
+ * @property {number | string} id 代码作业项目id
+ * @property {number | string} codeId 代码作业id
+ * @property {string} url git项目地址
+ * @property {string} name 项目名称
+ * @property {number[]} buildIdList 构建IdList
+ * @property {number[]} deployIdList 部署IdList
+ * @property {number[]} unitTestIdList 单元测试IdList
+ * @property {number[]} functionalTestIdList 页面功能测试idList
+ */
+
+/**
+ * @description 生成代码作业项目的基本信息
+ * @returns {ProjectSerializerType}
+ */
+module.exports = () => {
+  return {
+    id: makeId(),
+    codeId: makeId(),
+    url: "http://47.100.18.120:3000/SEEC-II-DOC/API-DOC",
+    name: "在线物流系统",
+    buildIdList: [makeId(), makeId(), makeId()],
+    deployIdList: [makeId(), makeId()],
+    unitTestIdList: [makeId()],
+    functionalTestIdList: [makeId(), makeId(), makeId()]
+  };
+};