Add ticket assign API and refactor.