Soak the salted cod in water for 24 hours, changing the water 3-4 times to remove excess salt. Once soaked, drain and cut the cod into large pieces.
Boil the cod in a pot of water for about 10-15 minutes until it flakes easily. Remove from heat, drain, and set aside.
In a separate pot, boil the potatoes until tender. Drain and mash them with a potato masher.
Preheat oven to 350°F (180°C).
In a pan, sauté the onions and garlic in olive oil until soft and translucent.
In a small saucepan, heat the milk. Gradually add the milk to the mashed potatoes until you achieve a creamy consistency.
Place the cod pieces in the bottom of a baking dish. Spread the mashed potatoes over the cod.
Spread mayonnaise over the mashed potatoes layer.
Bake in the preheated oven for about 30 minutes or until the top is golden brown and bubbly.
Serve hot, garnished with olives.
Enjoy!