That's the main problem that of the population has. They reward bad behavior and allow people to disrespect them over and over again. You disrespect me once, just one time, I'll make you regret it for the rest of your goddamn life.
You can't change your situation but you can change your attitude in how you decide to see it and take the actions from there that's beneficial. Choose to be positive, find strength, be the better person. Be the better you.
Just because you aren't given the credit and haven't been recognised for your work doesn't mean you have to give up or stop. You don't always need credit, other people do not always have to know what you are capable of doing as long as you do.
TRAIN your mind to see the good in every situation. It won't come naturally, you WILL have to work at it, but eventually it will become second nature and you will have joy in your life even when things aren't going your way.