CourseSerializer.js 601 B

123456789101112131415161718192021222324
  1. const makeId = require("../../util/makeId");
  2. const userSerializer = require("../user/UserSerializer");
  3. /**
  4. * @description 课程信息
  5. * @typedef {Object} CourseSerializerType
  6. * @property {number|string} id 课程id
  7. * @property {string} name 课程名称
  8. * @property {string} code 选课码
  9. * @property {UserSerializerType} teacher 老师信息
  10. */
  11. /**
  12. * @description 生成课程信息
  13. * @returns {CourseSerializerType}
  14. */
  15. module.exports = (id = makeId()) => {
  16. return {
  17. id,
  18. name: "软件工程第二阶段 2018",
  19. code: "xxxxx",
  20. teacher: userSerializer("TEACHER")
  21. };
  22. };