Hi, I read about your problem and the answers you've received. They're all correct, but there's one you should pay particular attention to: the risks involved in doing this type of repair. I'm not saying you shouldn't do it yourself, but if you do, I suggest you thoroughly research the brake system, how it works, and the precautions you should take when working with these components, especially the brake fluid, which is very harmful. Doing the repair yourself will only save you on labor costs, but not on parts and replacements, since you need to use the best quality ones.
As for the work you need to do, to get it right, you have to disassemble the entire system and check each of its components (pump, pistons, cylinders, and lines). For the pump, pistons, and cylinders, you should check that they aren't pitted or show signs of corrosion. If you find any damage, replace the part. Don't try to clean it with emery paper or sandpaper, as this will damage it even more. You should clean the pipes internally, taking care to remove all solid material from inside. Avoid using compressed air to blow out the pipes, as any solid object inside will become a projectile propelled by the compressed air, potentially injuring someone or yourself. I hope this helps and that I haven't bored you with my encyclopedia. Good luck with your challenge!