ebanutsya
This commit is contained in:
		@@ -85,6 +85,33 @@ def close_assembly():
 | 
				
			|||||||
    return sipro.api.orders.close_order(order_id)
 | 
					    return sipro.api.orders.close_order(order_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@assembly_blueprint.post('/cancel')
 | 
				
			||||||
 | 
					def cancel_assembly():
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        user_id = get_jwt_identity()
 | 
				
			||||||
 | 
					        assembly = database.Assembly.query.filter(database.Assembly.user_id == user_id,
 | 
				
			||||||
 | 
					                                                  database.Assembly.is_active == True).first()
 | 
				
			||||||
 | 
					        if not assembly:
 | 
				
			||||||
 | 
					            response = {
 | 
				
			||||||
 | 
					                'ok': False,
 | 
				
			||||||
 | 
					                'message': 'У вас нет активных сборок'
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return jsonify(response)
 | 
				
			||||||
 | 
					        database.db.session.delete(assembly)
 | 
				
			||||||
 | 
					        database.db.session.commit()
 | 
				
			||||||
 | 
					        response = {
 | 
				
			||||||
 | 
					            'ok': True,
 | 
				
			||||||
 | 
					            'message': 'Сборка успешно отменена!'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return jsonify(response)
 | 
				
			||||||
 | 
					    except Exception as e:
 | 
				
			||||||
 | 
					        response = {
 | 
				
			||||||
 | 
					            'ok': False,
 | 
				
			||||||
 | 
					            'message': f'Неизвестная ошибка: {e}'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return jsonify(response)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@assembly_blueprint.get('/hasActive')
 | 
					@assembly_blueprint.get('/hasActive')
 | 
				
			||||||
def user_has_active_assembly():
 | 
					def user_has_active_assembly():
 | 
				
			||||||
    user_id = get_jwt_identity()
 | 
					    user_id = get_jwt_identity()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,11 +28,11 @@ def get_orders():
 | 
				
			|||||||
    return jsonify(response)
 | 
					    return jsonify(response)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@orders_blueprint.get('/getBySupplierProductId')
 | 
					@orders_blueprint.get('/getByProductId')
 | 
				
			||||||
def get_orders_by_supplier_product_id():
 | 
					def get_orders_by_supplier_product_id():
 | 
				
			||||||
    args = request.args
 | 
					    args = request.args
 | 
				
			||||||
    supplier_product_id = args.get('supplierProductId')
 | 
					    product_id = args.get('productId')
 | 
				
			||||||
    return sipro.api.orders.get_orders_by_supplier_product_id(supplier_product_id)
 | 
					    return sipro.api.orders.get_orders_by_product_id(product_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@orders_blueprint.get('/getOrderById')
 | 
					@orders_blueprint.get('/getOrderById')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,8 +4,8 @@ client = get_client()
 | 
				
			|||||||
router = '/orders'
 | 
					router = '/orders'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_orders_by_supplier_product_id(supplier_product_id: str) -> list[dict]:
 | 
					def get_orders_by_product_id(supplier_product_id: str) -> list[dict]:
 | 
				
			||||||
    method = f'{router}/getBySupplierProductId?supplierProductId={supplier_product_id}'
 | 
					    method = f'{router}/getByProductId?productId={supplier_product_id}'
 | 
				
			||||||
    response = client.method('GET', method)
 | 
					    response = client.method('GET', method)
 | 
				
			||||||
    return response
 | 
					    return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user