ReviewResultSerializer.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const makeId = require("../../util/makeId");
  2. const reviewDetailSerializer = require("./ReviewDetailSerializer");
  3. const checkListItemSerializer = require("./CheckListItemSerializer");
  4. /**
  5. * @description 互评ReviewResultSerializer详细实体类
  6. * @typedef {Object} ReviewResultSerializerType
  7. * @property {number|string} id ReviewResultSerializer
  8. * @property {ReviewDetailSerializerType} detail 文档详情
  9. * @property {string} level 文档等级
  10. * @property {number} score 文档分数
  11. * @property {CheckListResult[]} checkListResult 互评作业的结果
  12. */
  13. /**
  14. * @description 详细评价结果CheckListResult
  15. * @typedef {Object} CheckListResult
  16. * @property {string|number} id id
  17. * @property {CheckListItemSerializerType} checkListItem
  18. * @property {GroupCheckResult[]} results 小组作出的评价
  19. */
  20. /**
  21. * @description 各个小组的评价 groupCheckResult
  22. * @typedef {Object} GroupCheckResult
  23. * @property {string|number} judgeItemId id
  24. * @property {number} level 小组作出的评价
  25. * @property {string} comment 小组作出的备注
  26. */
  27. /**
  28. * @description 生成DocResultSerializer
  29. * @returns {ReviewResultSerializerType}
  30. */
  31. const reviewResultSerializer = () => {
  32. /**
  33. * @return {GroupCheckResult}
  34. */
  35. const groupCheckResultItem = (level = 0) => ({
  36. judgeItemId: makeId(),
  37. level: level,
  38. comment: "我是备注我是小组备注"
  39. });
  40. /**
  41. * @returns {CheckListResult}
  42. */
  43. const checkListResultItem = () => ({
  44. id: makeId(),
  45. checkListItem: checkListItemSerializer(),
  46. results: [
  47. groupCheckResultItem(),
  48. groupCheckResultItem(1),
  49. groupCheckResultItem()
  50. ]
  51. });
  52. return {
  53. id: makeId(),
  54. detail: reviewDetailSerializer(),
  55. level: "A",
  56. score: 80,
  57. checkListResult: [checkListResultItem(), checkListResultItem()]
  58. };
  59. };
  60. module.exports = reviewResultSerializer;