datax_json.py 739 B

123456789101112131415161718192021222324252627282930
  1. from fastapi import APIRouter
  2. from fastapi import Depends, Body
  3. from sqlalchemy.orm import Session
  4. from app import schemas
  5. from app.common.decorators import verify_all
  6. import app.crud as crud
  7. from utils.sx_time import sxtimeit
  8. from utils.sx_web import web_try
  9. from fastapi_pagination import Page, add_pagination, paginate, Params
  10. from app import get_db
  11. router = APIRouter(
  12. prefix="/jpt/datax",
  13. tags=["datax构建JSON"],
  14. )
  15. @router.post("/", dependencies=[Depends(verify_all)])
  16. @web_try()
  17. @sxtimeit
  18. def build_datax_json(param: schemas.DataXJsonParam=Body(
  19. examples = schemas.DataXJsonParam.Config.schema_extra['examples']
  20. ), db: Session = Depends(get_db)):
  21. print(param)
  22. return crud.generate_datax_json(db, param)