Is it harmful for a hydraulic brakes bike to be put upside down
There are two risks to turning your hydraulic brakes upside-down.

The brake system isn't filled to overflowing with hydraulic fluid: there's likely to be a small air bubble. Normally, this sits at the highest point of the system: the oil reservoir at the brake lever. There, it's not compressed by the piston when you brake, so it can't interfere with braking. If you up-end your bike, air bubbles might travel through the system to the brake pads. If they don't manage to make it back up to the reservoir before you want to brake, you might find your brakes are squishier than usual. 15 minutes is perhaps a pessimistic estimate, and it's not that much of a risk unless you get on your bike and right away need to brake very hard.

The other potential problem is if the seals in the oil reservoir aren't quite tight. You might not notice in normal use, because they're at the top, but when they're at the bottom of the system, the pressure might let some brake fluid seep out. If you notice this happening, stop turning your bike upside-down, and make sure to check that you still have enough fluid to brake properly. If it keeps happening after you've re-tightened the seal, you may need to change the rubber grommet(s). Often rubber seals are dissolved over time by the oil, and stop doing their job properly.

As others have said in the comments, you'd be better off avoiding the need to turn your bike upside-down. Find where the water is getting into the frame and seal any gaps. Some bikes already come with holes in the bottom in case they need to drain, and you might consider adding your own.