(feat) add countPending function
(feat) fix promise in the pending
(feat) refactor pendingController to use PendingFactory