__init__.py 4.6 KB

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