update models and thing controller to typescript