def service_create(): name = request.form.get('name', '').strip() icon = request.form.get('icon', '').strip() if not name: return Error.ARGUMENT_MISSING('name') srv = Service(name, icon) db.session.add(srv) db.session.commit() return jsonify({"service": srv.as_dict(True)})
def service_create(): name = request.form.get('name', '').strip() icon = request.form.get('icon', '').strip() if not name: return jsonify(Error.ARGUMENT_MISSING('name')) srv = Service(name, icon) db.session.add(srv) db.session.commit() return jsonify({"service": srv.as_dict(True)})
def service_create(): name = request.form.get('name', '').strip() icon = request.form.get('icon', '').strip() encrypted = request.form.get('encrypted', '').strip().lower() in ("1", "true", "yes") if not name: return jsonify(Error.ARGUMENT_MISSING('name')) srv = Service(name, icon, encrypted=encrypted) db.session.add(srv) db.session.commit() return jsonify({"service": srv.as_dict(True)})