Circuit with reversing polarity and two microswitches
put diodes in parallel with the switches so that when activated the motor can back-out of the switch activation.

else move the microswitches into the circuitry around the DPDT so that each switch only breaks one of the directions.