Просмотр исходного кода

[新增]作业实体类定义

soleil 7 лет назад
Родитель
Сommit
057f421d8b

+ 2 - 2
mock/modules/question/index.js

@@ -1,7 +1,7 @@
 const express = require("express");
 const router = express.Router();
-const QuestionSerializer = require("../../serializers/QuestionSerializer");
-const QuestionTypeSerializer = require("../../serializers/QuestionTypeSerializer");
+const QuestionSerializer = require("../../serializers/question/QuestionSerializer");
+const QuestionTypeSerializer = require("../../serializers/question/QuestionTypeSerializer");
 
 //获取全部题目分类
 router.route("/teacher/questionType").get((req, res) => {

+ 18 - 0
mock/serializers/assignment/AssignmentTypeSerializer.js

@@ -0,0 +1,18 @@
+/**
+ * @description 作业类型
+ * @typedef {Object} AssignmentTypeSerializerType
+ * @property {string} name 作业分类名
+ * @property {string} value 作业分类内容
+ */
+
+/**
+ * @description 生成作业类型
+ * @returns {AssignmentTypeSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    name: "CODE",
+    value: "团队代码作业"
+  };
+};

+ 28 - 0
mock/serializers/assignment/CodeResultSerializer.js

@@ -0,0 +1,28 @@
+const makeId = require("../../util/makeId");
+const groupSerializer = require("../course/GroupSerializer");
+/**
+ * @description 代码作业成绩(单元测试、功能测试TBD)
+ * @typedef {Object} CodeResultSerializerType
+ * @property {number | string} id 成绩Id
+ * @property {number} code 所属代码作业Id
+ * @property {GroupSerializerType} group 所属小组
+ * @property {number} unitTestScore 单元测试分数
+ * @property {number} functionTestScore 功能测试分数
+ * @property {number} score 总分
+ */
+
+/**
+ * @description 生成代码作业成绩
+ * @returns {CodeResultSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    id: makeId(),
+    code: makeId(),
+    group: groupSerializer(),
+    unitTestScore: 70,
+    functionTestScore: 90,
+    score: 80
+  };
+};

+ 33 - 0
mock/serializers/assignment/CodeSerializer.js

@@ -0,0 +1,33 @@
+const makeId = require("../../util/makeId");
+const questionSerializer = require("../question/QuestionSerializer");
+const dayjs = require("dayjs");
+/**
+ * @description 代码作业详情
+ * @typedef {Object} CodeSerializerType
+ * @property {number | string} id 代码作业Id
+ * @property {string} name 代码作业名称
+ * @property {string} description 代码作业描述
+ * @property {string} status 作业状态
+ * @property {number} createAt 创建时间
+ * @property {number} startAt 开始时间
+ * @property {number} endAt 结束时间
+ * @property {QuestionSerializerType[]} problem 作业题目
+ */
+
+/**
+ * @description 生成代码作业
+ * @returns {CodeSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    id: makeId(),
+    name: "物流管理系统",
+    description: "请为顺丰公司编写一个在线物流管理系统",
+    status: "PREPARING",
+    createAt: dayjs("2018-10-21").unix(),
+    startAt: dayjs("2019-01-01").unix(),
+    endAt: dayjs("2019-01-20").unix(),
+    problem: [questionSerializer(), questionSerializer()]
+  };
+};

+ 26 - 0
mock/serializers/assignment/DocumentResultSerializer.js

@@ -0,0 +1,26 @@
+const makeId = require("../../util/makeId");
+const groupSerializer = require("../course/GroupSerializer");
+/**
+ * @description 文档作业成绩
+ * @typedef {Object} DocumentResultSerializerType
+ * @property {number | string} id 文档作业成绩id
+ * @property {number} document 所属文档作业Id
+ * @property {GroupSerializerType} group 所属小组
+ * @property {string} state 作业状态
+ * @property {string} result 成绩等级
+ */
+
+/**
+ * @description 生成文档作业成绩
+ * @returns {DocumentResultSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    id: makeId(),
+    document: makeId(),
+    group: groupSerializer(),
+    state: "互评中",
+    result: "B"
+  };
+};

+ 35 - 0
mock/serializers/assignment/DocumentSerializer.js

@@ -0,0 +1,35 @@
+const makeId = require("../../util/makeId");
+const questionSerializer = require("../question/QuestionSerializer");
+const dayjs = require("dayjs");
+/**
+ * @description 文档作业信息
+ * @typedef {Object} DocumentSerializerType
+ * @property {number | string} id 文档作业id
+ * @property {string} name 文档作业名称
+ * @property {string} description 文档作业描述
+ * @property {string} status 作业状态
+ * @property {number} createAt 创建时间
+ * @property {number} startAt 开始时间
+ * @property {number} endAt 结束时间
+ * @property {QuestionSerializerType[]} problem 作业题目
+ * @property {string} url 作业git地址
+ */
+
+/**
+ * @description 生成文档作业详情
+ * @returns {DocumentSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    id: makeId(),
+    name: "物流系统需求规格说明文档",
+    description: "请给出物流系统的需求规格说明文档",
+    status: "READY",
+    createAt: dayjs("2018-10-21").unix(),
+    startAt: dayjs("2019-01-01").unix(),
+    endAt: dayjs("2019-01-20").unix(),
+    problem: [questionSerializer(), questionSerializer()],
+    url: "http://47.100.18.120:3000/SEEC-II-DOC/API-DOC"
+  };
+};

+ 31 - 0
mock/serializers/assignment/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[]} functionTestIdList 功能测试IDList
+ */
+
+/**
+ * @description 生成代码作业项目信息
+ * @returns {ProjectSerializerType}
+ */
+
+module.exports = () => {
+  return {
+    id: makeId(),
+    codeId: makeId(),
+    url: "http://47.100.18.120:3000/SEEC-II-DOC/API-DOC",
+    name: "物流作业系统_01组",
+    buildIdList: [makeId(), makeId()],
+    deployIdList: [makeId(), makeId(), makeId()],
+    unitTestIdList: [makeId()],
+    functionTestIdList: [makeId(), makeId()]
+  };
+};

+ 2 - 2
mock/serializers/QuestionSerializer.js → mock/serializers/question/QuestionSerializer.js

@@ -1,5 +1,5 @@
-const makeId = require("../util/makeId");
-const fileSerializer = require("./FileSerializer");
+const makeId = require("../../util/makeId");
+const fileSerializer = require("../FileSerializer");
 
 /**
  * @description 题目信息

+ 1 - 1
mock/serializers/QuestionTypeSerializer.js → mock/serializers/question/QuestionTypeSerializer.js

@@ -7,7 +7,7 @@
 
 /**
  * @description 生成题目类型
- * @returns {QuestionTypeSerializer}
+ * @returns {QuestionTypeSerializerType}
  */
 
 module.exports = () => {