Psalm 150, the last of the psalms exhorts us to praise God 13 times. It's only a short psalm. It's a fitting end to the psalms which is a compilation of many sides of life, hard tests, persecutions, wonderful original insights. Lots of things. The last five psalms start and end with "Praise the LORD". That is interesting, Maybe I should be praising God a lot more. It takes your mind off negatives and gives you something positive to think about and do. It's got to be helpful to our faith lives.
The book of Job also is about severe trials, and ends happily for Job. He is blessed materially in the latter part of his life, God doubling his animal stock. God also gave him the same number of sons and daughters he had at the start of his trial. Whatever was taken away, was returned.
All the gospels end happily. With the resurrection of Jesus. That is the event that gave each of us salvation, eternal life and enabled us to have a daily one to one with God the Father. I'd say that's a most significant happy ending to those books since from them we know how to get right with God.
The book of Revelation ends happily, with heaven in sight. The redeemed will live in heaven free of pain and hurts.
I hope that you also have a happy ending to your life. God always slots in happy times for us now and then at least. For now perhaps praising God is the key to live a more consistent, joyous life.