I’d create an array from the from values in a route pattern, then redirect to the equivalent to value.
I.e. pluck all from values from the structure field, create a pattern from that array and you are good to go.
Old KIrby 2 example, but logic is the same: Dynamic Routes Question - #4 by texnixe
Then inside the route, you fetch the corresponding to value from the structure field.