query promise pattern passing values through chain