#!/usr/bin/env python # -*- coding: utf-8 -*- from fastapi import APIRouter from schemas.base import DetailMixin from schemas.paper import PaperList, PaperDetail, QuestionDetail, MarkTaskList, MarkTaskDetail from ._paper import get_papers, get_papers_info, create_paper, import_paper, update_paper, delete_paper from .marktask import (create_mark_task, update_mark_task, get_mark_task, get_mark_tasks, delete_mark_task, update_stdans_config) from .question import (create_question, update_question, get_question, get_question_list, delete_question, save_pieces, save_docs) router = APIRouter(tags=["试卷管理"]) router.add_api_route("/papers", get_papers, methods=["get"], #response_model=PaperList, response_model_exclude_none=True, summary="试卷列表") router.add_api_route("/papers/{pid}", get_papers_info, methods=["get"], response_model_exclude_none=True, summary="试卷详情") router.add_api_route("/papers", create_paper, methods=["post"], response_model=PaperDetail, response_model_exclude_none=True, summary="创建试卷") router.add_api_route("/papers/{pid}", update_paper, methods=["put"], response_model=PaperDetail, response_model_exclude_none=True, summary="更新试卷") router.add_api_route("/papers/{pid}", delete_paper, methods=["delete"], response_model=PaperDetail, response_model_exclude_none=True, summary="删除试卷") router.add_api_route("/papers/bulk", import_paper, methods=["post"], response_model=PaperDetail, response_model_exclude_none=True, summary="批量导入试卷") # 试卷切割 router.add_api_route("/questions/savepieces", save_pieces, methods=["post"], response_model=DetailMixin, response_model_exclude_none=True, summary="保存试卷切割") router.add_api_route("/questions/savedocs", save_docs, methods=["post"], response_model=DetailMixin, response_model_exclude_none=True, summary="保存电子试题") router.add_api_route("/questions", update_question, methods=["put"], response_model=QuestionDetail, response_model_exclude_none=True, summary="修改试卷切割/设置分值") router.add_api_route("/questions/{qid}", get_question, methods=["get"], response_model=QuestionDetail, response_model_exclude_none=True, summary="试卷切割详情") router.add_api_route("/questions/{qid}", delete_question, methods=["delete"], response_model=QuestionDetail, response_model_exclude_none=True, summary="删除试题") # 阅卷任务 router.add_api_route("/marktask", create_mark_task, methods=["post"], response_model=MarkTaskDetail, response_model_exclude_none=True, summary="新增阅卷任务") router.add_api_route("/marktask/{tid}", update_mark_task, methods=["put"], response_model=MarkTaskDetail, response_model_exclude_none=True, summary="修改阅卷任务") router.add_api_route("/marktask/stdansconfig/{tid}", update_stdans_config, methods=["put"], response_model=MarkTaskDetail, response_model_exclude_none=True, summary="设置答题卡") router.add_api_route("/marktask/{tid}", get_mark_task, methods=["get"], response_model_exclude_none=True, summary="阅卷任务详情") router.add_api_route("/marktask/{tid}", delete_mark_task, methods=["delete"], response_model=MarkTaskDetail, response_model_exclude_none=True, summary="删除阅卷任务") router.add_api_route("/marktasks", get_mark_tasks, methods=["get"], response_model=MarkTaskList, response_model_exclude_none=True, summary="阅卷任务列表") __all__ = [router]