ticket3:added middleware and model for it