MCPcopy Create free account
hub / github.com/Shopify/function-examples / run

Function run

order-routing/rust/location-rules/default/src/run.rs:11–35  ·  view source on GitHub ↗
(input: input::ResponseData)

Source from the content-addressed store, hash-verified

9
10#[shopify_function_target(query_path = "src/run.graphql", schema_path = "schema.graphql")]
11fn run(input: input::ResponseData) -> Result<output::FunctionRunResult> {
12 let operations = input
13 .fulfillment_groups
14 .iter()
15 .map(|group| {
16 let rankings = group
17 .inventory_location_handles
18 .iter()
19 .map(|location_handle| output::RankedLocation {
20 location_handle: location_handle.clone(),
21 rank: 0,
22 })
23 .collect::<Vec<output::RankedLocation>>();
24
25 output::Operation {
26 rank: output::FulfillmentGroupRankedLocations {
27 fulfillment_group_handle: group.handle.clone(),
28 rankings,
29 },
30 }
31 })
32 .collect();
33
34 Ok(output::FunctionRunResult { operations })
35}
36
37#[cfg(test)]
38mod tests {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected