def put(self, id): """ Update a Product by id. """ token = request.headers.get('Authorization') auth = Validations.validate_user_authorization(token) json_data = request.json validation = Validations.product_validate(json_data) return ProductManager.update_existing_product(id, json_data)
def post(self): """ Register a new Product. """ token = request.headers.get('Authorization') auth = Validations.validate_user_authorization(token) json_data = request.json validation = Validations.product_validate(json_data) return ProductManager.register_new_product(json_data)