Skip to content

Instantly share code, notes, and snippets.

@koladilip
Created March 1, 2024 16:03
Show Gist options
  • Save koladilip/da7f5c45c0da45d2fb78911c898d4093 to your computer and use it in GitHub Desktop.
Save koladilip/da7f5c45c0da45d2fb78911c898d4093 to your computer and use it in GitHub Desktop.
{
"code": "# Enter your Workflow code here\nsteps:\n - name: productCosts\n template: |\n .orders.products.(.price * .quantity)\n - name: computeTotal\n template: |\n $.sum($.outputs.productCosts)\n\n",
"name": "OrdersWorkflow",
"type": "Workflow",
"data": "{\n \"orders\": [\n {\n \"order_id\": \"OD123456789\",\n \"customer_id\": \"CUS987654321\",\n \"order_date\": \"2024-03-01\",\n \"products\": [\n {\n \"product_id\": \"PROD001\",\n \"name\": \"Smartphone\",\n \"price\": 99,\n \"quantity\": 3\n },\n {\n \"product_id\": \"PROD002\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"quantity\": 1\n }\n ]\n },\n {\n \"order_id\": \"OD987654321\",\n \"customer_id\": \"CUS123456789\",\n \"order_date\": \"2024-03-02\",\n \"products\": [\n {\n \"product_id\": \"PROD002\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"quantity\": 1\n },\n {\n \"product_id\": \"PROD003\",\n \"name\": \"Headphones\",\n \"price\": 25.50,\n \"quantity\": 2\n }\n ]\n }\n ]\n}",
"bindings": "const bindings = {\n \"description\": \"Enter your bindings here\"\n };"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment