CheckListResultItemSerializer.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const makeId = require("../../util/makeId");
  2. /**
  3. * @description 互评CheckListResultItem详细实体类
  4. * @typedef {Object} CheckListResultItemType
  5. * @property {number|string} id checkListItem id
  6. * @property {string} content 评价内容
  7. * @property {string} explain 老师说明
  8. * @property {boolean} teacherLevel 老师作出的评价
  9. * @property {string} teacherComment 老师做出的备注
  10. * @property {boolean} hasTeacherReview 老师是否评审过
  11. * @property {ResultByGroupType[]} results 各个小组的评价
  12. */
  13. /**
  14. * @description 各个小组的评价
  15. * @typedef {Object} ResultByGroupType
  16. * @property {number|string} groupId 小组 id
  17. * @property {boolean} level 小组做出的评价
  18. * @property {string} comment 小组做出的备注
  19. * @property {boolean} isArgued 是否已经申请过重评
  20. */
  21. /**
  22. * @description 生成checkListResultItem
  23. * @returns {CheckListResultItemType}
  24. */
  25. module.exports = ({ id = makeId() }) => {
  26. /**
  27. * @return {ResultByGroupType}
  28. */
  29. const groupResult = () => ({
  30. groupId: makeId(),
  31. level: true,
  32. comment: "小组做出的备注",
  33. isArgued: false
  34. });
  35. return {
  36. id,
  37. content: "该项评价的内容, String",
  38. explain: "老师的说明,String",
  39. teacherLevel: true,
  40. teacherComment: "老师的评论论论",
  41. hasTeacherReview: true,
  42. results: [groupResult(), groupResult(), groupResult()]
  43. };
  44. };