Exemplo n.º 1
0
def add_product(product: Product, user_id: int):
    product.added_by = user_id
    try:
        get_db().session.add(product)
        get_db().session.commit()
    except Exception as e:
        logging.warning('Problem with add new product: ' + product.name)
        traceback.print_exc()
        raise CustomError(Error.PRODUCT_ADD_ERROR, 400)
Exemplo n.º 2
0
def add_product(product: Product, user_id: int):
    product.added_by = user_id
    get_db().session.add(product)