22 lines
721 B
Python
22 lines
721 B
Python
from fastapi import APIRouter, Depends
|
|
from db.handlers.actions import StocksActions
|
|
from utils import requestDict, logger
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.post("/")
|
|
async def post_requests(
|
|
reqData: dict = Depends(requestDict),
|
|
):
|
|
logger.info("Получение записи о перемещении инструмента")
|
|
request_id = reqData.get("body").get("request_id")
|
|
user_id = reqData.get("body").get("user_id")
|
|
accepted = reqData.get("body").get("accepted")
|
|
if request_id and user_id and accepted is not None:
|
|
result = await StocksActions.movingDecision(int(request_id), user_id, accepted)
|
|
if result:
|
|
return {"status": "ok"}
|
|
return {"status": "error"}
|