If you contractually gave your employer the right to any ideas or work you do outside of employment, that is legal. Therefore, to answer your question, you need to take the agreement you signed to an attorney who can review it with you, to determine exactly what rights you gave up.