app/modules/transactions/routes.py
def create_outgoing_transaction(transaction: OutgoingTransactionCreate, db: Session = Depends(get_db), auth_user: User=Depends(manager)):
    """
    ## Creates an outgoing transaction.

    ### Args:  
      >  transaction (OutgoingTransactionCreate): The outgoing transaction create model.

    ### Returns:  
      >  OutgoingTransactionResponse: The outgoing transaction response model.
    """
    try:
        transaction = transaction_service.create(db, auth_user, transaction)
        return transaction
    except ItensNotFound as err:
	    raise HTTPException(status_code=404, detail=f"Os seguintes produtos não foram encontrados no sistema: {str(err)}")
    except ProductsNotFound as err:
        raise HTTPException(status_code=400, detail="A movimentação a ser registrada deve conter no minimo um produto.")
    except InvalidStockQuantity as err:
        products_missing = transaction_service.make_response(db, str(err))
        raise HTTPException(status_code=400, detail={
            "message": "A quantidade informada para os seguintes produtos deve ser maior do que zero.",
            "products_missing": products_missing
        })
    except NotEnoughStockQuantity as err:
        products_missing = transaction_service.make_response(db, str(err))
        raise HTTPException(status_code=422, detail={
            "message": "Os produtos informados não possuem quantidade em estoque suficiente para a saída.",
            "products_missing": products_missing
        })

    ## Creates an outgoing transaction.

    ### Args:  
      >  transaction (OutgoingTransactionCreate): The outgoing transaction create model.

    ### Returns:  
      >  OutgoingTransactionResponse: The outgoing transaction response model.
    
Creates an outgoing transaction.
Args:
>  transaction (OutgoingTransactionCreate): The outgoing transaction create model.

>  OutgoingTransactionResponse: The outgoing transaction response model.
Creates an outgoing transaction . Args : > transaction ( OutgoingTransactionCreate ) : The outgoing transaction create model . > OutgoingTransactionResponse : The outgoing transaction response model .
def create_outgoing_transaction(transaction: OutgoingTransactionCreate, db: Session = Depends(get_db), auth_user: User=Depends(manager)):
    try:
        transaction = transaction_service.create(db, auth_user, transaction)
        return transaction
    except ItensNotFound as err:
	    raise HTTPException(status_code=404, detail=f"Os seguintes produtos não foram encontrados no sistema: {str(err)}")
    except ProductsNotFound as err:
        raise HTTPException(status_code=400, detail="A movimentação a ser registrada deve conter no minimo um produto.")
    except InvalidStockQuantity as err:
        products_missing = transaction_service.make_response(db, str(err))
        raise HTTPException(status_code=400, detail={
            "message": "A quantidade informada para os seguintes produtos deve ser maior do que zero.",
            "products_missing": products_missing
        })
    except NotEnoughStockQuantity as err:
        products_missing = transaction_service.make_response(db, str(err))
        raise HTTPException(status_code=422, detail={
            "message": "Os produtos informados não possuem quantidade em estoque suficiente para a saída.",
            "products_missing": products_missing
        })
def create_outgoing_transaction ( transaction : OutgoingTransactionCreate , db : Session = Depends ( get_db ) , auth_user : User = Depends ( manager ) ) : try : transaction = transaction_service . create ( db , auth_user , transaction ) return transaction except ItensNotFound as err : raise HTTPException ( status_code = 404 , detail = f"Os seguintes produtos não foram encontrados no sistema: {str(err)}") except ProductsNotFound as err : raise HTTPException ( status_code = 400 , detail = "A movimentação a ser registrada deve conter no minimo um produto.") except InvalidStockQuantity as err : products_missing = transaction_service . make_response ( db , str ( err ) ) raise HTTPException ( status_code = 400 , detail = { "message" : "A quantidade informada para os seguintes produtos deve ser maior do que zero." , "products_missing" : products_missing } ) except NotEnoughStockQuantity as err : products_missing = transaction_service . make_response ( db , str ( err ) ) raise HTTPException ( status_code = 422 , detail = { "message" : "Os produtos informados não possuem quantidade em estoque suficiente para a saída.", "products_missing" : products_missing } )
Creates an outgoing transaction.
Creates an outgoing transaction .
"""
    ## Creates an outgoing transaction.

    ### Args:  
      >  transaction (OutgoingTransactionCreate): The outgoing transaction create model.

    ### Returns:  
      >  OutgoingTransactionResponse: The outgoing transaction response model.
    """
transaction
OutgoingTransactionCreate
db
Session
auth_user
User