CheckListResultItemSerializer.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 {ResultByGroupType[]} results 各个小组的评价
  9. */
  10. /**
  11. * @description 各个小组的评价
  12. * @typedef {Object} ResultByGroupType
  13. * @property {number|string} groupId 小组 id
  14. * @property {boolean} level 小组做出的评价
  15. * @property {string} comment 小组做出的备注
  16. * @property {boolean} isArgued 是否已经申请过重评
  17. */
  18. /**
  19. * @description 生成checkListResultItem
  20. * @returns {CheckListResultItemType}
  21. */
  22. module.exports = ({ id = makeId() }) => {
  23. /**
  24. * @return {ResultByGroupType}
  25. */
  26. const groupResult = () => ({
  27. groupId: makeId(),
  28. level: true,
  29. comment: "小组做出的备注",
  30. isArgued: false
  31. });
  32. return {
  33. id,
  34. content: "该项评价的内容, String",
  35. explain: "老师的说明,String",
  36. results: [groupResult(), groupResult(), groupResult()]
  37. };
  38. };