Example #1
0
def addCar() -> render_template:
    """Добавить ТС"""

    lastPage: str = session.get('lastPage') if session.get('lastPage') else '/'

    if request.method == 'POST':
        wallet: str = session.get('wallet')
        private_key: str = request.form['private_key']
        price: int = int(request.form['price'])
        model: str = request.form['model']
        category: str = request.form['category']
        year: int = int(request.form['year'])

        response: dict = User.addCar(wallet, private_key, model, category,
                                     price, year)
        if response['status']:
            flash(response['msg'])
            return render_template('html/main.html',
                                   lastPage=lastPage,
                                   info=True)
        else:
            flash(response['msg'])
            return render_template('html/main.html',
                                   lastPage=lastPage,
                                   addCar=True)
Example #2
0
    def addCar(private_key: str, model: str, category: str, market_price: int,
               year: int) -> None:
        """Добавить ТС"""

        response: dict = User.addCar(functional.wallet, private_key, model,
                                     category, market_price, year)

        if response['status']:
            cli.Logger.info(response['msg'])
        else:
            cli.Logger.warn(response['msg'])