__init__.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from fastapi import APIRouter
  4. from schemas.base import DetailMixin
  5. from schemas.paper import PaperList, PaperDetail, QuestionDetail, MarkTaskList, MarkTaskDetail
  6. from ._paper import get_papers, get_papers_info, create_paper, import_paper, update_paper, delete_paper
  7. from .marktask import (create_mark_task, update_mark_task, get_mark_task, get_mark_tasks,
  8. delete_mark_task, update_stdans_config)
  9. from .question import (create_question, update_question, get_question, get_question_list,
  10. delete_question, save_pieces, save_docs)
  11. router = APIRouter(tags=["试卷管理"])
  12. router.add_api_route("/papers",
  13. get_papers,
  14. methods=["get"],
  15. #response_model=PaperList,
  16. response_model_exclude_none=True,
  17. summary="试卷列表")
  18. router.add_api_route("/papers/{pid}",
  19. get_papers_info,
  20. methods=["get"],
  21. response_model_exclude_none=True,
  22. summary="试卷详情")
  23. router.add_api_route("/papers",
  24. create_paper,
  25. methods=["post"],
  26. response_model=PaperDetail,
  27. response_model_exclude_none=True,
  28. summary="创建试卷")
  29. router.add_api_route("/papers/{pid}",
  30. update_paper,
  31. methods=["put"],
  32. response_model=PaperDetail,
  33. response_model_exclude_none=True,
  34. summary="更新试卷")
  35. router.add_api_route("/papers/{pid}",
  36. delete_paper,
  37. methods=["delete"],
  38. response_model=PaperDetail,
  39. response_model_exclude_none=True,
  40. summary="删除试卷")
  41. router.add_api_route("/papers/bulk",
  42. import_paper,
  43. methods=["post"],
  44. response_model=PaperDetail,
  45. response_model_exclude_none=True,
  46. summary="批量导入试卷")
  47. # 试卷切割
  48. router.add_api_route("/questions/savepieces",
  49. save_pieces,
  50. methods=["post"],
  51. response_model=DetailMixin,
  52. response_model_exclude_none=True,
  53. summary="保存试卷切割")
  54. router.add_api_route("/questions/savedocs",
  55. save_docs,
  56. methods=["post"],
  57. response_model=DetailMixin,
  58. response_model_exclude_none=True,
  59. summary="保存电子试题")
  60. router.add_api_route("/questions",
  61. update_question,
  62. methods=["put"],
  63. response_model=QuestionDetail,
  64. response_model_exclude_none=True,
  65. summary="修改试卷切割/设置分值")
  66. router.add_api_route("/questions/{qid}",
  67. get_question,
  68. methods=["get"],
  69. response_model=QuestionDetail,
  70. response_model_exclude_none=True,
  71. summary="试卷切割详情")
  72. router.add_api_route("/questions/{qid}",
  73. delete_question,
  74. methods=["delete"],
  75. response_model=QuestionDetail,
  76. response_model_exclude_none=True,
  77. summary="删除试题")
  78. # 阅卷任务
  79. router.add_api_route("/marktask",
  80. create_mark_task,
  81. methods=["post"],
  82. response_model=MarkTaskDetail,
  83. response_model_exclude_none=True,
  84. summary="新增阅卷任务")
  85. router.add_api_route("/marktask/{tid}",
  86. update_mark_task,
  87. methods=["put"],
  88. response_model=MarkTaskDetail,
  89. response_model_exclude_none=True,
  90. summary="修改阅卷任务")
  91. router.add_api_route("/marktask/stdansconfig/{tid}",
  92. update_stdans_config,
  93. methods=["put"],
  94. response_model=MarkTaskDetail,
  95. response_model_exclude_none=True,
  96. summary="设置答题卡")
  97. router.add_api_route("/marktask/{tid}",
  98. get_mark_task,
  99. methods=["get"],
  100. response_model_exclude_none=True,
  101. summary="阅卷任务详情")
  102. router.add_api_route("/marktask/{tid}",
  103. delete_mark_task,
  104. methods=["delete"],
  105. response_model=MarkTaskDetail,
  106. response_model_exclude_none=True,
  107. summary="删除阅卷任务")
  108. router.add_api_route("/marktasks",
  109. get_mark_tasks,
  110. methods=["get"],
  111. response_model=MarkTaskList,
  112. response_model_exclude_none=True,
  113. summary="阅卷任务列表")
  114. __all__ = [router]